Clean up sample loop, pass discard_sample keyword as kwarg to step/step_warmup#194
Merged
Conversation
Contributor
|
AbstractMCMC.jl documentation for PR #194 is available at: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #194 +/- ##
===========================
===========================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
penelopeysm
added a commit
to TuringLang/Turing.jl
that referenced
this pull request
Jan 28, 2026
Closes #2639 Quoting from the changelog: > Avoid reevaluating the model on MCMC iterations where the transition is not saved to the chain (e.g. in initial burn-in, or when using thinning). > Also avoid each component sampler of Gibbs unnecessarily evaluating the model once per iteration. This makes use of the `discard_sample` keyword argument to `step` / `step_warmup` TuringLang/AbstractMCMC.jl#194 Note that this is still type stable as the value of the `discard_sample` kwarg can be constant propagated (I've checked this with code_warntype etc).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR:
Fixes Num_warmup / discard_initial / thinning error (?!) #196.
Fixes Pass information through to
step/step_warmupabout whether a step will be discarded #185.Abstracts
step_warmupandstepinto a single function, so that this pattern doesn't have to be repeated a few times inside sample().