{"id":13699452,"url":"https://github.com/sbi-dev/sbi","last_synced_at":"2025-07-15T10:02:29.668Z","repository":{"id":37234597,"uuid":"239769118","full_name":"sbi-dev/sbi","owner":"sbi-dev","description":"Simulation-based inference toolkit","archived":false,"fork":false,"pushed_at":"2024-10-19T10:58:04.000Z","size":99633,"stargazers_count":581,"open_issues_count":38,"forks_count":150,"subscribers_count":21,"default_branch":"main","last_synced_at":"2024-10-20T06:36:42.612Z","etag":null,"topics":["bayesian-inference","likelihood-free-inference","machine-learning","parameter-estimation","pytorch","simulation-based-inference"],"latest_commit_sha":null,"homepage":"https://sbi-dev.github.io/sbi/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sbi-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":"codemeta.json"}},"created_at":"2020-02-11T13:31:28.000Z","updated_at":"2024-10-19T10:55:24.000Z","dependencies_parsed_at":"2023-10-05T04:54:04.750Z","dependency_job_id":"39fc5873-aac0-48af-bf10-c6a61304dd6e","html_url":"https://github.com/sbi-dev/sbi","commit_stats":{"total_commits":1019,"total_committers":52,"mean_commits":"19.596153846153847","dds":0.7762512266928361,"last_synced_commit":"c607e9ade72d1efd501cce0c0a43ba4a07068fa7"},"previous_names":["sbi-dev/sbi","mackelab/sbi"],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbi-dev%2Fsbi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbi-dev%2Fsbi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbi-dev%2Fsbi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbi-dev%2Fsbi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbi-dev","download_url":"https://codeload.github.com/sbi-dev/sbi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224398825,"owners_count":17304661,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bayesian-inference","likelihood-free-inference","machine-learning","parameter-estimation","pytorch","simulation-based-inference"],"created_at":"2024-08-02T20:00:33.589Z","updated_at":"2025-05-04T16:34:17.682Z","avatar_url":"https://github.com/sbi-dev.png","language":"Python","readme":"[![PyPI version](https://badge.fury.io/py/sbi.svg)](https://badge.fury.io/py/sbi)\n[![Conda Version](https://img.shields.io/conda/vn/conda-forge/sbi.svg)](https://github.com/conda-forge/sbi-feedstock)\n[![Contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/sbi-dev/sbi/blob/master/CONTRIBUTING.md)\n[![Tests](https://github.com/sbi-dev/sbi/actions/workflows/ci.yml/badge.svg)](https://github.com/sbi-dev/sbi/actions)\n[![codecov](https://codecov.io/gh/sbi-dev/sbi/branch/main/graph/badge.svg)](https://codecov.io/gh/sbi-dev/sbi)\n[![GitHub license](https://img.shields.io/github/license/sbi-dev/sbi)](https://github.com/sbi-dev/sbi/blob/master/LICENSE.txt)\n[![DOI](https://joss.theoj.org/papers/10.21105/joss.07754/status.svg)](https://doi.org/10.21105/joss.07754)\n[![NumFOCUS affiliated](https://camo.githubusercontent.com/a0f197cee66ccd8ed498cf64e9f3f384c78a072fe1e65bada8d3015356ac7599/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4e756d464f4355532d616666696c696174656425323070726f6a6563742d6f72616e67652e7376673f7374796c653d666c617426636f6c6f72413d45313532334426636f6c6f72423d303037443841)](https://numfocus.org/sponsored-projects/affiliated-projects)\n\n## `sbi`: Simulation-Based Inference\n\n[Getting Started](https://sbi-dev.github.io/sbi/latest/tutorials/00_getting_started/) |\n[Documentation](https://sbi-dev.github.io/sbi/) | [Discord Server](https://discord.gg/eEeVPSvWKy)\n\n`sbi` is a Python package for simulation-based inference, designed to meet the needs of\nboth researchers and practitioners. Whether you need fine-grained control or an\neasy-to-use interface, `sbi` has you covered.\n\nWith `sbi`, you can perform parameter inference using Bayesian inference: Given a\nsimulator that models a real-world process, SBI estimates the full posterior\ndistribution over the simulator’s parameters based on observed data. This distribution\nindicates the most likely parameter values while additionally quantifying uncertainty\nand revealing potential interactions between parameters.\n\n### Key Features of `sbi`\n\n`sbi` offers a blend of flexibility and ease of use:\n\n- **Low-Level Interfaces**: For those who require maximum control over the inference\n  process, `sbi` provides low-level interfaces that allow you to fine-tune many aspects\n  of your workflow.\n- **High-Level Interfaces**: If you prefer simplicity and efficiency, `sbi` also offers\n  high-level interfaces that enable quick and easy implementation of complex inference\n  tasks.\n\nIn addition, `sbi` supports a wide range of state-of-the-art inference algorithms (see\nbelow for a list of implemented methods):\n\n- **Amortized Methods**: These methods enable the reuse of posterior estimators across\n  multiple observations without the need to retrain.\n- **Sequential Methods**: These methods focus on individual observations, optimizing the\n  number of simulations required.\n\nBeyond inference, `sbi` also provides:\n\n- **Validation Tools**: Built-in methods to validate and verify the accuracy of your\n  inferred posteriors.\n- **Plotting and Analysis Tools**: Comprehensive functions for visualizing and analyzing\n  results, helping you interpret the posterior distributions with ease.\n\nGetting started with `sbi` is straightforward, requiring only a few lines of code:\n\n```python\nfrom sbi.inference import NPE\n# Given: parameters theta and corresponding simulations x\ninference = NPE(prior=prior)\ninference.append_simulations(theta, x).train()\nposterior = inference.build_posterior()\n```\n\n### Installation\n\n`sbi` requires Python 3.10 or higher. While a GPU isn't necessary, it can improve\nperformance in some cases. We recommend using a virtual environment with\n[`conda`](https://docs.conda.io/en/latest/miniconda.html) for an easy setup.\n\nIf `conda` is installed on the system, an environment for installing `sbi` can be created as follows:\n\n```bash\nconda create -n sbi_env python=3.10 \u0026\u0026 conda activate sbi_env\n```\n\n### From PyPI\n\nTo install `sbi` from PyPI run\n\n```bash\npython -m pip install sbi\n```\n\n### From conda-forge\n\nTo install and add `sbi` to a project with [`pixi`](https://pixi.sh/), from the project directory run\n\n```bash\npixi add sbi\n```\n\nand to install into a particular conda environment with [`conda`](https://docs.conda.io/projects/conda/), in the activated environment run\n\n```bash\nconda install --channel conda-forge sbi\n```\n\nIf [`uv`](http://docs.astral.sh/uv/) is installed on the system, an environment for installing `sbi` can be created as follows:\n\n```bash\nuv venv -p 3.10\n```\n\nThen activate the virtual enviroment by running:\n\n- For `macOS` or `Linux` users\n  ```bash\n  source .venv/bin/activate\n  ```\n\n- For `Windows` users\n  ```bash\n  .venv\\Scripts\\activate\n  ```\n\nTo install `sbi` run\n\n```bash\nuv add sbi\n```\n\n### Testing the installation\n\nOpen a Python prompt and run\n\n```python\nfrom sbi.examples.minimal import simple\nposterior = simple()\nprint(posterior)\n```\n\n## Tutorials\n\nIf you're new to `sbi`, we recommend starting with our [Getting\nStarted](https://sbi-dev.github.io/sbi/latest/tutorials/00_getting_started/) tutorial.\n\nYou can also access and run these tutorials directly in your browser by opening\n[Codespace](https://docs.github.com/en/codespaces/overview). To do so, click the green\n“Code” button on the GitHub repository and select “Open with Codespaces.” This provides\na fully functional environment where you can explore `sbi` through Jupyter notebooks.\n\n## Inference Algorithms\n\nThe following inference algorithms are currently available. You can find instructions on\nhow to run each of these methods\n[here](https://sbi-dev.github.io/sbi/latest/tutorials/16_implemented_methods/).\n\n### Neural Posterior Estimation: amortized (NPE) and sequential (SNPE)\n\n- [`(S)NPE_A`](https://sbi-dev.github.io/sbi/latest/reference/#sbi.inference.trainers.npe.npe_a.NPE_A)\n  (including amortized single-round `NPE`) from Papamakarios G and Murray I [_Fast\n  ε-free Inference of Simulation Models with Bayesian Conditional Density\n  Estimation_](https://proceedings.neurips.cc/paper/2016/hash/6aca97005c68f1206823815f66102863-Abstract.html)\n  (NeurIPS 2016).\n\n- [`(S)NPE_B`](https://sbi-dev.github.io/sbi/latest/reference/#sbi.inference.trainers.npe.npe_b.NPE_B)\n  from Lueckmann JM, Goncalves P, Bassetto G, Öcal K, Nonnenmacher M, and Macke J [_Flexible\n  statistical inference for mechanistic models of neural dynamics_](https://arxiv.org/abs/1711.01861)\n  (NeurIPS 2017).\n\n- [`(S)NPE_C`](https://sbi-dev.github.io/sbi/latest/reference/#sbi.inference.trainers.npe.npe_c.NPE_C)\n  or `APT` from Greenberg D, Nonnenmacher M, and Macke J [_Automatic Posterior\n  Transformation for likelihood-free inference_](https://arxiv.org/abs/1905.07488) (ICML\n  2019).\n\n- `TSNPE` from Deistler M, Goncalves P, and Macke J [_Truncated proposals for scalable\n  and hassle-free simulation-based inference_](https://arxiv.org/abs/2210.04815)\n  (NeurIPS 2022).\n\n- [`FMPE`](https://sbi-dev.github.io/sbi/latest/reference/#sbi.inference.trainers.fmpe.fmpe.FMPE)\n  from Wildberger, J., Dax, M., Buchholz, S., Green, S., Macke, J. H., \u0026 Schölkopf, B.\n  [_Flow matching for scalable simulation-based\n  inference_](https://proceedings.neurips.cc/paper_files/paper/2023/hash/3663ae53ec078860bb0b9c6606e092a0-Abstract-Conference.html).\n  (NeurIPS 2023).\n\n- [`NPSE`](https://sbi-dev.github.io/sbi/latest/reference/#sbi.inference.trainers.npse.npse.NPSE) from\n  Geffner, T., Papamakarios, G., \u0026 Mnih, A. [_Compositional score modeling for\n  simulation-based inference_](https://proceedings.mlr.press/v202/geffner23a.html).\n  (ICML 2023)\n\n### Neural Likelihood Estimation: amortized (NLE) and sequential (SNLE)\n\n- [`(S)NLE`](https://sbi-dev.github.io/sbi/latest/reference/#sbi.inference.trainers.nle.nle_a.NLE_A)\n  or just `SNL` from Papamakarios G, Sterrat DC and Murray I [_Sequential Neural\n  Likelihood_](https://arxiv.org/abs/1805.07226) (AISTATS 2019).\n\n### Neural Ratio Estimation: amortized (NRE) and sequential (SNRE)\n\n- [`(S)NRE_A`](https://sbi-dev.github.io/sbi/latest/reference/#sbi.inference.trainers.nre.nre_a.NRE_A)\n  or `AALR` from Hermans J, Begy V, and Louppe G. [_Likelihood-free Inference with\n  Amortized Approximate Likelihood Ratios_](https://arxiv.org/abs/1903.04057) (ICML\n  2020).\n\n- [`(S)NRE_B`](https://sbi-dev.github.io/sbi/latest/reference/#sbi.inference.trainers.nre.nre_b.NRE_B)\n  or `SRE` from Durkan C, Murray I, and Papamakarios G. [_On Contrastive Learning for\n  Likelihood-free Inference_](https://arxiv.org/abs/2002.03712) (ICML 2020).\n\n- [`(S)NRE_C`](https://sbi-dev.github.io/sbi/latest/reference/#sbi.inference.trainers.nre.nre_c.NRE_C)\n  or `NRE-C` from Miller BK, Weniger C, Forré P. [_Contrastive Neural Ratio\n  Estimation_](https://arxiv.org/abs/2210.06170) (NeurIPS 2022).\n\n- [`BNRE`](https://sbi-dev.github.io/sbi/latest/reference/#sbi.inference.trainers.nre.bnre.BNRE) from\n  Delaunoy A, Hermans J, Rozet F, Wehenkel A, and Louppe G. [_Towards Reliable\n  Simulation-Based Inference with Balanced Neural Ratio\n  Estimation_](https://arxiv.org/abs/2208.13624) (NeurIPS 2022).\n\n### Neural Variational Inference, amortized (NVI) and sequential (SNVI)\n\n- [`SNVI`](https://sbi-dev.github.io/sbi/latest/reference/#sbi.inference.posteriors.vi_posterior)\n  from Glöckler M, Deistler M, Macke J, [_Variational methods for simulation-based\n  inference_](https://openreview.net/forum?id=kZ0UYdhqkNY) (ICLR 2022).\n\n### Mixed Neural Likelihood Estimation (MNLE)\n\n- [`MNLE`](https://sbi-dev.github.io/sbi/latest/reference/#sbi.inference.trainers.nle.mnle.MNLE) from\n  Boelts J, Lueckmann JM, Gao R, Macke J, [_Flexible and efficient simulation-based\n  inference for models of decision-making_](https://elifesciences.org/articles/77220)\n  (eLife 2022).\n\n## Feedback and Contributions\n\nWe welcome any feedback on how `sbi` is working for your inference problems (see\n[Discussions](https://github.com/sbi-dev/sbi/discussions)) and are happy to receive bug\nreports, pull requests, and other feedback (see\n[contribute](https://sbi-dev.github.io/sbi/latest/contribute/)). We wish to maintain a\npositive and respectful community; please read our [Code of\nConduct](CODE_OF_CONDUCT.md).\n\n## Acknowledgments\n\n`sbi` is the successor (using PyTorch) of the\n[`delfi`](https://github.com/mackelab/delfi) package. It started as a fork of Conor M.\nDurkan's `lfi`. `sbi` runs as a community project. See also\n[credits](https://github.com/sbi-dev/sbi/blob/master/docs/docs/credits.md).\n\n## Support\n\n`sbi` has been supported by the German Federal Ministry of Education and Research (BMBF)\nthrough project ADIMEM (FKZ 01IS18052 A-D), project SiMaLeSAM (FKZ 01IS21055A) and the\nTübingen AI Center (FKZ 01IS18039A). Since 2024, `sbi` is supported by the appliedAI\nInstitute for Europe, and by NumFOCUS.\n\n## License\n\n[Apache License Version 2.0 (Apache-2.0)](https://www.apache.org/licenses/LICENSE-2.0)\n\n## Citation\n\nThe `sbi` package has grown and improved significantly since its initial release, with\ncontributions from a large and diverse community. To reflect these developments and the\nexpanded functionality, we published an [updated JOSS\npaper](https://doi.org/10.21105/joss.07754). We encourage you to cite this\nnewer version as the primary reference:\n\n```latex\n@article{BoeltsDeistler_sbi_2025,\n  doi = {10.21105/joss.07754},\n  url = {https://doi.org/10.21105/joss.07754},\n  year = {2025},\n  publisher = {The Open Journal},\n  volume = {10},\n  number = {108},\n  pages = {7754},\n  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},\n  title = {sbi reloaded: a toolkit for simulation-based inference workflows},\n  journal = {Journal of Open Source Software}\n}\n```\n\nThis updated paper, with its expanded author list, reflects the broader community\ncontributions and the package's enhanced capabilities in releases\n[0.23.0](https://github.com/sbi-dev/sbi/releases/tag/v0.23.3) and later.\n\nIf you are using a version of `sbi` prior to 0.23.0, please cite the original sbi\nsoftware paper:\n\n```latex\n@article{tejero-cantero2020sbi,\n  doi = {10.21105/joss.02505},\n  url = {https://doi.org/10.21105/joss.02505},\n  year = {2020},\n  publisher = {The Open Journal},\n  volume = {5},\n  number = {52},\n  pages = {2505},\n  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},\n  title = {sbi: A toolkit for simulation-based inference},\n  journal = {Journal of Open Source Software}\n}\n```\n\nRegardless of which software paper you cite, please also remember to cite the original\nresearch articles describing the specific sbi-algorithm(s) you are using.\n\nSpecific releases of `sbi` are also citable via\n[Zenodo](https://zenodo.org/records/15034786), where we generate a new software DOI for\neach release.\n","funding_links":[],"categories":["\u003cspan id=\"head30\"\u003e3.4. Bayesian Inference\u003c/span\u003e","Software","Python"],"sub_categories":["\u003cspan id=\"head32\"\u003e3.4.2. Approximate Bayesian Computation (ABC)\u003c/span\u003e"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbi-dev%2Fsbi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbi-dev%2Fsbi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbi-dev%2Fsbi/lists"}