pub struct MclmcSettings<A: Debug + Copy + Default + Serialize> {Show 16 fields
pub step_size: f64,
pub momentum_decoherence_length: f64,
pub num_tune: u64,
pub num_draws: u64,
pub num_chains: usize,
pub seed: u64,
pub max_energy_error: f64,
pub store_unconstrained: bool,
pub store_gradient: bool,
pub store_transformed: bool,
pub store_divergences: bool,
pub adapt_options: A,
pub subsample_frequency: f64,
pub dynamic_step_size: bool,
pub trajectory_kind: MclmcTrajectoryKind,
pub trajectory_switch_fraction: f64,
}Expand description
Settings for the unadjusted Microcanonical Langevin Monte Carlo (MCLMC) sampler.
⚠️ Experimental — use with caution: The MCLMC sampler and all of its variants are highly experimental. They have not been thoroughly validated and may not return correct posteriors. The API, defaults, and adaptation behaviour are all subject to breaking changes at any time. Do not use these samplers in production or for results you rely on.
Step size ε and momentum decoherence length L are constants — no
adaptation of those is performed yet. The geometry is adapted during
warmup using the sampler-specific adaptation strategy, while the step size
remains fixed.
Use the type aliases DiagMclmcSettings, LowRankMclmcSettings, and
FlowMclmcSettings for concrete configurations.
Fields§
§step_size: f64Step size ε for the ESH leapfrog integrator.
momentum_decoherence_length: f64Momentum decoherence length L (controls partial momentum refresh rate).
Set to f64::INFINITY to disable momentum refresh entirely.
num_tune: u64Number of warmup draws.
num_draws: u64Number of sampling draws after warmup.
num_chains: usizeNumber of parallel chains.
seed: u64RNG seed.
max_energy_error: f64Maximum energy error before a step is flagged as a divergence.
store_unconstrained: boolStore each unconstrained parameter vector in the sampler stats.
store_gradient: boolStore the gradient in the sampler stats.
store_transformed: boolStore the transformed gradient and value in the sampler stats
store_divergences: boolStore detailed information about each divergence in the sampler stats
adapt_options: AGeometry adaptation options (step-size fields are ignored for Euclidean settings).
subsample_frequency: f64Number of leapfrog steps per draw as a fraction of L / ε.
The number of leapfrog steps between collector calls is:
round(subsample_frequency * L / ε).max(1)
1.0(default) — one sample per full trajectory (at the final step).0.0— every leapfrog step.- Values in between space samples as a fraction of the decoherence
length, so the interval scales naturally when
Lorεchanges.
dynamic_step_size: boolWhen true, use the tree-structured step size retry on divergence:
halve the step size factor and try 2 steps before doubling back.
log_weight will include log(step_size) to correct for the varying
sampling density. When false, divergences are recorded immediately
without any retry and log_weight = -energy_change.
trajectory_kind: MclmcTrajectoryKindSelects which leapfrog integrator and partial-momentum-refresh style
to use. See MclmcTrajectoryKind for the available options.
Default: MclmcTrajectoryKind::Microcanonical (original MCLMC).
trajectory_switch_fraction: f64Fraction of num_tune draws at which the trajectory is switched from
Euclidean to Microcanonical when
trajectory_kind == MclmcTrajectoryKind::EuclideanEarlyThenMicrocanonical.
Ignored for other trajectory kinds. Default: 0.3.
Trait Implementations§
Source§impl<A: Clone + Debug + Copy + Default + Serialize> Clone for MclmcSettings<A>
impl<A: Clone + Debug + Copy + Default + Serialize> Clone for MclmcSettings<A>
Source§fn clone(&self) -> MclmcSettings<A>
fn clone(&self) -> MclmcSettings<A>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de, A> Deserialize<'de> for MclmcSettings<A>
impl<'de, A> Deserialize<'de> for MclmcSettings<A>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<A> Serialize for MclmcSettings<A>
impl<A> Serialize for MclmcSettings<A>
impl<A: Copy + Debug + Copy + Default + Serialize> Copy for MclmcSettings<A>
Auto Trait Implementations§
impl<A> Freeze for MclmcSettings<A>where
A: Freeze,
impl<A> RefUnwindSafe for MclmcSettings<A>where
A: RefUnwindSafe,
impl<A> Send for MclmcSettings<A>where
A: Send,
impl<A> Sync for MclmcSettings<A>where
A: Sync,
impl<A> Unpin for MclmcSettings<A>where
A: Unpin,
impl<A> UnsafeUnpin for MclmcSettings<A>where
A: UnsafeUnpin,
impl<A> UnwindSafe for MclmcSettings<A>where
A: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more