pymc.step_methods.BinaryGibbsMetropolis#

class pymc.step_methods.BinaryGibbsMetropolis(*args, **kwargs)[source]#

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

Unlike BinaryMetropolis, this step sampler proposes a variable dimension update at a time.

This will increase acceptance rate when the posteriors of the binary variables are highly correlated, at the expense of doing more logp evaluations per step.

This is the default step sampler for binary variables.

Parameters:
vars: list

List of value variables for sampler

order: list or ‘random’

List of integers indicating the Gibbs update order e.g., [0, 2, 1, …]. Default is random

transit_p: float

The diagonal of the transition kernel. A value > .5 gives anticorrelated proposals, which resulting in more efficient antithetical sampling. Default is 0.8

model: PyMC Model

Optional model for sampling step. Defaults to None (taken from context).

rng: RandomGenerator

An object that can produce be used to produce the step method’s Generator object. Refer to pymc.util.get_random_generator() for more information.

Methods

BinaryGibbsMetropolis.__init__(vars, *[, ...])

BinaryGibbsMetropolis.astep(apoint, *args)

Perform a single sample step in a raveled and concatenated parameter space.

BinaryGibbsMetropolis.competence(var)

BinaryMetropolis is only suitable for Bernoulli and Categorical variables with k=2.

BinaryGibbsMetropolis.reset_tuning()

BinaryGibbsMetropolis.set_rng(rng)

BinaryGibbsMetropolis.step(point)

Perform a single step of the sampler.

BinaryGibbsMetropolis.stop_tuning()

Attributes

name

sampling_state

stats_dtypes

A list containing <=1 dictionary that maps stat names to dtypes.

stats_dtypes_shapes

Maps stat names to dtypes and shapes.

vars

Variables that the step method is assigned to.