Repository navigation
Add SamplingOutput for samples and chain metadata - #218
Merged
Merged
Conversation
Assisted-by: Codex <codex@openai.com>
Contributor
|
AbstractMCMC.jl documentation for PR #218 is available at: |
Assisted-by: Codex <codex@openai.com>
Preserve the raw-sample fallback for other chain types. Conversion from `SamplingOutput` remains available explicitly after sampling. Assisted-by: Codex <codex@openai.com>
yebai
force-pushed
the
samplingoutput
branch
from
September 20, 2026 18:30
e03106a to
b482dd0
Compare
Reuse sample conversion while retaining sampling metadata. Document explicit conversion and direct bundling as chain construction options. Assisted-by: Codex <codex@openai.com>
yebai
added a commit
to TuringLang/DynamicPPL.jl
that referenced
this pull request
Sep 21, 2026
This PR adds support for [`SamplingOutput`](TuringLang/AbstractMCMC.jl#218): model `returned`, `predict`, and `pointwise log densities`, plus conversion to `MCMCChains.Chains`. It also fixes a few minor issues in `MCMCChains` (see code). ```julia @model demo(y) = (x ~ Normal(); y ~ Normal(x)) chain = AbstractMCMC.SamplingOutput(fill(VarNamedTuple(; x=0.5), 10, 1)) values = returned(demo(1.0), chain) densities = pointwise_logdensities(demo(1.0), chain) likelihoods = pointwise_loglikelihoods(demo(1.0), chain) priors = pointwise_prior_logdensities(demo(1.0), chain) predictions = predict(demo(missing), chain) mcmcchain = convert(MCMCChains.Chains, predictions) ```
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.
Add
SamplingOutputfor draws and sampling metadata. Chain packages can define conversions to their own formats, as illustrated below for MCMCChains and FlexiChains.Chain conversion:
These example conversions preserve draws and iteration indices. Timing and saved states remain in
chain; the matrix round trip retains draws only.