-
Notifications
You must be signed in to change notification settings - Fork 37
Fix SampleFromUniform and implement AbstractMCMC interface for SampleFromPrior and SampleFromUniform #77
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
Conversation
|
I don't think SampleFromUniform is applicable here. It is only used for initializing HMC. |
|
It's also buggy. I will make a PR to fix it. |
Codecov Report
@@ Coverage Diff @@
## master #77 +/- ##
==========================================
+ Coverage 76.92% 77.01% +0.09%
==========================================
Files 13 13
Lines 845 844 -1
==========================================
Hits 650 650
+ Misses 195 194 -1
Continue to review full report at Codecov.
|
I think it's worth including. I'm using it a lot in the MLE/MAP code so I would like to see |
| transition; | ||
| kwargs... | ||
| ) | ||
| vi = VarInfo() |
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 think we should store a VarInfo(model) inside the SampleFromPrior struct to use the TypedVarInfo.
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'm not sure if it's worth constructing a TypedVarInfo object from the UntypedVarInfo object in every sample step. If you use Turing, by default a Chains object will be constructed from the vector of UntypedVarInfo anyways, and otherwise you can still convert the vector to a vector of TypedVarInfo afterwards if needed.
|
This PR reverts parts of #78. The problems with this PR are:
This PR now reverts the changes related to the |
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. Thanks @devmotion! Btw, UnitDistribution and PositiveDistribution are subtypes of TransformDistribution so adding them to the Union is not necessary.
|
InverseGamma distributions are definitely not covered by the current implementation (and hence just sampled from the prior) - I spent so much time with debugging that I'm quite sure about this point 😄 |
|
And UnitDistribution as well: https://github.com/TuringLang/Bijectors.jl/blob/cd349b7cb6d2dc3b7109bb8492f6c54f335eef2b/src/Bijectors.jl#L240 |
|
Yes both are unions but julia> InverseGamma <: DynamicPPL.TransformDistribution
true |
|
I think the reason why it is sampled from the prior is that |
|
Hmm...😄 Not sure why I thought it didn't work. But is it also a subtype of |
Yes |
This PR enables sampling from the prior and with the uniform initialization.
Unfortunately, I have no idea what distributions we expect with the uniform initialization - I studied the code in utils.jl, but I'm a bit confused why we don't just sample from the normal and inverse gamma prior - shouldn't only
TransformDistribution,SimplexDistribution, andPDMatDistributionbe initialized with a different algorithm? So the test for the uniform initialization has to be adjusted to the correct expected values.