Samplers#

This submodule contains functions for MCMC and forward sampling.

sample([draws, step, init, n_init, ...])

Draw samples from the posterior using the given step methods.

sample_prior_predictive([samples, model, ...])

Generate samples from the prior predictive distribution.

sample_posterior_predictive(trace[, ...])

Generate posterior predictive samples from a model given a trace.

sample_posterior_predictive_w(traces[, ...])

Generate weighted posterior predictive samples from a list of models and a list of traces according to a set of weights.

sampling_jax.sample_blackjax_nuts([draws, ...])

Draw samples from the posterior using the NUTS method from the blackjax library.

sampling_jax.sample_numpyro_nuts([draws, ...])

Draw samples from the posterior using the NUTS method from the numpyro library.

iter_sample(draws, step, start[, trace, ...])

Generate a trace on each iteration using the given step method.

init_nuts(*[, init, chains, n_init, model, ...])

Set up the mass matrix initialization for NUTS.

draw(vars[, draws, random_seed])

Draw samples for one variable or a list of variables

Step methods#

HMC family#

NUTS(*args, **kwargs)

A sampler for continuous variables based on Hamiltonian mechanics.

HamiltonianMC(*args, **kwargs)

A sampler for continuous variables based on Hamiltonian mechanics.

Metropolis family#

BinaryGibbsMetropolis(*args, **kwargs)

A Metropolis-within-Gibbs step method optimized for binary variables

BinaryMetropolis(*args, **kwargs)

Metropolis-Hastings optimized for binary variables

CategoricalGibbsMetropolis(*args, **kwargs)

A Metropolis-within-Gibbs step method optimized for categorical variables.

CauchyProposal(s)

DEMetropolis(*args, **kwargs)

Differential Evolution Metropolis sampling step.

DEMetropolisZ(*args, **kwargs)

Adaptive Differential Evolution Metropolis sampling step that uses the past to inform jumps.

LaplaceProposal(s)

Metropolis(*args, **kwargs)

Metropolis-Hastings sampling step

MultivariateNormalProposal(s)

NormalProposal(s)

PoissonProposal(s)

UniformProposal(s)

Other step methods#

CompoundStep(methods)

Step method composed of a list of several other step methods applied in sequence.

Slice(*args, **kwargs)

Univariate slice sampler step method