Metropolis Random Walk MCMC¶
-
class
pints.
MetropolisRandomWalkMCMC
(x0, sigma0=None)[source]¶ Metropolis Random Walk MCMC, as described in [1].
Metropolis using multivariate Gaussian distribution as proposal step, also known as Metropolis Random Walk MCMC. In each iteration (t) of the algorithm, the following occurs:
propose x' ~ N(x_t, Sigma) generate u ~ U(0, 1) calculate r = pi(x') / pi(x_t) if r > u, x_t+1 = x'; otherwise, x_t+1 = x_t
here Sigma is the covariance matrix of the proposal.
Extends
SingleChainMCMC
.References
[1] “Equation of state calculations by fast computing machines”. Metropolis, N., Rosenbluth, A.W., Rosenbluth, M.N., Teller, A.H. and Teller, E. (1953) The journal of chemical physics, 21(6), pp.1087-1092 https://doi.org/10.1063/1.1699114 -
in_initial_phase
()¶ For methods that need an initial phase (see
needs_initial_phase()
), this method returnsTrue
if the method is currently configured to be in its initial phase. For other methods aNotImplementedError
is returned.
-
n_hyper_parameters
()¶ Returns the number of hyper-parameters for this method (see
TunableMethod
).
-
needs_initial_phase
()¶ Returns
True
if this method needs an initial phase, for example an adaptation-free period for adaptive covariance methods, or a warm-up phase for DREAM.
-
needs_sensitivities
()¶ Returns
True
if this methods needs sensitivities to be passed in totell
along with the evaluated logpdf.
-
set_hyper_parameters
(x)¶ Sets the hyper-parameters for the method with the given vector of values (see
TunableMethod
).Parameters: x – An array of length n_hyper_parameters
used to set the hyper-parameters.
-
set_initial_phase
(in_initial_phase)¶ For methods that need an initial phase (see
needs_initial_phase()
), this method toggles the initial phase algorithm. For other methods aNotImplementedError
is returned.
-