Skip to main content

Neural Network-Boosted Importance Sampling for Bayesian Statistics

Project description

Logo

Unit Testing Status Documentation Status Code Coverage PyPI PyPI - Downloads Conda Conda - Downloads License: MIT Language: Python

Nautilus is an MIT-licensed pure-Python package for Bayesian posterior and evidence estimation. It utilizes importance sampling and efficient space exploration using neural networks. Compared to traditional MCMC and Nested Sampling codes, it often needs fewer likelihood calls and produces much larger posterior samples. Additionally, nautilus is highly accurate and produces Bayesian evidence estimates with percent precision. It is widely used in many areas of astrophysical research.

Example

This example, sampling a 3-dimensional Gaussian, illustrates how to use nautilus.

import corner
import numpy as np
from nautilus import Prior, Sampler
from scipy.stats import multivariate_normal

prior = Prior()
for key in 'abc':
    prior.add_parameter(key)

def likelihood(param_dict):
    x = [param_dict[key] for key in 'abc']
    return multivariate_normal.logpdf(x, mean=[0.4, 0.5, 0.6], cov=0.01)

sampler = Sampler(prior, likelihood)
sampler.run(verbose=True)
points, log_w, log_l = sampler.posterior()
corner.corner(points, weights=np.exp(log_w), labels='abc')

Installation

The most recent stable version of nautilus is listed in the Python Package Index (PyPI) and can be installed via pip.

pip install nautilus-sampler

Additionally, nautilus is also on conda-forge. To install via conda use the following command.

conda install -c conda-forge nautilus-sampler

Documentation

You can find the documentation at nautilus-sampler.readthedocs.io.

Attribution

A paper describing nautilus's underlying methods and performance has been published in the Monthly Notices of the Royal Astronomical Society. A draft of the paper is also available on arXiv. Please cite the paper if you find nautilus helpful in your research.

@article{nautilus,
    author = {Lange, Johannes U},
    title = "{nautilus: boosting Bayesian importance nested sampling with deep learning}",
    journal = {Monthly Notices of the Royal Astronomical Society},
    volume = {525},
    number = {2},
    pages = {3181-3194},
    year = {2023},
    month = {08},
    doi = {10.1093/mnras/stad2441},
    url = {https://doi.org/10.1093/mnras/stad2441},
    eprint = {https://academic.oup.com/mnras/article-pdf/525/2/3181/51331635/stad2441.pdf},
}

License

Nautilus is licensed under the MIT License. The logo uses an image from the Illustris Collaboration.

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

nautilus_sampler-1.0.2.tar.gz (39.8 kB view details)

Uploaded Source

Built Distribution

nautilus_sampler-1.0.2-py2.py3-none-any.whl (32.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file nautilus_sampler-1.0.2.tar.gz.

File metadata

  • Download URL: nautilus_sampler-1.0.2.tar.gz
  • Upload date:
  • Size: 39.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for nautilus_sampler-1.0.2.tar.gz
Algorithm Hash digest
SHA256 ad351e9365c18f2275efc958a9aa403df0bfabbf429ae1129865a444d5b9e6b0
MD5 82a880c20971d6a1274d9c6f9957f845
BLAKE2b-256 31b104dee1cc855259e814e28e13e9e43da7b472afe43c03f00b08a72cf05175

See more details on using hashes here.

File details

Details for the file nautilus_sampler-1.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for nautilus_sampler-1.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d059328ee813b6224c38d2e1d7c23f83b4442a49768b7a2632f93a5778452f86
MD5 60e0f2326056c7f298f9fbbf72dbdd60
BLAKE2b-256 f3aa83252948d1089a74e5c0b57d8dc8379fdf3213ff0f9be4db5b0db57dd951

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