liesel.goose

liesel.goose#

Goose MCMC framework.

Functions

history_to_df(history)

Turns a OptimResult.history dictionary into a pandas.DataFrame.

plot_cor(results[, params, param_indices, ...])

Visualizes autocorrelations of posterior samples.

plot_density(results[, params, ...])

Visualizes posterior distributions with a density plot.

plot_param(results, param[, param_index, ...])

Visualizes trace plot, density plot and autocorrelation plot of a single subparameter.

plot_trace(results[, params, param_indices, ...])

Visualizes posterior samples over time with a trace plot.

plot_scatter(results, params, param_indices)

Produces a scatterplot of two parameters.

plot_pairs(results[, params, param_indices, ...])

Produces a pairplot panel.

stan_epochs([warmup_duration, ...])

Sets up a list of EpochConfig's.

optim_flat(model_train, params[, optimizer, ...])

Optimize the parameters of a Liesel Model.

Classes

DictInterface(log_prob_fn)

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

DataclassInterface(log_prob_fn)

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

LieselInterface(model)

A ModelInterface for a Liesel Model.

Engine(seeds, model_states, kernel_sequence, ...)

MCMC engine capable of combining multiple transition kernels.

EngineBuilder(seed, num_chains)

The EngineBuilder is used to construct an MCMC Engine.

MCMCSpec(kernel[, kernel_kwargs, ...])

Specification for the MCMC kernel and optional jitter distribution associated with a model variable.

LieselMCMC(model[, which])

Manages the setup of MCMC specifications for a Liesel model.

EpochConfig(type, duration, thinning, optional)

Defines an Epoch in an MCMC algorithm.

EpochType(*values)

Indicates which MCMC phase the epoch is part of.

GibbsKernel(position_keys, transition_fn[, ...])

A Gibbs kernel implementing the Kernel protocol.

HMCKernel(position_keys[, ...])

A HMC kernel with dual averaging and an inverse mass matrix tuner, implementing the Kernel protocol.

IWLSKernel(position_keys[, chol_info_fn, ...])

An IWLS kernel with dual averaging and an (optional) user-defined function for computing the Cholesky decomposition of the Fisher information matrix, implementing the liesel.goose.types.Kernel protocol.

MHKernel(position_keys, proposal_fn[, ...])

A Metropolis-Hastings kernel implementing the Kernel protocol.

MHProposal(position, log_correction)

ModelInterface(*args, **kwargs)

Defines a standardized way for Goose to communicate with a statistical model.

NamedTupleInterface(log_prob_fn)

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

NUTSKernel(position_keys[, ...])

A NUTS kernel with dual averaging and an inverse mass matrix tuner, implementing the Kernel protocol.

Stopper(max_iter, patience[, atol, rtol])

Handles (early) stopping for optim_flat().

RWKernel(position_keys[, initial_step_size, ...])

A random walk kernel.

Summary(results[, additional_chain, ...])

A summary object.

SamplesSummary(samples[, quantiles, ...])

A summary object based on a dictionary of samples.

SamplingResults(positions, transition_infos, ...)

Contains the results of the MCMC engine.

OptimResult(model_state, position, ...)

Holds the results of model optimization with optim_flat().