7.1.1.2.1.2. pta.sampling.convergence_manager
Management of MCMC simulation to achieve desired convergence criteria.
7.1.1.2.1.2.1. Module Contents
- class pta.sampling.convergence_manager.ConvergenceManager(sampler: pta.sampling.commons.SamplerInterface, num_initial_steps: int = -1, samples_based_rounding: bool = False)[source]
Class managing MCMC simulations to achieve desired convergence criteria.
- Parameters:
sampler (Sampler) – Object implementing a specific MCMC sampler.
num_initial_steps (int, optional) – Initial number of steps for simulations, by default -1 (automatic).
samples_based_rounding (bool, optional) – If true, the direction sampling distribution will be adjusted after each iteration based on the distribution of samples so far, by default False
- run(settings: _pta_python_binaries.SamplerSettings, update_settings_function: Callable[[_pta_python_binaries.SamplerSettings, int], None], make_sampling_result_function: Callable[[Any], pta.sampling.commons.SamplingResult], initial_points: numpy.ndarray, max_steps: int, max_psrf: float) pta.sampling.commons.SamplingResult[source]
Run the sampler using this manager until the given PSRF or maximum number of steps is reached.
- Parameters:
settings (pb.SamplerSettings) – The initial settings for the sampler.
update_settings_function (Callable[[pb.SamplerSettings, int], None]) – Function for updating the settings with different numbers of steps.
make_sampling_result_function (Callable[[Any], SamplingResult]) – Function for packing the result of the native sampler in a SamplingResult object.
initial_points (np.ndarray) – The initial points for the simulation.
max_steps (int) – Maximum number of steps to simulate.
max_psrf (float) – Maximum PSRF to declare convergence.
- Returns:
The result of the sampler.
- Return type:
- Raises:
SamplingException – If the native sampler fails.