Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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
Appearance settings

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

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

uv venv -p 3.10

Then activate the virtual enviroment by running:

  • FormacOS orLinux users

    source .venv/bin/activate
  • ForWindows users

    .venv\Scripts\activate

To installsbi run

uv add sbi

Testing 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 apositive and respectful community; please read ourCode ofConduct.

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

Thesbi package has grown and improved significantly since its initial release, withcontributions from a large and diverse community. To reflect these developments and theexpanded functionality, we published anupdated JOSSpaper. We encourage you to cite thisnewer version as the primary reference:

@article{BoeltsDeistler_sbi_2025,  doi = {10.21105/joss.07754},  url = {https://doi.org/10.21105/joss.07754},  year = {2025},  publisher = {The Open Journal},  volume = {10},  number = {108},  pages = {7754},  author = {Jan Boelts and Michael Deistler and Manuel Gloeckler and Álvaro Tejero-Cantero and Jan-Matthis Lueckmann and Guy Moss and Peter Steinbach and Thomas Moreau and Fabio Muratore and Julia Linhart and Conor Durkan and Julius Vetter and Benjamin Kurt Miller and Maternus Herold and Abolfazl Ziaeemehr and Matthijs Pals and Theo Gruner and Sebastian Bischoff and Nastya Krouglova and Richard Gao and Janne K. Lappalainen and Bálint Mucsányi and Felix Pei and Auguste Schulz and Zinovia Stefanidi and Pedro Rodrigues and Cornelius Schröder and Faried Abu Zaid and Jonas Beck and Jaivardhan Kapoor and David S. Greenberg and Pedro J. Gonçalves and Jakob H. Macke},  title = {sbi reloaded: a toolkit for simulation-based inference workflows},  journal = {Journal of Open Source Software}}

This updated paper, with its expanded author list, reflects the broader communitycontributions and the package's enhanced capabilities in releases0.23.0 and later.

If you are using a version ofsbi prior to 0.23.0, please cite the original sbisoftware 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}}

Regardless of which software paper you cite, please also remember to cite the originalresearch articles describing the specific sbi-algorithm(s) you are using.

Specific releases ofsbi are also citable viaZenodo, where we generate a new software DOI foreach release.

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

Contributors81

Languages


[8]ページ先頭

©2009-2025 Movatter.jp