Welcome to Eryn’s documentation!
Eryn: a multi-purpose MCMC sampler
Eryn is an advanced MCMC sampler. It has the capability to run with
parallel tempering, multiple model types, and unknown counts within each
model type using Reversible Jump MCMC techniques. Eryn is heavily based
on emcee. The emcee
base structure with the Ensemble Sampler, State objects, proposal setup,
and storage backends is carried over into Eryn with small changes to
account for the increased complexity. In a simple sense, Eryn is an
advanced (and slightly more complicated) version of emcee
.
If you use Eryn in your publication, please cite the paper arXiv:2303.02164, its zenodo, and emcee. The documentation for Eryn can be found here: mikekatz04.github.io/Eryn. You will find the code on Github: github.com/mikekatz04/Eryn.
Getting Started
Below is a quick set of instructions to get you started with eryn
.
pip install eryn
To import eryn:
from eryn.ensemble import EnsembleSampler
See examples notebook for more info. You can also navigate the Documentation pages.
Prerequisites
Eryn has only a few python-based dependencies: tqdm
, corner
for
plotting, numpy
, matplotlib
.
Installing
If you are not planning to develop the code, you can just install the
latest version with the pip installation technique given above.
Otherwise, you can just clone the repo and run pip install .
inside
of the Eryn directory. To run tests on Eryn during development, you can
run the following in the main Eryn directory:
python -m unittest discover
Running the Tests
In the main directory of the package run in the terminal:
python -m unittest discover
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Current Version: 1.1.12
Citation
When using this package, please cite at minimum the following sources:
@article{Karnesis:2023ras,
author = "Karnesis, Nikolaos and Katz, Michael L. and Korsakova, Natalia and Gair, Jonathan R. and Stergioulas, Nikolaos",
title = "{Eryn : A multi-purpose sampler for Bayesian inference}",
eprint = "2303.02164",
archivePrefix = "arXiv",
primaryClass = "astro-ph.IM",
month = "3",
year = "2023"
}
@software{michael_katz_2023_7705496,
author = {Michael Katz and
Nikolaos Karnesis and
Natalia Korsakova},
title = {mikekatz04/Eryn: first full release},
month = mar,
year = 2023,
publisher = {Zenodo},
version = {v1.0.0},
doi = {10.5281/zenodo.7705496},
url = {https://doi.org/10.5281/zenodo.7705496}
}
@ARTICLE{2013PASP..125..306F,
author = {{Foreman-Mackey}, Daniel and {Hogg}, David W. and {Lang}, Dustin and {Goodman}, Jonathan},
title = "{emcee: The MCMC Hammer}",
journal = {\pasp},
keywords = {Astrophysics - Instrumentation and Methods for Astrophysics, Physics - Computational Physics, Statistics - Computation},
year = 2013,
month = mar,
volume = {125},
number = {925},
pages = {306},
doi = {10.1086/670067},
archivePrefix = {arXiv},
eprint = {1202.3665},
primaryClass = {astro-ph.IM},
adsurl = {https://ui.adsabs.harvard.edu/abs/2013PASP..125..306F},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
Depending on which proposals are used, you may be required to cite more sources. Please make sure you do this properly.
License
This project is licensed under the GNU License - see the LICENSE.md file for details.
Acknowledgments
We wish to thank S. Babak, M. Le Jeune, S. Marsat, T. Littenberg, and N. Cornish for their useful comments and very fruitful discussions.
N Stergioulas and N Karnesis acknowledge support from the Gr-PRODEX 2019 funding program (PEA 4000132310).
- Ensemble
EnsembleSampler
EnsembleSampler.random_state
EnsembleSampler.priors
EnsembleSampler.reset()
EnsembleSampler.get_model()
EnsembleSampler.sample()
EnsembleSampler.run_mcmc()
EnsembleSampler.compute_log_prior()
EnsembleSampler.compute_log_like()
EnsembleSampler.acceptance_fraction
EnsembleSampler.rj_acceptance_fraction
EnsembleSampler.swap_acceptance_fraction
EnsembleSampler.get_chain()
EnsembleSampler.get_blobs()
EnsembleSampler.get_log_like()
EnsembleSampler.get_log_prior()
EnsembleSampler.get_log_posterior()
EnsembleSampler.get_inds()
EnsembleSampler.get_nleaves()
EnsembleSampler.get_last_sample()
EnsembleSampler.get_betas()
EnsembleSampler.get_value()
EnsembleSampler.get_autocorr_time()
- State
- Backends
- Regular Backend
Backend
Backend.accepted
Backend.betas
Backend.blobs
Backend.branch_names
Backend.chain
Backend.dtype
Backend.inds
Backend.initiailized
Backend.iteration
Backend.log_prior
Backend.log_like
Backend.move_info
Backend.move_keys
Backend.nbranches
Backend.ndims
Backend.nleaves_max
Backend.nwalkers
Backend.ntemps
Backend.reset_args
Backend.reset_kwargs
Backend.rj
Backend.rj_accepted
Backend.store_missing_leaves
Backend.reset_base()
Backend.reset()
Backend.has_blobs()
Backend.get_value()
Backend.get_chain()
Backend.get_autocorr_thin_burn()
Backend.get_inds()
Backend.get_nleaves()
Backend.get_blobs()
Backend.get_log_like()
Backend.get_log_prior()
Backend.get_log_posterior()
Backend.get_betas()
Backend.get_a_sample()
Backend.get_last_sample()
Backend.get_autocorr_time()
Backend.get_evidence_estimate()
Backend.get_gelman_rubin_convergence_diagnostic()
Backend.shape
Backend.grow()
Backend.get_move_info()
Backend.save_step()
Backend.get_info()
- HDF Backend
HDFBackend
HDFBackend.initialized
HDFBackend.open()
HDFBackend.reset()
HDFBackend.nwalkers
HDFBackend.ntemps
HDFBackend.rj
HDFBackend.nleaves_max
HDFBackend.ndims
HDFBackend.move_keys
HDFBackend.branch_names
HDFBackend.nbranches
HDFBackend.reset_args
HDFBackend.reset_kwargs
HDFBackend.has_blobs()
HDFBackend.get_value()
HDFBackend.get_move_info()
HDFBackend.shape
HDFBackend.iteration
HDFBackend.accepted
HDFBackend.rj_accepted
HDFBackend.swaps_accepted
HDFBackend.random_state
HDFBackend.grow()
HDFBackend.save_step()
HDFBackend.get_a_sample()
HDFBackend.get_autocorr_thin_burn()
HDFBackend.get_autocorr_time()
HDFBackend.get_betas()
HDFBackend.get_blobs()
HDFBackend.get_chain()
HDFBackend.get_evidence_estimate()
HDFBackend.get_gelman_rubin_convergence_diagnostic()
HDFBackend.get_inds()
HDFBackend.get_info()
HDFBackend.get_last_sample()
HDFBackend.get_log_like()
HDFBackend.get_log_posterior()
HDFBackend.get_log_prior()
HDFBackend.get_nleaves()
HDFBackend.reset_base()
- Regular Backend
- Moves
- Move Parent Class
Move
Move.Note
Move.num_proposals
Move.gibbs_sampling_setup
Move.xp
Move.use_gpu
Move.gibbs_sampling_setup_iterator()
Move.setup_proposals()
Move.cleanup_proposals_gibbs()
Move.ensure_ordering()
Move.fix_logp_gibbs()
Move.accepted
Move.acceptance_fraction
Move.temperature_control
Move.compute_log_posterior_basic()
Move.tune()
Move.update()
- Metropolis-Hastings Moves
- Red-Blue Moves
- Group Moves
- Reversible Jump Moves
- Mutliple Try Moves
- Utility Moves
CombineMove
CombineMove.accepted
CombineMove.acceptance_fraction
CombineMove.acceptance_fraction_separate
CombineMove.temperature_control
CombineMove.cleanup_proposals_gibbs()
CombineMove.compute_log_posterior_basic()
CombineMove.ensure_ordering()
CombineMove.fix_logp_gibbs()
CombineMove.gibbs_sampling_setup_iterator()
CombineMove.setup_proposals()
CombineMove.tune()
CombineMove.update()
CombineMove.periodic
CombineMove.propose()
- Move Parent Class
- Priors
- Parallel Tempering
- Utilities