-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi Latent Likelihoods using new quadrature Likelihoods #1559
Conversation
* fixes * typo fix; reshaping fix * notebook showing how to use HeteroskedasticTFPDistribution likelihood * converting to .pct.py format * removed .ipynb * better descriptions * black auto-formatting Co-authored-by: Gustavo Carvalho <gustavo.carvalho@delfosim.com>
These tests ensure that heteroskedastic likelihood with a constant variance, will give the same results as a Gaussian likelihood with the same variance.
…drature-likelihood
…/GPflow/GPflow into gustavocmv/quadrature-likelihood
…GPflow into vincent/st/heteroscedastic
Co-authored-by: Vincent Dutordoir <dutordoirv@gmail.com>
…/GPflow/GPflow into gustavocmv/quadrature-likelihood
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, ready to merge.
|
||
@property | ||
def quadrature(self): | ||
if self._quadrature is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a stylistic point, others may disagree, but I find this sort of precondition checking easier to read if you invert the if statements so that the condition and what happens if it fails are grouped together, e.g.
`
if self._quadrature is None:
return self._quadrature
if self.latent_dim is None:
raise Exception(
"latent_dim not specified. "
"Either set likelihood.latent_dim directly or "
"call a method which passes data to have it inferred."
)
with tf.init_scope():
self._quadrature = NDiagGHQuadrature(self.latent_dim, self.num_gauss_hermite_points)
`
That way you end up with fewer levels of nesting, and it's easier to separate the precondition checking from what the method really does.
This PR adds
MultiLatent
likelihoods, of whichHeteroskedasticTFPConditional
is an example, on top of the newly refactoredQuadratureLikelihood
s (PR #1549).A notebook (courtesy of @st-- in PR #1455 ) and tests are added for documentation purposes.