pybop.samplers.base_sampler#
Classes#
Base class for Monte Carlo samplers. |
Module Contents#
- class pybop.samplers.base_sampler.BaseSampler(log_pdf: pybop.LogPosterior | list[pybop.LogPosterior], x0, chains: int, cov0: numpy.ndarray | float)[source]#
Bases:
pybop.CostInterfaceBase class for Monte Carlo samplers.
- Parameters:
log_pdf (pybop.LogPosterior or List[pybop.LogPosterior]) – The posterior or PDF to be sampled.
chains (int) – Number of chains to be used.
x0 – List-like initial values of the parameters for Monte Carlo sampling.
cov0 – The covariance matrix to be sampled.
Note (Samplers perform maximisation of the Posterior by default.)
- abstractmethod 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.