Skip to main content

Module mh

Module mh 

Source
Expand description

Metropolis–Hastings over the Boltzmann target, delegated to fugue

The old EvolutionStep hand-rolled its proposal (and only ever perturbed F64 choices, so BitString/Permutation chains silently never moved). This wrapper deletes all of that: one transition is one call into [fugue::adaptive_single_site_mh_cached], which picks the target site uniformly over all sites and dispatches the proposal by value type (for F64 from the site’s [fugue::Support]: Gaussian walk on the reals, log-space walk on the positives, reflected walk on a bounded interval; flip for Bool, reflected discrete walk for U64, prior-resample for Usize, integer walk for I64), including the reversible-jump corrections for structure-changing models. Per-address [SiteProposal] overrides registered with EvolutionChain::override_site are honoured by every entry point — EvolutionChain::step, EvolutionChain::step_scored and EvolutionChain::run_chain alike.

A transition costs one model execution (the proposal): the current state’s log-density and per-site densities are read from the scored trace the caller holds, which is why current must be a trace produced by EvolutionChain::init, EvolutionChain::init_from or a previous step (see EvolutionChain::step).

Structs§

EvolutionChain
An MH chain over the fixed-β Boltzmann target π_β ∝ p(x)·exp(β·f(x)).