pub struct EvolutionChain<P, L>{ /* private fields */ }Expand description
An MH chain over the fixed-β Boltzmann target π_β ∝ p(x)·exp(β·f(x)).
Implementations§
Source§impl<P, L> EvolutionChain<P, L>
impl<P, L> EvolutionChain<P, L>
Sourcepub fn new(model: EvolutionModel<P, L>) -> Self
pub fn new(model: EvolutionModel<P, L>) -> Self
Create a chain over the model’s fixed-β target.
Sourcepub fn target_rate(self, rate: f64) -> Self
pub fn target_rate(self, rate: f64) -> Self
Set the adaptation’s target acceptance rate (default 0.44).
Sourcepub fn override_site(self, addr: Address, proposal: SiteProposal) -> Self
pub fn override_site(self, addr: Address, proposal: SiteProposal) -> Self
Force a specific f64 proposal for one address (e.g.
SiteProposal::Reflect { lower, upper } for a bounded coordinate).
Sourcepub fn model(&self) -> &EvolutionModel<P, L>
pub fn model(&self) -> &EvolutionModel<P, L>
The underlying model.
Sourcepub fn init<R: Rng>(&self, rng: &mut R) -> Trace
pub fn init<R: Rng>(&self, rng: &mut R) -> Trace
Draw an initial state: a prior sample’s fully-scored trace.
Sourcepub fn init_from(&self, genome: &P::Genome) -> Option<Trace>
pub fn init_from(&self, genome: &P::Genome) -> Option<Trace>
Warm-start the chain from a given genome: encode it under the model’s
prior (GenomePrior::trace_of) and score it through the target
program. Works for any prior — including grammar priors over trees —
so a classic GA/GP result can seed an inference chain. Returns None
if the genome is outside the prior’s support (its target density is
−∞, which can never be left by an MH chain).
Auto Trait Implementations§
impl<P, L> Freeze for EvolutionChain<P, L>
impl<P, L> RefUnwindSafe for EvolutionChain<P, L>where
P: RefUnwindSafe,
L: RefUnwindSafe,
impl<P, L> Send for EvolutionChain<P, L>
impl<P, L> Sync for EvolutionChain<P, L>
impl<P, L> Unpin for EvolutionChain<P, L>
impl<P, L> UnsafeUnpin for EvolutionChain<P, L>where
P: UnsafeUnpin,
L: UnsafeUnpin,
impl<P, L> UnwindSafe for EvolutionChain<P, L>where
P: UnwindSafe,
L: 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> 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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.