Population MCMC¶
-
class
pints.
PopulationMCMC
(x0, sigma0=None)[source]¶ Creates a chain of samples from a target distribution, using the population MCMC (simulated tempering) routine described in algorithm 1 in [1].
This method uses several chains internally, but only a single one is updated per iteration, and only a single one is returned at the end, hence this method is classified here as a single chain MCMC method.
The algorithm goes through the following steps (after initialising
N
internal chains):1. Mutation: randomly select chain
i
and update the chain using a Markov kernel that admitsp_i
as its invariant distribution.2. Exchange: Select another chain
j
at random from the remaining and swap the parameter vector ofi
andj
with probabilitymin(1, A)
,A = p_i(x_j) * p_j(x_i) / (p_i(x_i) * p_j(x_j))
where
x_i
andx_j
are the current values of chainsi
andj
, respectively, wherep_i = p(theta|data) ^ (1 - T_i)
, wherep(theta|data)
is the target distribution andT_i
is bounded between[0, 1]
and represents a tempering parameter.We use a range of
T = (0,delta_T,...,1)
, wheredelta_T = 1 / num_temperatures
, and the chain withT_i = 0
is the one whose target distribution we want to sample.Extends
SingleChainMCMC
.References
[1] “On population-based simulation for static inference”, Ajay Jasra, David A. Stephens and Christopher C. Holmes, Statistical Computing, 2007. https://doi.org/10.1007/s11222-007-9028-9 -
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)¶ Replaces the internal current position, current LogPDF, and proposed point (if any) by the user-specified values.
This method can only be used once the initial position and LogPDF have been set (so after at least 1 round of ask-and-tell).
This is an optional method, and some samplers may not support it.
-
set_hyper_parameters
(x)[source]¶ The hyper-parameter vector is
[n_temperatures]
, wheren_temperatures
is an integer that will be passed toset_temperature_schedule()
.Note that, since the hyper-parameter vector should be 1d (without nesting), setting an explicit temperature schedule is not supported via the hyper-parameter interface.
-
set_temperature_schedule
(schedule=10)[source]¶ Sets a temperature schedule.
If
schedule
is anint
it is interpreted as the number of temperatures and a schedule is generated accordingly.If
schedule
is a list (or array) it is interpreted as a custom temperature schedule.
-