pub struct EvolutionPosterior<G: TraceGenome> {
pub particles: Vec<Particle>,
pub log_evidence: f64,
/* private fields */
}Expand description
The result of a tempered-SMC evolution run: fugue particles (traces +
normalized weights) approximating the Boltzmann posterior π ∝ p·exp(f),
plus the log-evidence estimate.
Genomes are not cached on particles; they are recovered by decode-replay (replaying the particle’s trace through the prior/target program, whose return value is the decoded genome).
Fields§
§particles: Vec<Particle>Final weighted particle population (fugue particles).
log_evidence: f64Unbiased estimate of the log normalizing constant
log Σ_x p(x)·exp(f(x)) — the Bayesian model score.
Implementations§
Source§impl<G: TraceGenome> EvolutionPosterior<G>
impl<G: TraceGenome> EvolutionPosterior<G>
Sourcepub fn genome(&self, particle: &Particle, model_fn: &impl Fn() -> Model<G>) -> G
pub fn genome(&self, particle: &Particle, model_fn: &impl Fn() -> Model<G>) -> G
Recover the genome of one particle by replaying its trace.
Sourcepub fn genomes(&self, model_fn: &impl Fn() -> Model<G>) -> Vec<(G, f64)>
pub fn genomes(&self, model_fn: &impl Fn() -> Model<G>) -> Vec<(G, f64)>
Decode the whole population as (genome, normalized_weight) pairs.
Sourcepub fn weighted_mean(&self, coord: usize) -> f64
pub fn weighted_mean(&self, coord: usize) -> f64
Self-normalised weighted posterior mean of coordinate gene#coord.
Sourcepub fn weighted_variance(&self, coord: usize) -> f64
pub fn weighted_variance(&self, coord: usize) -> f64
Self-normalised weighted posterior variance of coordinate gene#coord.
Auto Trait Implementations§
impl<G> Freeze for EvolutionPosterior<G>
impl<G> RefUnwindSafe for EvolutionPosterior<G>where
G: RefUnwindSafe,
impl<G> Send for EvolutionPosterior<G>
impl<G> Sync for EvolutionPosterior<G>
impl<G> Unpin for EvolutionPosterior<G>where
G: Unpin,
impl<G> UnsafeUnpin for EvolutionPosterior<G>
impl<G> UnwindSafe for EvolutionPosterior<G>where
G: 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.