pybop.samplers.base_sampler#

Classes#

BaseSampler

Base class for Monte Carlo samplers.

Module Contents#

class pybop.samplers.base_sampler.BaseSampler(log_pdf: pybop.LogPosterior, x0, chains: int, cov0: numpy.ndarray | float)[source]#

Base class for Monte Carlo samplers.

_ask_for_samples()[source]#
_check_initial_phase()[source]#
_end_initial_phase()[source]#
_finalise_logging()[source]#
_initialise_logging()[source]#
_initialise_storage()[source]#
abstract run() numpy.ndarray[source]#

Sample from the posterior distribution.

Returns:

Samples from the posterior distribution.

Return type:

np.ndarray

set_initial_phase_iterations(iterations=250)[source]#

Set the number of iterations for the initial phase of the sampler.

Parameters:

iterations (int) – Number of iterations for the initial phase.

set_max_iterations(iterations=500)[source]#

Set the maximum number of iterations for the sampler.

Parameters:

iterations (int) – Maximum number of iterations.

set_parallel(parallel=False)[source]#

Enable or disable parallel evaluation. Credit: PINTS

Parameters:

parallel (bool or int, optional) – If True, use as many worker processes as there are CPU cores. If an integer, use that many workers. If False or 0, disable parallelism (default: False).

_cov0[source]#
_log_pdf[source]#
_n_chains[source]#
_x0[source]#