jexplore.steps.de#

This module define the class for a MH step based on Differential evolution proposal.

Classes#

DEStep

Class implementing a Differential evolution step

Module Contents#

class DEStep[Tepoch: jexplore.sampling.EpochMH, Tstate: jexplore.sampling.StateMH, Tsampling: jexplore.sampling.SamplingMH](gamma=2.38, ngroups=2, permute=False)[source]#

Bases: jexplore.steps.colored.ColoredSC[Tepoch, Tstate, Tsampling]

Class implementing a Differential evolution step

Parameters:
  • gamma (float) – \(\gamma\) scale parameter

  • ngroups (int) – number of groups. Default 2.

  • permute (bool) – if true walkers are permuted at each iteration.

gamma: float#

DE proposal \(\gamma\) parameter

sigma: jax.Array#

gamma distribution \(\sigma = \frac{\gamma}{2\sqrt{D}}\)

npart: int = 2#

number of partners needed to build the proposal

build(epoch)[source]#

Step initialisation method. It extends jexplore.steps.colored.Colored.build by simply adding the computation of the \(\sigma\) of the \(\gamma\) distribution.

Parameters:

epoch (Tepoch) – current epoch.

Return type:

None

sample_gamma(key, state)[source]#

Sample \(\gamma\) from normal distribution

Parameters:
  • key (jax.Array) – PRNG key

  • size – output size

  • state (Tstate)

Returns:

samples

Return type:

jax.Array

proposal(key, state, group, cgroup)[source]#

Propose a new state according to the DE proposal algorithm.

Parameters:
  • key (jax.Array) – PRNG key

  • state (Tstate) – current state

  • group (jax.Array)

  • cgroup (jax.Array)

Returns:

new state and the boolean mask of the chains modified by the step.

Return type:

tuple[jax.Array, Tstate, jax.Array]