pymc.step_methods.BinaryMetropolis#
- class pymc.step_methods.BinaryMetropolis(*args, **kwargs)[source]#
Metropolis-Hastings optimized for binary variables.
Unlike BinaryGibbsMetropolis, this step sampler proposes an update for all variable dimensions at once.
This will perform a single logp evaluation per step, at the expense of a lower acceptance rate when the posteriors of the binary variables are highly correlated.
The BinaryGibbsMetropolis (not this one) is the default step sampler for binary variables
- Parameters:
- vars: list
List of value variables for sampler
- scaling: scalar or array
Initial scale factor for proposal. Defaults to 1.
- tune: bool
Flag for tuning. Defaults to True.
- tune_interval: int
The frequency of tuning. Defaults to 100 iterations.
- 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 topymc.util.get_random_generator()
for more information.
Methods
BinaryMetropolis.__init__
(vars, *[, ...])BinaryMetropolis.astep
(apoint, *args)Perform a single sample step in a raveled and concatenated parameter space.
BinaryMetropolis is only suitable for binary (bool) and Categorical variables with k=1.
BinaryMetropolis.step
(point)Perform a single step of the sampler.
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.