Skip to main content

margarine: Posterior Sampling and Marginal Bayesian Statistics

Project description

Introduction

margarine:

Marginal Bayesian Statistics

Authors:

Harry T.J. Bevins

Version:

1.2.8

Homepage:

https://github.com/htjb/margarine

Documentation:

https://margarine.readthedocs.io/

Documentation Status https://mybinder.org/badge_logo.svg http://img.shields.io/badge/astro.IM-arXiv%3A2205.12841-B31B1B.svg

Installation

The software should be installed via the git repository using the following commands in the terminal

git clone https://github.com/htjb/margarine.git # or the equivalent using ssh keys
cd margarine
python setup.py install --user

or via a pip install with

pip install margarine

Note that the pip install is not always the most up to date version of the code.

Details/Examples

margarine is designed to make the calculation of marginal bayesian statistics feasible given a set of samples from an MCMC or nested sampling run.

An example of how to use the code can be found on the github in the jupyter notebook notebook/Tutorial.ipynb or alternatively at here.

Documentation

The documentation is available at: https://margarine.readthedocs.io/

To compile it locally you can run

cd docs
sphinx-build source html-build

after cloning the repo and installing the relevant packages with

pip install sphinx numpydoc sphinx_rtd_theme

Licence and Citation

The software is available on the MIT licence.

If you use the code for academic purposes we request that you cite the following paper and the MaxEnt22 proceedings If you use the clustering implementation please cite the following preprint. You can use the following bibtex

@ARTICLE{2023MNRAS.526.4613B,
      author = {{Bevins}, Harry T.~J. and {Handley}, William J. and {Lemos}, Pablo and {Sims}, Peter H. and {de Lera Acedo}, Eloy and {Fialkov}, Anastasia and {Alsing}, Justin},
        title = "{Marginal post-processing of Bayesian inference products with normalizing flows and kernel density estimators}",
      journal = {\mnras},
    keywords = {methods: data analysis, methods: statistical, cosmic background radiation, dark ages, reionization, first stars, Astrophysics - Instrumentation and Methods for Astrophysics, Astrophysics - Cosmology and Nongalactic Astrophysics, Computer Science - Machine Learning},
        year = 2023,
        month = dec,
      volume = {526},
      number = {3},
        pages = {4613-4626},
          doi = {10.1093/mnras/stad2997},
archivePrefix = {arXiv},
      eprint = {2205.12841},
primaryClass = {astro-ph.IM},
      adsurl = {https://ui.adsabs.harvard.edu/abs/2023MNRAS.526.4613B},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

and

@ARTICLE{2022arXiv220711457B,
     author = {{Bevins}, Harry and {Handley}, Will and {Lemos}, Pablo and {Sims}, Peter and {de Lera Acedo}, Eloy and {Fialkov}, Anastasia},
      title = "{Marginal Bayesian Statistics Using Masked Autoregressive Flows and Kernel Density Estimators with Examples in Cosmology}",
    journal = {arXiv e-prints},
   keywords = {Astrophysics - Cosmology and Nongalactic Astrophysics, Astrophysics - Instrumentation and Methods for Astrophysics},
       year = 2022,
      month = jul,
        eid = {arXiv:2207.11457},
      pages = {arXiv:2207.11457},
archivePrefix = {arXiv},
     eprint = {2207.11457},
primaryClass = {astro-ph.CO},
     adsurl = {https://ui.adsabs.harvard.edu/abs/2022arXiv220711457B},
    adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

and

@ARTICLE{2023arXiv230502930B,
      author = {{Bevins}, Harry and {Handley}, Will},
        title = "{Piecewise Normalizing Flows}",
      journal = {arXiv e-prints},
    keywords = {Statistics - Machine Learning, Computer Science - Machine Learning},
        year = 2023,
        month = may,
          eid = {arXiv:2305.02930},
        pages = {arXiv:2305.02930},
          doi = {10.48550/arXiv.2305.02930},
archivePrefix = {arXiv},
      eprint = {2305.02930},
primaryClass = {stat.ML},
      adsurl = {https://ui.adsabs.harvard.edu/abs/2023arXiv230502930B},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

Requirements

The code requires the following packages to run:

To compile the documentation locally you will need:

To run the test suit you will need:

Contributing

Contributions and suggestions for areas of development are welcome and can be made by opening a issue to report a bug or propose a new feature for discussion.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

margarine-1.2.8.tar.gz (413.7 kB view details)

Uploaded Source

Built Distribution

margarine-1.2.8-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file margarine-1.2.8.tar.gz.

File metadata

  • Download URL: margarine-1.2.8.tar.gz
  • Upload date:
  • Size: 413.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for margarine-1.2.8.tar.gz
Algorithm Hash digest
SHA256 319568f3b268fffdbfc21cbd22fc332fa8712244f3d9504d8f97ee37d565d731
MD5 99763daf618e18953e9c88c84b8c45c9
BLAKE2b-256 b8a2e2ef475c1198d61aca58e8e40d1993eaf50d16d6ed8e5ee687579be745d5

See more details on using hashes here.

File details

Details for the file margarine-1.2.8-py3-none-any.whl.

File metadata

  • Download URL: margarine-1.2.8-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for margarine-1.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 99d60ed7b3e14dda095b29df6475958f0d71a60a6af5f2fbee5419259bca5981
MD5 e0459280064ce0e522debf1a262c2c3c
BLAKE2b-256 6243e5d1cbd86897b4347cd99d0102795bab33a0a0ed3ac7e405123eb43dbb94

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page