jexplore.steps.colored_alt#
This module defines an alternate version of
jexplore.steps.colored.ColoredSC and of its child classes
jexplore.steps.stretch.Stretch and jexplore.steps.de.DEStep.
The main difference is that the proposed partners for each chain are distinct.
Classes#
Class implementing a MH steps based on stretch proposal |
|
Class implementing a MH steps based on stretch proposal. This is an |
|
Class implementing a Differential evolution step. This is an |
Module Contents#
- class ColoredAlt[Tepoch: jexplore.sampling.EpochMH, Tstate: jexplore.sampling.StateMH, Tsampling: jexplore.sampling.SamplingMH](ngroups=2, permute=False, duplicate=False, adjust=False)[source]#
Bases:
jexplore.steps.colored.ColoredSC[Tepoch,Tstate,Tsampling]Class implementing a MH steps based on stretch proposal
- Parameters:
a – stretch proposal a parameter
ngroups (int) – number of groups. Default 2.
permute (bool) – if true walkers are permuted at each iteration.
duplicate (bool)
adjust (bool)
- get_partners(key, state, group, cgroup)[source]#
Method for getting partners samples fore each chain of a group. This alternate implementation gets the first self.npart * group.size // ntemps chains out of the cgroup chains for each temperatures, after permuting them and uses them as partners of the group chains of the same temperature. With respect to the base implementation of this method, this one always returns distinct partners for each group. For this reason ngroups must be larger than self.npart + 1 (this has to be implemented by the children classes).
- Parameters:
key (jax.Array) – PRNG key
state (Tstate) – current state
group (jax.Array) – group chains
cgroup (jax.Array) – complementary group chains
- Returns:
the parners as an array with shape (self.npars, group.size, dim)
- Return type:
jax.Array
- abstract proposal(key, state, group, cgroup)[source]#
Proposal restricted to chains of one color. This is just a prototype.
- Parameters:
key (jax.Array) – PRNG key
state (Tstate) – current state
group (jax.Array) – current color group
cgroup (jax.Array) – complementary chains for each chain in the group.
- Returns:
PNRG key, proposed state, transition probability for each chain.
- Return type:
tuple[jax.Array, Tstate, jax.Array]
- class StretchAlt[Tepoch: jexplore.sampling.EpochMH, Tstate: jexplore.sampling.StateMH, Tsampling: jexplore.sampling.SamplingMH](a=2.0, ngroups=2, permute=False)[source]#
Bases:
jexplore.steps.stretch.Stretch[Tepoch,Tstate,Tsampling]Class implementing a MH steps based on stretch proposal. This is an alternate version inwhich each chain of a color group receives a distinct partner from the complementary group chains.
- Parameters:
a (float) – stretch proposal a parameter
ngroups (int) – number of groups. Default 2.
permute (bool) – if true walkers are permuted at each iteration.
- get_partners#
Method for getting partners samples fore each chain of a group. This implementation simply draws randomly one partner for each chain in the group among those in the chains of complementary group with the same temperature.
- Parameters:
key – PRNG key
state – current state
group – group chains
cgroup – complementary group chains
- Returns:
the parners as an array with shape (self.npars, group.size, dim)
- class DEStepAlt[Tepoch: jexplore.sampling.EpochMH, Tstate: jexplore.sampling.StateMH, Tsampling: jexplore.sampling.SamplingMH](gamma=2.38, ngroups=3, permute=False)[source]#
Bases:
jexplore.steps.de.DEStep[Tepoch,Tstate,Tsampling]Class implementing a Differential evolution step. This is an alternate version inwhich each chain of a color group receives a distinct couple of partner from the complementary group chains.
- Parameters:
gamma (float) – \(\gamma\) scale parameter
ngroups (int) – number of groups. Default 2.
permute (bool) – if true walkers are permuted at each iteration.
- get_partners#
Method for getting partners samples fore each chain of a group. This implementation simply draws randomly one partner for each chain in the group among those in the chains of complementary group with the same temperature.
- Parameters:
key – PRNG key
state – current state
group – group chains
cgroup – complementary group chains
- Returns:
the parners as an array with shape (self.npars, group.size, dim)