-
Notifications
You must be signed in to change notification settings - Fork 19
Switch design to immutable samplers #42
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
Codecov Report
@@ Coverage Diff @@
## master #42 +/- ##
==========================================
- Coverage 97.82% 97.54% -0.29%
==========================================
Files 6 6
Lines 138 122 -16
==========================================
- Hits 135 119 -16
Misses 3 3
Continue to review full report at Codecov.
|
cpfiffer
left a comment
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.
Generally neat, thanks! I left a couple minor comments.
|
I added a deprecation (and tests for it). |
cpfiffer
left a comment
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.
Great work, thanks!
|
Please don't merge this PR, even though it's approved. I'd like to have working branches of DynamicPPL and Turing available locally before merging this PR (should be ready within the next days). |
|
Okay. Do you want to merge this into |
|
I don't think there's an advantage in creating a |
|
https://github.com/TuringLang/EllipticalSliceSampling.jl/compare/abstractmcmc2 shows the changes in EllipticalSliceSampling for this PR (also removed the |
|
I'm wondering if we should actually just merge and release AbstractMCMC 2.0. There's no need to update all packages before it is released, with a new release I could just make a PR to EllipticalSliceSampling and run CI tests instead of relying on my local setup, and packages that are not compatible will be informed by CompatHelper about the new release but users will still only be able to use the version that was declared to be compatible. |
|
Yeah, I think it's fine. I believe most everything downstream has the correct Semver bounds. |
This PR is a proposal to fix #31.
The current interface with
sample_init!,step!,transitions,save!!,sample_end!, andbundle_samplesis replaced withstep(rng, model, sampler[, state; kwargs...])that returns a 2-tuple of the next sample and state (similar toBase.iterate) and takes the state of the sampler as an argument in all but the initial stepsamples(sample, model, sampler[, N; kwargs...])creates a container for the samples with initial samplesampleand (potentially) predefined number of samplesNsave!!(samples, sample, iteration, model, sampler[, N; kwargs...])saves thesamplein the giveniterationin the container ofsamplesbundle_samples(samples, model, sampler, state, chain_type[; kwargs...])creates the returned chain of typechain_typefrom thesamples(the finalstateof the sampler can be saved as well if desired)Additionally, the PR contains some improvements (which ended up in here but could be moved to separate PRs if desired) such as
try-finallyblock (as suggested a while ago on Slack)