Sc336/api documentation refresh#2012
Conversation
304a1f6 to
db3e9b6
Compare
| class Module(tf.Module): | ||
| """ | ||
| Modules recursively compose other Modules and parameters to create models. | ||
| All GPFlow models, kernels, mean functions etc. are Modules. |
There was a problem hiding this comment.
| All GPFlow models, kernels, mean functions etc. are Modules. | |
| All GPflow models, kernels, mean functions etc. are Modules. |
| See also `this <https://www.tensorflow.org/api_docs/python/tf/Module>`_ documentation for the base class in | ||
| Tensorflow which goes into more detail as to why we use Module objects to compose things. |
There was a problem hiding this comment.
| See also `this <https://www.tensorflow.org/api_docs/python/tf/Module>`_ documentation for the base class in | |
| Tensorflow which goes into more detail as to why we use Module objects to compose things. | |
| See also `TensorFlow's documentation <https://www.tensorflow.org/api_docs/python/tf/Module>`_ for the base class | |
| which goes into more detail as to why we use Module objects to compose things. |
|
|
||
| class Module(tf.Module): | ||
| """ | ||
| Modules recursively compose other Modules and parameters to create models. |
There was a problem hiding this comment.
| Modules recursively compose other Modules and parameters to create models. | |
| Modules recursively compose other Modules and parameters to create models. | |
| Compared to the `tf.Module` base class, `gpflow.Module` includes additional support for handling `gpflow.Parameter` attributes, see :py:attr:`~parameters` and :py:attr:`~trainable_parameters`. | |
| It also adds pretty-printing within IPython and Jupyter notebooks. |
There was a problem hiding this comment.
to explain why there's a separate class
There was a problem hiding this comment.
(as an aside, it would be nice if the pretty printing were accessible via a public method!)
| is provided, these two values will be the same. It is often challenging to operate with | ||
| unconstrained parameters. For example, a variance cannot be negative, therefore we need a | ||
| positive constraint and it is natural to use constrained values. A prior can be imposed |
There was a problem hiding this comment.
While we're looking at this, would it be worth clarifying that for us (humans), the constrained space is "natural" and "easy", whereas for the optimizer, constraints are hard and the unconstrained space is natural/easy, which is why we want to present it to the optimizer in unconstrained form?
There was a problem hiding this comment.
Sounds like a good idea.
| independently for each row of X. | ||
|
|
||
| This class is not only used for mean functions. For example, the variance of a | ||
| heteroskedastic model is specified using a Function. |
There was a problem hiding this comment.
This is only true for some heteroskedastic models, when the variance is given in a parametric form. You can also build heteroskedastic models where the variance is modeled with another GP. Then it doesn't use this class.
There was a problem hiding this comment.
| heteroskedastic model is specified using a Function. | |
| heteroskedastic model can be specified using a `Function`. |
and add a link to the corresponding notebook?
Codecov ReportBase: 98.09% // Head: 98.09% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #2012 +/- ##
===========================================
- Coverage 98.09% 98.09% -0.01%
===========================================
Files 93 93
Lines 5262 5261 -1
===========================================
- Hits 5162 5161 -1
Misses 100 100
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
| class Parameter(tfp.util.TransformedVariable): | ||
| """A parameter retains both constrained and unconstrained representations. If no transform | ||
| is provided, these two values will be the same. It is often challenging for humans to operate with | ||
| unconstrained parameters, although this is typically easier for the optimiser. For example, a variance cannot be negative, therefore we need a |
There was a problem hiding this comment.
Isn't this giving "line too long" linting errors? Either way, should probably rejustify.
| type=str, | ||
| nargs="*", | ||
| help="Only process the notebooks with this base/stem name. Useful when debugging.", | ||
| help="Only process the notebooks with this base/stem name; this is typically much faster and is useful when debugging. For example, to process notebooks/tailor/external-mean-function.pct.py, use --limit_notebooks external-mean-function\n", |
There was a problem hiding this comment.
| help="Only process the notebooks with this base/stem name; this is typically much faster and is useful when debugging. For example, to process notebooks/tailor/external-mean-function.pct.py, use --limit_notebooks external-mean-function\n", | |
| help="Only process the notebooks with this base/stem name; this is much faster and is useful when debugging. For example, to process notebooks/tailor/external-mean-function.pct.py, use --limit_notebooks external-mean-function\n", |
|
|
||
| class Module(tf.Module): | ||
| """ | ||
| Modules recursively compose other Modules and parameters to create models. |
There was a problem hiding this comment.
(as an aside, it would be nice if the pretty printing were accessible via a public method!)
| ) -> tf.Tensor: | ||
| """ | ||
| Compute the log density of the data at the new data points. | ||
| Compute the log of the probability density of the data at the new data points. |
There was a problem hiding this comment.
Genuine question: is log-density not a standard term?
There was a problem hiding this comment.
I think it's standard enough, but it doesn't hurt to be a bit verbose in the docstring. The function is already called log_density..
gpflow.utilities.print_summary() ? |
PR type: doc improvement
Related issue(s)/PRs: Contributes to #1823
Summary
A few comments were in places that meant they weren't getting picked up by Sphinx. A few others were unclear enough I had to ask for some help in understanding them; I've updated these to make them more clear.
Fully backwards compatible: yes
PR checklist
make format)make check-all)