-
Notifications
You must be signed in to change notification settings - Fork 230
Allow sampling from the prior #1243
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
|
As I said, I'm not fully satisfied with the fact that we just introduce a One idea would be to move the Another idea would be to just drop |
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.
thanks @devmotion, looks good overall. I left some minor comments below.
|
tests are failing with the following error: https://travis-ci.com/github/TuringLang/Turing.jl/jobs/325101686#L623 |
|
A new DynamicPPL release should fix the test errors, at least it worked for me with the master branch. |
|
I'll update this PR and address the comments when #1249 is merged. |
Co-authored-by: Hong Ge <hg344@cam.ac.uk>
Codecov Report
@@ Coverage Diff @@
## master #1243 +/- ##
==========================================
+ Coverage 66.25% 67.12% +0.87%
==========================================
Files 25 25
Lines 1286 1305 +19
==========================================
+ Hits 852 876 +24
+ Misses 434 429 -5
Continue to review full report at Codecov.
|
|
The failing tests are related to the prior sampler tests. Seems the error bound for the prior sampler tests is too tight. |
|
I set a seed and increased the number of samples. Locally tests pass now, hopefully this fixes CI tests as well 🤞 |
|
Looks like the tests are passing now - thanks, @devmotion! |
* Allow sampling from the prior * Apply suggestions from code review Co-authored-by: Hong Ge <hg344@cam.ac.uk> * Use `getlogp` instead of `getlp` * Add seed and increase number of samples Co-authored-by: Hong Ge <hg344@cam.ac.uk>
This PR is an alternative to #1225. I tried to reduce the existing amount of type piracy and to clean the existing implementation by moving HMC-specific stuff to the implementation of the AbstractMCMC interface for HMC samplers. The bundle_samples implementations for SampleFromPrior are still type piracy, since neither the function nor the input types are owned by Turing. Also to avoid type piracy and too Turing-specific implementations of the interface for SampleFromPrior (Turing sets the default chain_type to
MCMCChains.Chainswhich one can't do in a generic implementation in DynamicPPL), I added aPrioralgorithm type that is owned by Turing and just samples using aSampleFromPrior. However, I'm not completely sure if that's a good idea.The PR needs the implementation of
step!for SampleFromPrior in the master branch of DynamicPPL.