jexplore.steps.direct#
This module defines single chain Metropolis-Hastings steps with direct proposals: i.e. proposals proposing points by sampling a given distribution.
Classes#
Module Contents#
- class Direct(dist, mask=None, **opts)[source]#
Bases:
jexplore.steps.mh.AllChainsClass implementing all chain metropoling hasting step with a proposal directly proposing points sampling from a distribution
- Parameters:
dist (Type[jexplore.tools.distributions.Distr]) – distribution.
**opts – options to be passed to the distribution creator.
mask (jax.Array | None)
- dist: Type[jexplore.tools.distributions.Distr]#
distribution class
- opts: dict#
distribution creator options
- epoch_dist: jexplore.tools.distributions.Distr#
distribution instance for the epoch
- build(epoch)[source]#
Step epoch initialisation method. This extends method
jexplore.steps.step.Step.buildby instantiating the ditribution object for this epoch.epoch and sampling attributes. :param epoch: current epoch.
- Parameters:
epoch (jexplore.sampling.EpochMH)
- Return type:
None
- proposal(key, state)[source]#
Propose a point by sampling this class distribution.
- Parameters:
key (jax.Array) – PRNG key
state (jexplore.sampling.StateMH) – current state
- Returns:
new state and the boolean mask of the chains modified by the step.
- Return type:
tuple[jax.Array, jexplore.sampling.StateMH, jax.Array]
- class Uniform(mask=None, minval=0.0, maxval=1.0)[source]#
Bases:
DirectSampling from a uniform distribution in a box.
- Parameters:
mask (jax.Array | None) – proposal dimensions mask (default all space)
minval (jax.Array | float) – minimum (inclusive) value broadcast-compatible with shape for the range (default 0).
maxval (jax.Array | float) – maximum (exclusive) value broadcast-compatible with shape for the range (default 1).