Skip to content

Conversation

@penelopeysm
Copy link
Member

@penelopeysm penelopeysm commented Oct 24, 2025

In general there are two things that samplers return per iteration: parameter values, and sampler statistics.

getparams was added previously to cover the first one, but there's no interface function for the second.

Currently, for Turing's external sampler interface, external samplers are expected to implement Turing.Inference.getparams and Turing.Inference.getstats

This is a mistake, because external samplers shouldn't need to depend on Turing, they should only depend on AbstractMCMC and LogDensityProblems (because they only need to take an AbstractMCMC.LogDensityModel and call LogDensityProblems.logdensity on its wrapped model). I'm now trying to unravel this, hence the need for this function.

In the same vein, this PR also moves requires_unconstrained_space from Turing to here. I'm less certain about this. Please see Slack for discussion. But I think that whether a sampler requires unconstrained space or not is a property of the sampler (and thus belongs in the package that defines AbstractSampler), not a property of how it interacts with Turing.

@github-actions
Copy link
Contributor

AbstractMCMC.jl documentation for PR #182 is available at:
https://TuringLang.github.io/AbstractMCMC.jl/previews/PR182/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant