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
Ninternal chains):1. Mutation: randomly select chain
iand update the chain using a Markov kernel that admitsp_ias its invariant distribution.2. Exchange: Select another chain
jat random from the remaining and swap the parameter vector ofiandjwith probabilitymin(1, A),A = p_i(x_j) * p_j(x_i) / (p_i(x_i) * p_j(x_j))where
x_iandx_jare the current values of chainsiandj, respectively, wherep_i = p(theta|data) ^ (1 - T_i), wherep(theta|data)is the target distribution andT_iis 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 = 0is the one whose target distribution we want to sample.Extends
SingleChainMCMC, does not use sensitivities.References
- needs_sensitivities()¶
Returns
Trueif this methods needs sensitivities to be passed in totellalong 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_temperaturesis 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
scheduleis anintit is interpreted as the number of temperatures and a schedule is generated accordingly.If
scheduleis a list (or array) it is interpreted as a custom temperature schedule.