pocoMC

pocoMC: A Python package for accelerated Bayesian inference in astronomy and cosmology - Published in JOSS (2022)

https://github.com/minaskar/pocomc

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in JOSS metadata
  • Academic publication links
  • Committers with academic emails
    1 of 5 committers (20.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

astronomy astrophysics bayesian-inference black-box-bayesian-inference cosmology cosmology-inference general-purpose inference machine-learning mcmc mcmc-sampler normalizing-flows probabilistic-data-analysis python sampling sampling-methods smc

Scientific Fields

Mathematics Computer Science - 84% confidence
Last synced: 4 months ago · JSON representation

Repository

pocoMC: A Python implementation of Preconditioned Monte Carlo for accelerated Bayesian Computation

Basic Info
Statistics
  • Stars: 104
  • Watchers: 5
  • Forks: 9
  • Open Issues: 3
  • Releases: 29
Topics
astronomy astrophysics bayesian-inference black-box-bayesian-inference cosmology cosmology-inference general-purpose inference machine-learning mcmc mcmc-sampler normalizing-flows probabilistic-data-analysis python sampling sampling-methods smc
Created almost 4 years ago · Last pushed 7 months ago
Metadata Files
Readme Contributing Code of conduct

README.md

logo

pocoMC is a Python implementation of the Preconditioned Monte Carlo method for accelerated Bayesian inference

License: GPL v3 Documentation Status

Getting started

Brief introduction

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.

Documentation

Read the docs at pocomc.readthedocs.io for more information, examples and tutorials.

Installation

To install pocomc using pip run:

bash pip install pocomc

or, to install from source:

bash git clone https://github.com/minaskar/pocomc.git cd pocomc python setup.py install

Basic example

For instance, if you wanted to draw samples from a 10-dimensional Rosenbrock distribution with a uniform prior, you would do something like:

```python import pocomc as pc import numpy as np from scipy.stats import uniform

n_dim = 10 # Number of dimensions

prior = pc.Prior(n_dim*[uniform(-10.0, 20.0)]) # U(-10,10)

def log_likelihood(x): return -np.sum(10.0(x[:,::2]2.0 - x[:,1::2])2.0 \ + (x[:,::2] - 1.0)*2.0, axis=1)

sampler = pc.Sampler( prior=prior, likelihood=log_likelihood, vectorize=True, ) sampler.run()

samples, weights, logl, logp = sampler.posterior() # Weighted posterior samples

logz, logz_err = sampler.evidence() # Bayesian model evidence estimate and uncertainty ```

Attribution & Citation

Please cite the following papers if you found this code useful in your research:

```bash @article{karamanis2022accelerating, title={Accelerating astronomical and cosmological inference with preconditioned Monte Carlo}, author={Karamanis, Minas and Beutler, Florian and Peacock, John A and Nabergoj, David and Seljak, Uro{\v{s}}}, journal={Monthly Notices of the Royal Astronomical Society}, volume={516}, number={2}, pages={1644--1653}, year={2022}, publisher={Oxford University Press} }

@article{karamanis2022pocomc, title={pocoMC: A Python package for accelerated Bayesian inference in astronomy and cosmology}, author={Karamanis, Minas and Nabergoj, David and Beutler, Florian and Peacock, John A and Seljak, Uros}, journal={arXiv preprint arXiv:2207.05660}, year={2022} } ```

Licence

Copyright 2022-Now Minas Karamanis and contributors.

pocoMC is free software made available under the GPL-3.0 License. For details see the LICENSE file.

Owner

  • Name: Minas Karamanis
  • Login: minaskar
  • Kind: user

Postdoctoral Fellow at the Berkeley Center for Cosmological Physics, University of California, Berkeley

JOSS Publication

pocoMC: A Python package for accelerated Bayesian inference in astronomy and cosmology
Published
November 09, 2022
Volume 7, Issue 79, Page 4634
Authors
Minas Karamanis ORCID
Institute for Astronomy, University of Edinburgh, Royal Observatory, Blackford Hill, Edinburgh EH9 3HJ, UK, Physics Department, University of California and Lawrence Berkeley National Laboratory Berkeley, CA 94720, USA
David Nabergoj ORCID
Faculty of Computer and Information Science, University of Ljubljana, Ve\v{c}na pot 113, 1000 Ljubljana, Slovenia
Florian Beutler ORCID
Institute for Astronomy, University of Edinburgh, Royal Observatory, Blackford Hill, Edinburgh EH9 3HJ, UK
John A. Peacock ORCID
Institute for Astronomy, University of Edinburgh, Royal Observatory, Blackford Hill, Edinburgh EH9 3HJ, UK
Uroš Seljak ORCID
Physics Department, University of California and Lawrence Berkeley National Laboratory Berkeley, CA 94720, USA
Editor
Dan Foreman-Mackey ORCID
Tags
astronomy

GitHub Events

Total
  • Issues event: 2
  • Watch event: 18
  • Push event: 4
  • Fork event: 1
  • Create event: 3
Last Year
  • Issues event: 2
  • Watch event: 18
  • Push event: 4
  • Fork event: 1
  • Create event: 3

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 264
  • Total Committers: 5
  • Avg Commits per committer: 52.8
  • Development Distribution Score (DDS): 0.402
Past Year
  • Commits: 5
  • Committers: 1
  • Avg Commits per committer: 5.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
minaskar m****r@g****m 158
David Nabergoj d****4@s****i 99
Dan F-M f****y@g****m 5
joezuntz j****z@g****m 1
Minas Karamanis m****s@M****l 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 15
  • Total pull requests: 42
  • Average time to close issues: 7 months
  • Average time to close pull requests: 14 days
  • Total issue authors: 10
  • Total pull request authors: 6
  • Average comments per issue: 2.07
  • Average comments per pull request: 0.02
  • Merged pull requests: 39
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 4
  • Average time to close issues: N/A
  • Average time to close pull requests: 5 minutes
  • Issue authors: 2
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ajdittmann (4)
  • kazewong (3)
  • LAujust (1)
  • augeorge (1)
  • kmzzhang (1)
  • lindede249 (1)
  • francois-rozet (1)
  • marylou-gabrie (1)
  • joezuntz (1)
  • angelgarron (1)
Pull Request Authors
  • minaskar (44)
  • davidnabergoj (8)
  • AlexKurek (2)
  • dfm (2)
  • augeorge (1)
  • joezuntz (1)
Top Labels
Issue Labels
bug (1) good first issue (1) enhancement (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 285 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 31
  • Total maintainers: 1
pypi.org: pocomc

Preconditioned Monte Carlo

  • Versions: 31
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 285 Last month
Rankings
Dependent packages count: 6.6%
Stargazers count: 9.8%
Downloads: 10.3%
Average: 15.4%
Forks count: 19.6%
Dependent repos count: 30.6%
Maintainers (1)
Last synced: 4 months ago

Dependencies

docs/requirements.txt pypi
  • myst_nb *
  • sphinx_book_theme *
requirements.txt pypi
  • corner *
  • matplotlib *
  • numpy *
  • scipy *
  • torch *
  • tqdm *
.github/workflows/draft-pdf.yml actions
  • actions/checkout v2 composite
  • actions/upload-artifact v1 composite
  • openjournals/openjournals-draft-action master composite
.github/workflows/release_to_pypi.yml actions
  • actions/checkout v2 composite
  • actions/create-release v1 composite
  • actions/setup-python v2 composite
  • actions/upload-release-asset v1 composite
  • pypa/gh-action-pypi-publish master composite
.github/workflows/setup_and_run_tests.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
setup.py pypi