Probabilistic programming API
Abstract model functions
AbstractPPL.AbstractProbabilisticProgram — Type
AbstractProbabilisticProgramCommon base type for models expressed as probabilistic programs.
AbstractPPL.condition — Function
condition(model, observations)Condition the generative model model on some observed data, creating a new model of the (possibly unnormalized) posterior distribution over them.
observations can be of any supported internal trace type, or a fixed probability expression.
The invariant
m = decondition(condition(m, obs))should hold for generative models m and arbitrary obs.
AbstractPPL.decondition — Function
decondition(conditioned_model)Remove the conditioning (i.e., observation data) from conditioned_model, turning it into a generative model over prior and observed variables.
The invariant
m == condition(decondition(m), obs)should hold for models m with conditioned variables obs.
AbstractPPL.fix — Function
fix(model, params)Fix the values of parameters specified in params within the probabilistic model model. This operation is equivalent to treating the fixed parameters as being drawn from a point mass distribution centered at the values specified in params. Thus these parameters no longer contribute to the accumulated log density.
Conceptually, this is similar to Pearl's do-operator in causal inference, where we intervene on variables by setting them to specific values, effectively cutting off their dependencies on their usual causes in the model.
The invariant
m == unfix(fix(m, params))should hold for any model m and parameters params.
AbstractPPL.unfix — Function
unfix(model)Remove any fixed parameters from the model model, returning a new model without the fixed parameters.
This function reverses the effect of fix by removing parameter constraints that were previously set. It returns a new model where all previously fixed parameters are allowed to vary according to their original distributions in the model.
The invariant
m == unfix(fix(m, params))should hold for any model m and parameters params.
DensityInterface.logdensityof — Function
logdensityof(model, trace)Evaluate the (possibly unnormalized) density of the model specified by the probabilistic program in model, at specific values for the random variables given through trace.
trace can be of any supported internal trace type, or a fixed probability expression.
logdensityof should interact with conditioning and deconditioning in the way required by probability theory.
AbstractPPL.AbstractContext — Type
AbstractContextCommon base type for evaluation contexts.
AbstractPPL.evaluate!! — Function
evaluate!!
General API for model operations, e.g. prior evaluation, log density, log joint etc.
Abstract traces
AbstractPPL.AbstractModelTrace — Type
AbstractModelTraceCommon base class for various trace or "variable info" types.