mod adapter¶
- module adapter¶
Stan-style windowed adaptation: trait Adapter<T, S>. trait Adapter<S>: Stan-style A2 windowed adaptation surface.
Stan’s
base_adapter.hppfactors adaptation state (step size, mass matrix, dual-averaging counters) out of the sampler. The adaptation is run in a windowed phase:adapt_diag_e_nuts.hppadvances the adapter on every transition during the warmup phase, then freezes the adapted state for the sampling phase.We model the same separation: a Sampler<T> runs unmodified; an Adapter<S> observes its (state, accepted) pairs each step and mutates itself (not the sampler) accordingly.
IdentityAdapterprovides the no-op implementation for drivers that do not adapt.Traits
- trait Adapter<T: Float, S: Sampler<T>>¶
Windowed adaptation interface.
observeis called by an adaptiverun_rsdriver after everySampler::stepduring the warmup phase. The adapter inspects(state, accepted, epoch)and updates its own internal counters.freeze()is called once at the end of warmup; subsequent samples use whatever the adapter has settled to without further mutation.Functions
- fn freeze(&mut self)¶
Marks adaptation complete. Called at the warmup -> sampling boundary.
- fn is_frozen(&self) -> bool¶
Returns true iff the adapter has settled. Optional – default
false(always observe until external freeze).
Structs and Unions
- struct IdentityAdapter¶
A no-op adapter: never updates anything. Used as the default in
run_rs(no warmup phase) and as the type-system witness that a non-adaptive sampler is identical to one wrapped inIdentityAdapter.Traits implemented
- impl<T: Float, S: Sampler<T>> Adapter<T, S> for IdentityAdapter¶