The Pocomc sampler
Preconditioned Monte Carlo for Accelerated Bayesian Computation
Name |
pocomc |
Version |
1.2.1 |
Author(s) |
Minas Karamanis, David Nabergoj, Florian Beutler, John Peacock, Uros Seljak |
URL |
|
Citation(s) |
https://arxiv.org/abs/2207.05660, https://arxiv.org/abs/2207.05652 |
Parallelism |
parallel |
pocoMC is a Python package for fast Bayesian posterior and model evidence estimation. It leverages the Preconditioned Monte Carlo (PMC) algorithm, offering significant speed improvements over traditional methods like MCMC and Nested Sampling. Ideal for large-scale scientific problems with expensive likelihood evaluations, non-linear correlations, and multimodality, pocoMC provides efficient and scalable posterior sampling and model evidence estimation. Widely used in cosmology and astronomy, pocoMC is user-friendly, flexible, and actively maintained.
It generates both posterior samples and Bayesian evidences.
Installation
if using conda, do this first to ensure consistent dependencies:
conda install -c conda-forge corner pytorch tqdm
pip install pocomc
Parameters
These parameters can be set in the sampler’s section in the ini parameter file. If no default is specified then the parameter is required. A listing of “(empty)” means a blank string is the default.
Name |
Type |
Default |
Description |
|---|---|---|---|
n_effective |
integer, default=512 |
Number of effective particles/walkers. It should be at least twice the number of active particles. |
|
n_active |
integer, default=256 |
Number of active particles/walkers. It should no more than half of the number of effective particles. It is recommended to be a multiple of the number of CPUs for optimal performance. |
|
flow |
string |
The type of normalizing flow to use. Default is “nsf6” (Neural Spline Flow with 6 transforms). Other options include “nsf3”, “nsf12”, “maf3”, “maf6”, “maf12” (Masked Autoregressive Flow). |
|
precondition |
bool, default=True |
Whether to use Normalizing Flow Preconditioning to accelerate sampling. |
|
dynamic |
bool, default=True |
Whether to use dynamic particle allocation. |
|
n_total |
integer, default=4096 |
Total number of effective samples to generate. Higher values will increase the accuracy of the posterior estimate (recommended ~10000 for publication quality corner plots). |
|
n_evidence |
integer, default=4096 |
Number of samples to generate for the Bayesian evidence calculation. |
|
n_steps |
integer, default=None |
Number of MCMC steps. This will be automatically adjusted based on the sampling efficiency. Default is n_steps=n_dim. Larger values will provide more robust results at higher computational cost. |
|
n_max_steps |
integer, default=None |
Maximum number of MCMC steps. Default is n_max_steps=10*n_dim. This should be greater than n_steps. |
|
save_every |
int, default=None |
Save the state of the sampler every save_every iterations. If not provided, the sampler will not save intermediate states. |
|
seed |
int |
0 |
A random seed for reproducibility. Default is to generate automatically. |
progress |
bool, default=True |
Whether to show a progress bar during sampling. |