Skip to main content

Simulation-based inference.

Project description

PyPI version Contributions welcome Tests codecov GitHub license DOI

sbi: simulation-based inference

Getting Started | Documentation

sbi is a PyTorch package for simulation-based inference. Simulation-based inference is
the process of finding parameters of a simulator from observations.

sbi takes a Bayesian approach and returns a full posterior distribution over the parameters, conditional on the observations. This posterior can be amortized (i.e. useful for any observation) or focused (i.e. tailored to a particular observation), with different computational trade-offs.

sbi offers a simple interface for one-line posterior inference.

from sbi.inference import infer
# import your simulator, define your prior over the parameters
parameter_posterior = infer(simulator, prior, method='SNPE', num_simulations=100)

See below for the available methods of inference, SNPE, SNRE and SNLE.

Installation

sbi requires Python 3.6 or higher. We recommend to use a conda virtual environment (Miniconda installation instructions). If conda is installed on the system, an environment for installing sbi can be created as follows:

# Create an environment for sbi (indicate Python 3.6 or higher); activate it
$ conda create -n sbi_env python=3.7 && conda activate sbi_env

Independent of whether you are using conda or not, sbi can be installed using pip:

$ pip install sbi

To test the installation, drop into a python prompt and run

from sbi.examples.minimal import simple
posterior = simple()
print(posterior)

Inference Algorithms

The following algorithms are currently available:

Sequential Neural Posterior Estimation (SNPE)

Sequential Neural Likelihood Estimation (SNLE)

Sequential Neural Ratio Estimation (SNRE)

Feedback and Contributions

We would like to hear how sbi is working for your inference problems as well as receive bug reports, pull requests and other feedback (see contribute).

Acknowledgements

sbi is the successor (using PyTorch) of the delfi package. It was started as a fork of Conor M. Durkan's lfi. sbi runs as a community project; development is coordinated at the mackelab. See also credits.

Support

sbi has been developed in the context of the ADIMEM grant, project A. ADIMEM is a BMBF grant awarded to groups at the Technical University of Munich, University of Tübingen and Research Center caesar of the Max Planck Gesellschaft.

License

Affero General Public License v3 (AGPLv3)

Citation

If you use sbi consider citing the corresponding paper:

@article{tejero-cantero2020sbi,
  doi = {10.21105/joss.02505},
  url = {https://doi.org/10.21105/joss.02505},
  year = {2020},
  publisher = {The Open Journal},
  volume = {5},
  number = {52},
  pages = {2505},
  author = {Alvaro Tejero-Cantero and Jan Boelts and Michael Deistler and Jan-Matthis Lueckmann and Conor Durkan and Pedro J. Gonçalves and David S. Greenberg and Jakob H. Macke},
  title = {sbi: A toolkit for simulation-based inference},
  journal = {Journal of Open Source Software}
}

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

sbi-0.13.2.tar.gz (856.1 kB view details)

Uploaded Source

Built Distribution

sbi-0.13.2-py2.py3-none-any.whl (141.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file sbi-0.13.2.tar.gz.

File metadata

  • Download URL: sbi-0.13.2.tar.gz
  • Upload date:
  • Size: 856.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0.post20200704 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for sbi-0.13.2.tar.gz
Algorithm Hash digest
SHA256 cc6c570a040d598fa09bcb90d2187b8dcf8679f5a252947d8172a6390ec53c28
MD5 859b3a4c0693182a0e2f4948e204dec4
BLAKE2b-256 2e0bae6b7f26e0f6f693db48cf8a1208cb75ca8b46b6a70f3b09479a15f41a7f

See more details on using hashes here.

File details

Details for the file sbi-0.13.2-py2.py3-none-any.whl.

File metadata

  • Download URL: sbi-0.13.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 141.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0.post20200704 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for sbi-0.13.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 23baa3b3c7f0c3cbcf31b125fee6cf8bcd486921db818e1ba8d003eb2027841d
MD5 79920deaa15d1344fdf6301e94ede9d2
BLAKE2b-256 5f626a8fac884845853eec56b4c6d9d06f78dec15e395137047a5d96a838d42c

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