Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

sbi is a Python package for simulation-based inference, designed to meet the needs of both researchers and practitioners. Whether you need fine-grained control or an easy-to-use interface, sbi has you covered.

License

NotificationsYou must be signed in to change notification settings

sbi-dev/sbi

Repository files navigation

PyPI versionConda VersionContributions welcomeTestscodecovGitHub licenseDOINumFOCUS affiliated

sbi: Simulation-Based Inference

Getting Started |Documentation |Discord Server

sbi is a Python package for simulation-based inference, designed to meet the needs ofboth researchers and practitioners. Whether you need fine-grained control or aneasy-to-use interface,sbi has you covered.

Withsbi, you can perform parameter inference using Bayesian inference: Given asimulator that models a real-world process, SBI estimates the full posteriordistribution over the simulator’s parameters based on observed data. This distributionindicates the most likely parameter values while additionally quantifying uncertaintyand revealing potential interactions between parameters.

Key Features ofsbi

sbi offers a blend of flexibility and ease of use:

  • Low-Level Interfaces: For those who require maximum control over the inferenceprocess,sbi provides low-level interfaces that allow you to fine-tune many aspectsof your workflow.
  • High-Level Interfaces: If you prefer simplicity and efficiency,sbi also offershigh-level interfaces that enable quick and easy implementation of complex inferencetasks.

In addition,sbi supports a wide range of state-of-the-art inference algorithms (seebelow for a list of implemented methods):

  • Amortized Methods: These methods enable the reuse of posterior estimators acrossmultiple observations without the need to retrain.
  • Sequential Methods: These methods focus on individual observations, optimizing thenumber of simulations required.

Beyond inference,sbi also provides:

  • Validation Tools: Built-in methods to validate and verify the accuracy of yourinferred posteriors.
  • Plotting and Analysis Tools: Comprehensive functions for visualizing and analyzingresults, helping you interpret the posterior distributions with ease.

Getting started withsbi is straightforward, requiring only a few lines of code:

fromsbi.inferenceimportNPE# Given: parameters theta and corresponding simulations xinference=NPE(prior=prior)inference.append_simulations(theta,x).train()posterior=inference.build_posterior()

Installation

sbi requires Python 3.10 or higher. While a GPU isn't necessary, it can improveperformance in some cases. We recommend using a virtual environment withconda for an easy setup.

Ifconda is installed on the system, an environment for installingsbi can be created as follows:

conda create -n sbi_env python=3.10&& conda activate sbi_env

From PyPI

To installsbi from PyPI run

python -m pip install sbi

From conda-forge

To install and addsbi to a project withpixi, from the project directory run

pixi add sbi

and to install into a particular conda environment withconda, in the activated environment run

conda install --channel conda-forge sbi

Test the installation

Open a Python prompt and run

fromsbi.examples.minimalimportsimpleposterior=simple()print(posterior)

Tutorials

If you're new tosbi, we recommend starting with ourGettingStarted tutorial.

You can also access and run these tutorials directly in your browser by openingCodespace. To do so, click the green“Code” button on the GitHub repository and select “Open with Codespaces.” This providesa fully functional environment where you can exploresbi through Jupyter notebooks.

Inference Algorithms

The following inference algorithms are currently available. You can find instructions onhow to run each of these methodshere.

Neural Posterior Estimation: amortized (NPE) and sequential (SNPE)

Neural Likelihood Estimation: amortized (NLE) and sequential (SNLE)

Neural Ratio Estimation: amortized (NRE) and sequential (SNRE)

Neural Variational Inference, amortized (NVI) and sequential (SNVI)

Mixed Neural Likelihood Estimation (MNLE)

Feedback and Contributions

We welcome any feedback on howsbi is working for your inference problems (seeDiscussions) and are happy to receive bugreports, pull requests, and other feedback (seecontribute). We wish to maintain a positivecommunity; please read ourCode of Conduct.

Acknowledgments

sbi is the successor (using PyTorch) of thedelfi package. It started as a fork of Conor M.Durkan'slfi.sbi runs as a community project. See alsocredits.

Support

sbi has been supported by the German Federal Ministry of Education and Research (BMBF)through project ADIMEM (FKZ 01IS18052 A-D), project SiMaLeSAM (FKZ 01IS21055A) and theTübingen AI Center (FKZ 01IS18039A). Since 2024,sbi is supported by the appliedAIInstitute for Europe, and by NumFOCUS.

License

Apache License Version 2.0 (Apache-2.0)

Citation

If you usesbi consider citing thesbi softwarepaper, in addition to the original researcharticles describing the specific sbi-algorithm(s) you are using.

@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}}

The above citation refers to the original version of thesbi project and has apersistent DOI. Additionally, new releases ofsbi are citable viaZenodo, where we create a new DOI for everyrelease.

About

sbi is a Python package for simulation-based inference, designed to meet the needs of both researchers and practitioners. Whether you need fine-grained control or an easy-to-use interface, sbi has you covered.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp