PyMCInterface

Contents

PyMCInterface#

class liesel.experimental.pymc.PyMCInterface(model, additional_vars=())[source]#

Bases: object

An implementation of the Goose ModelInterface to be used with a PyMC model.

The initial position can be extracted with get_initial_state(). The model state is represented as a Position.

By default, only non-observed random variables are available via extract_position(). This includes transformed but not untransformed variables. Also, Deterministic’s are not available. To make them trackable for the Goose Engine, these variables must be mentioned in the constructor.

Parameters:
  • model (Model) – A PyMC model.

  • additional_vars (Sequence[str]) – Variables that should be available via extract_position() but are not by default. (default: ())

Methods

extract_position(position_keys, model_state)

Extracts a sub-position specified by position_keys from model_state.

get_initial_state()

Returns the model's initial state.

log_prob(model_state)

Computes the unnormalized log-probability given the model state.

update_state(position, model_state)

Updates the model state with the position returning the new model state.