Skip to main content

hooked_mutate_trace

Function hooked_mutate_trace 

Source
pub fn hooked_mutate_trace<G, S, H, R>(
    genome: &G,
    selector: &S,
    mutation_fn: impl Fn(&Address, &ChoiceValue, &mut R) -> ChoiceValue,
    hook: &H,
    generation: usize,
    rng: &mut R,
) -> Result<G, GenomeError>
Expand description

Hooked mutation operator that integrates with operation hooks.

The produced child trace only rearranges/mutates values. It carries no fabricated per-choice log-probabilities: resampled sites are written with a neutral logp of 0.0 (rather than the stale log-prob of the pre-mutation value), and the trace’s log_prior/log_likelihood/log_factors accumulators are left at zero. To obtain the child’s probability mass under the Boltzmann posterior, score it with TraceScoringHandler or crate::inference::model::EvolutionModel::to_weighted_trace.