Skip to content

Model

class Model < Object

Base class for all models. Subclasses typically override at least the simulate member fiber to encode the joint distribution of the model. This fiber yields incrementa log weights each time a checkpoint is encountered. In many cases these checkpoints are implied by the use of the ~ operator, but they may also be denoted explicitly with yield statements.

Member Functions

Name Description
checkpoints Get the natural number of checkpoints for this model as configured, if this can be known in advance.

Member Fibers

Name Description
simulate Simulate the state of the model, yielding log-weights.
propose Propose a state of the model.
propose Propose a state of the model depending on a previous state.

Member Function Details

checkpoints

function checkpoints() -> Integer?

Get the natural number of checkpoints for this model as configured, if this can be known in advance.

Member Fiber Details

propose

fiber propose() -> Real

Propose a state of the model.

Yields: a log-weight each time a checkpoint is encountered.

By default calls simulate().

fiber propose(m:Model) -> Real

Propose a state of the model depending on a previous state.

  • m: The previous state.

Yields: a log-weight each time a checkpoint is encountered.

By default calls propose().

simulate

fiber simulate() -> Real

Simulate the state of the model, yielding log-weights.

Yields: a log-weight each time a checkpoint is encountered.