Skip to content

Pass stats through to Gibbs#2770

Draft
penelopeysm wants to merge 1 commit intomainfrom
py/gibbs-with-stats
Draft

Pass stats through to Gibbs#2770
penelopeysm wants to merge 1 commit intomainfrom
py/gibbs-with-stats

Conversation

@penelopeysm
Copy link
Member

@penelopeysm penelopeysm commented Feb 9, 2026

This closes #2766 but at the cost of increasing model evaluations (it just undoes #2759), so this is not really a correct fix.

Each component sampler's stats is prefixed with splN where N = 1... is the order of the sampler in the Gibbs constructor.

The problem is that

  • AbstractMCMC.step for each component sampler returns a tuple of (transition, state)
  • The transition contains both parameters and stats
  • The parameters often (but don't always) require model reevaluation
  • Gibbs doesn't need the parameters, but needs the stats
  • However you can't get only the stats without the parameters.

So if you want to extract the sampler statistics from AbstractMCMC.step, you often need to reevaluate the model.

The correct solution is to get rid of transitions (TuringLang/AbstractMCMC.jl#149), and put the stats into the state as well. In general, the state should be an object which doesn't reevaluate the model, but contains enough information to allow a downstream user to reevaluate the model if they actually need the parameters. In essence the state should be a lazy version of what's now (transition, state).

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.

Stats from component samplers are lost with Gibbs

1 participant