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#

Direct

Class implementing all chain metropoling hasting step

Uniform

Sampling from a uniform distribution in a box.

Gaussian

Sampling from a Gaussian distribution (to be completed).

Module Contents#

class Direct(dist, mask=None, **opts)[source]#

Bases: jexplore.steps.mh.AllChains

Class implementing all chain metropoling hasting step with a proposal directly proposing points sampling from a distribution

Parameters:
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.build by 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:
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: Direct

Sampling 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).

class Gaussian(mask=None)[source]#

Bases: Direct

Sampling from a Gaussian distribution (to be completed).

Parameters:

mask (jax.Array | None) – proposal dimensions mask (default all space)