LieselInterface

Contents

LieselInterface#

class liesel.goose.LieselInterface(model)[source]#

Bases: object

A ModelInterface for a Liesel Model.

Parameters:

model (Model) – A Liesel Model.

See also

GraphBuilder

The graph builder class, used to set up a Model.

See also

DictInterface

A model interface for a model state represented by a dict[str, Array] and a corresponding log-probability function.

DataclassInterface

A model interface for a model state represented by a dataclass and a corresponding log-probability function.

LieselInterface

A model interface for a Liesel Model.

Examples

First, we initialize a Liesel model. This is a minimal example only for the purpose of demonstrating how to use the interface.

>>> y = lsl.obs(jnp.array([1.0, 2.0, 3.0]), name="y")
>>> model = lsl.GraphBuilder().add(y).build_model()

The interface is initialized by passing the model to the constructor.

>>> interface = gs.LieselInterface(model)

The interface instance can now be used in set_model().

Methods

extract_position(position_keys, model_state)

Extracts a position from a model state.

log_prob(model_state)

Returns the log-probability from a model state.

update_state(position, model_state)

Updates and returns a model state given a position.