Skip to main content

GenomePrior

Trait GenomePrior 

Source
pub trait GenomePrior:
    Clone
    + Send
    + Sync
    + 'static {
    type Genome: TraceGenome;

    // Required method
    fn model(&self) -> Model<Self::Genome>;

    // Provided method
    fn trace_of(&self, genome: &Self::Genome) -> Trace { ... }
}
Expand description

A prior distribution over genomes, expressed as a probabilistic program.

The program must sample the genome’s canonical trace sites (the same addresses TraceGenome::to_trace writes — gene#i, bit#i, perm#i, …) and return the assembled genome. Anything expressible as a fugue Model is a valid prior: correlated coordinates, hierarchical scales, variable-length genomes (a length site followed by that many coordinate sites — fugue’s MH treats the resulting births/deaths as reversible-jump moves with no extra code here).

Required Associated Types§

Source

type Genome: TraceGenome

The genome type this prior generates.

Required Methods§

Source

fn model(&self) -> Model<Self::Genome>

The generative program p(x).

Provided Methods§

Source

fn trace_of(&self, genome: &Self::Genome) -> Trace

Encode a genome as a trace under this prior’s address scheme — the inverse direction of running Self::model. The default delegates to the genome’s canonical TraceGenome::to_trace encoding, which is correct whenever the prior samples exactly the canonical sites (all the vector priors here). Priors with their own generative scheme — e.g. ArithmeticGrammarPrior’s tree-path grammar — override this so that scoring, weighted traces, and chain warm-starts work for any genome the prior can express.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§