DreamMCMC¶
- class pints.DreamMCMC(chains, x0, sigma0=None)[source]¶
Uses differential evolution adaptive Metropolis (DREAM) MCMC as described in [1] to perform posterior sampling from the posterior.
In each step of the algorithm N chains are evolved using the following steps:
Select proposal:
x_proposed = x[i,r] + (1 + e) * gamma(delta, d, p_g) * sum_j=1^delta (X[i,r1[j]] - x[i,r2[j]]) + epsilon
where [r1[j], r2[j]] are random chain indices chosen (without replacement) from the
N
available chains, which must not equal each other ori
, wherei
indicates the current time step;delta ~ uniform_discrete(1,D)
determines the number of terms to include in the summation:e ~ U(-b*, b*) in d dimensions; gamma(delta, d, p_g) = if p_g < u1 ~ U(0,1): 2.38 / sqrt(2 * delta * d) else: 1
epsilon ~ N(0,b)
ind
dimensions (whered
is the dimensionality of the parameter vector).2. Modify random subsets of the proposal according to a crossover probability CR:
for j in 1:N: if 1 - CR > u2 ~ U(0,1): x_proposed[j] = x[j] else: x_proposed[j] = x_proposed[j] from 1
If
x_proposed / x[i,r] > u ~ U(0,1)
, thenx[i+1,r] = x_proposed
; otherwise,x[i+1,r] = x[i]
.Here b > 0, b* > 0, 1 >= p_g >= 0, 1 >= CR >= 0.
Extends
MultiChainMCMC
.References
- CR()[source]¶
Returns the probability of crossover occurring if constant crossover mode is enabled (see
set_CR()
).
- b_star()[source]¶
Returns b*, which determines the weight given to other chains’ positions in determining new positions (see
set_b_star()
).
- current_log_pdfs()¶
Returns the log pdf values of the current points (i.e. of the most recent points returned by
tell()
).
- delta_max()[source]¶
Returns the maximum number of other chains’ positions to use to determine the next sampler position (see
set_delta_max()
).
- nCR()[source]¶
Returns the size of the discrete crossover probability distribution (only used if constant crossover mode is disabled), see
set_nCR()
.
- needs_sensitivities()¶
Returns
True
if this methods needs sensitivities to be passed in totell
along with the evaluated logpdf.
- set_CR(CR)[source]¶
Sets the probability of crossover occurring if constant crossover mode is enabled. CR is a probability and so must be in the range
[0, 1]
.
- set_b(b)[source]¶
Sets the Gaussian scale coefficient used in updating the position of each chain (must be non-negative).
- set_b_star(b_star)[source]¶
Sets b*, which determines the weight given to other chains’ positions in determining new positions (must be non-negative).
- set_delta_max(delta_max)[source]¶
Sets the maximum number of other chains’ positions to use to determine the next sampler position.
delta_max
must be in the range[1, nchains - 2]
.
- set_hyper_parameters(x)[source]¶
The hyper-parameter vector is
[b, b_star, p_g, delta_max, initial_phase, constant_crossover, CR, nCR]
.
- set_nCR(nCR)[source]¶
Sets the size of the discrete crossover probability distribution (only used if constant crossover mode is disabled).
nCR
must be greater than or equal to 2.
- set_p_g(p_g)[source]¶
Sets
p_g
which is the probability of choosing a highergamma
versus regular (a highergamma
means that other chains are given more weight).p_g
must be in the range [0, 1].