Dram ACMC¶
-
class
pints.
DramACMC
(x0, sigma0=None)[source]¶ DRAM (Delayed Rejection Adaptive Covariance) MCMC, as described in [1].
In this method, rejections do not necessarily lead an iteration to end. Instead, if a rejection occurs, another point is proposed although typically from a narrower (i.e. more conservative) proposal kernel than was used for the first proposal.
In this approach, in each iteration, the following steps return the next state of the Markov chain (assuming the current state is
theta_0
and that there are 2 proposal kernels):theta_1 ~ N(theta_0, lambda * scale_1 * sigma) alpha_1(theta_0, theta_1) = min(1, p(theta_1|X) / p(theta_0|X)) u_1 ~ uniform(0, 1) if alpha_1(theta_0, theta_1) > u_1: return theta_1 theta_2 ~ N(theta_0, lambda * scale_2 * sigma0) alpha_2(theta_0, theta_1, theta_2) = min(1, p(theta_2|X) (1 - alpha_1(theta_2, theta_1)) / (p(theta_0|X) (1 - alpha_1(theta_0, theta_1)))) u_2 ~ uniform(0, 1) if alpha_2(theta_0, theta_1, theta_2) > u_2: return theta_2 else: return theta_0
Our implementation also allows more than 2 proposal kernels to be used. This means that
k
accept-reject steps are taken. In each step (i
), the probability that a proposaltheta_i
is accepted is:alpha_i(theta_0, theta_1, ..., theta_i) = min(1, p(theta_i|X) / p(theta_0|X) * n_i / d_i)
where:
n_i = (1 - alpha_1(theta_i, theta_i-1)) * (1 - alpha_2(theta_i, theta_i-1, theta_i-2)) * ... (1 - alpha_i-1(theta_i, theta_i-1, ..., theta_0)) d_i = (1 - alpha_1(theta_0, theta_1)) * (1 - alpha_2(theta_0, theta_1, theta_2)) * ... (1 - alpha_i-1(theta_0, theta_1, ..., theta_i-1))
If
k
proposals have been rejected, the initial pointtheta_0
is returned.At the end of each iterations, a ‘base’ proposal kernel is adapted:
mu = (1 - gamma) mu + gamma theta sigma = (1 - gamma) sigma + gamma (theta - mu)(theta - mu)^t log_lambda = log_lambda + gamma (accepted - target_acceptance_rate)
where
gamma = adaptations^-eta
,theta
is the current state of the Markov chain andaccepted
is a binary indicator for whether any of the series of proposals were accepted. The kernels for the all proposals are then adapted as[scale_1, scale_2, ..., scale_k] * sigma
, where the scale factors are set usingset_sigma_scale
.Extends:
GlobalAdaptiveCovarianceMC
References
[1] (1, 2) “DRAM: Efficient adaptive MCMC”. H Haario, M Laine, A Mira, E Saksman, (2006) Statistical Computing https://doi.org/10.1007/s11222-006-9438-0 -
acceptance_rate
()¶ Returns the current (measured) acceptance rate.
-
ask
()¶
-
eta
()¶ Returns
eta
which controls the rate of adaptation decayadaptations**(-eta)
, whereeta > 0
to ensure asymptotic ergodicity.
-
in_initial_phase
()¶
-
needs_initial_phase
()¶
-
needs_sensitivities
()¶ Returns
True
if this methods needs sensitivities to be passed in totell
along with the evaluated logpdf.
-
replace
(current, current_log_pdf, proposed=None)¶
-
set_eta
(eta)¶ Updates
eta
which controls the rate of adaptation decayadaptations**(-eta)
, whereeta > 0
to ensure asymptotic ergodicity.
-
set_initial_phase
(initial_phase)¶
-
set_sigma_scale
()[source]¶ Set the scale of initial covariance matrix multipliers for each of the kernels:
[0,...,upper]
where the gradations are uniform on the log10 scale meaning the proposal covariance matrices are:[10^upper,..., 1] * sigma
.
-
set_target_acceptance_rate
(rate=0.234)¶ Sets the target acceptance rate.
-
set_upper_scale
(upper_scale)[source]¶ Set the upper scale of initial covariance matrix multipliers for each of the kernels:
[0,...,upper]
where the gradations are uniform on the log10 scale meaning the proposal covariance matrices are:[10^upper,..., 1] * sigma
.
-
sigma_scale
()[source]¶ Returns scale factors used to multiply a base covariance matrix, resulting in proposal matrices for each accept-reject step.
-
target_acceptance_rate
()¶ Returns the target acceptance rate.
-
tell
(fx)[source]¶ If first proposal, then accept with ordinary Metropolis probability; if a later proposal, use probability determined by [1].
-
upper_scale
()[source]¶ Returns upper scale limit (see
pints.DramACMC.set_upper_scale()
).
-