Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Implement GuideMessenger, AutoNormalMessenger, AutoRegressiveMessenger #2953
Implement GuideMessenger, AutoNormalMessenger, AutoRegressiveMessenger #2953
Changes from 11 commits
84feca4
afe472c
75a0a6f
b656276
6c29e1b
2993402
6eb02e4
84d5e60
3d5250e
0ac9ae1
0637e00
bb092a9
bc889e4
56d26af
26bd9bf
8556734
7715687
5c3e5bc
f03401a
8749c96
c161ebb
872b82d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
The guide will become fully hierarchical if you do this but it is not fully hierarchical by default, right?
Ideally one can add some kind of test of whether this site has dependency sites.
You are also mentioning that it could be useful to encode a more complex dependency:
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.
Correct, the intention of this simple guide is to be mean field.
Do you want to try contributing an
AutoHierchicalNormalMessenger
guide as a follow-up to this PR? I tried to do something similar withAutoRegressiveMessenger
below by sampling from the prior and then shifting in unconstrained space. I was unsure how to implement a generalAutoHierarchicalNormalMessenger
because not allprior
distributions have a.mean
method, and even then it is the mean in unconstrained space that we care about. E.g. how do we deal withGamma
orLogNormal
orBeta
orDirichlet
?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.
I understand your point about the distributions that don't have the mean. What are those distributions by the way?
I am thinking about this solution:
Does it make sense for all distributions that have the mean?
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.
Yes, I will do
AutoHierchicalNormalMessenger
PR - should I wait until this PR is merged?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.
Cauchy
andStable
have infinite variance and no defined meanVonMises3D
andProjectedNormal
have no defined mean.TransformedDistribution(Normal(...), MyNormalizingFlow)
.First I would opt for
prior.mean
rather thanprior.loc
, since e.g.LogNormal(...).loc
isn't a mean, rather it is the mean of the pre-transformed normal. Second note that the transform of the constrained mean is not the same as the unconstrained mean or unconstrained median, e.g. for LogNormal,mean = exp(loc + scale**2 / 2)
whereasmedian = exp(loc)
.I think your
.mean
idea is good enough in most cases, and for cases where it fails, users can subclass and define their own custom.get_posterior()
methods.