Package: sbi
sbi: simulation-based inferenceGetting Started|Documentationsbiis a PyTorch package for simulation-based inference. Simulation-based inference is the process of finding parameters of a simulator from observations.sbitakes a Bayesian approach and returns a full posterior distribution over the parameters of the simulator, conditional on the observations.
The package implements a variety of inference algorithms, includingamortizedandsequentialmethods.
Amortized methods return a posterior that can be applied to many different observations without retraining; sequential methods focus the inference on one particular observation to be more simulation-efficient.
See below for an overview of implemented methods.sbioffers a simple interface for one-line posterior inference:fromsbi.inferenceimportinfer# import your simulator, define your prior over the parametersparameter_posterior=infer(simulator,prior,method='SNPE',num_simulations=100)Installationsbirequires Python 3.6 or higher. We recommend to use acondavirtual
environment (Miniconda installation instructions). Ifcondais installed on the system, an environment for
installingsbican 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_envIndependent of whether you are usingcondaor not,sbican be installed usingpip:pip install sbiTo test the installation, drop into a python prompt and runfromsbi.examples.minimalimportsimpleposterior=simple()print(posterior)Inference AlgorithmsThe following algorithms are currently available. You can find a tutorial on how to run each of these methodshere.Neural Posterior Estimation: amortized (NPE) and sequential (SNPE)SNPE_A(including amortized single-roundNPE) from Papamakarios G and Murray IFast ε-free Inference of Simulation Models with Bayesian Conditional Density Estimation(NeurIPS 2016).SNPE_CorAPTfrom Greenberg D, Nonnenmacher M, and Macke JAutomatic
Posterior Transformation for likelihood-free
inference(ICML 2019).TSNPEfrom Deistler M, Goncalves P, and Macke JTruncated proposals for scalable and hassle-free simulation-based inference(NeurIPS 2022).Neural Likelihood Estimation: amortized (NLE) and sequential (SNLE)SNLE_Aor justSNLfrom Papamakarios G, Sterrat DC and Murray ISequential
Neural Likelihood(AISTATS 2019).Neural Ratio Estimation: amortized (NRE) and sequential (SNRE)(S)NRE_AorAALRfrom Hermans J, Begy V, and Louppe G.Likelihood-free Inference with Amortized Approximate Likelihood Ratios(ICML 2020).(S)NRE_BorSREfrom Durkan C, Murray I, and Papamakarios G.On Contrastive Learning for Likelihood-free Inference(ICML 2020).BNREfrom Delaunoy A, Hermans J, Rozet F, Wehenkel A, and Louppe G.Towards Reliable Simulation-Based Inference with Balanced Neural Ratio Estimation(NeurIPS 2022).(S)NRE_CorNRE-Cfrom Miller BK, Weniger C, Forré P.Contrastive Neural Ratio Estimation(NeurIPS 2022).Neural Variational Inference, amortized (NVI) and sequential (SNVI)SNVIfrom Glöckler M, Deistler M, Macke J,Variational methods for simulation-based inference(ICLR 2022).Mixed Neural Likelihood Estimation (MNLE)MNLEfrom Boelts J, Lueckmann JM, Gao R, Macke J,Flexible and efficient simulation-based inference for models of decision-making(eLife 2022).Feedback and ContributionsWe welcome any feedback on howsbiis working for your inference problems (seeDiscussions) and are happy to receive bug reports, pull requests and other feedback (seecontribute).
We wish to maintain a positive community, please read ourCode of Conduct.Acknowledgementssbiis the successor (using PyTorch) of thedelfipackage. It was started as a fork of Conor
M. Durkan'slfi.sbiruns as a community project; development is coordinated at themackelab. See alsocredits.Supportsbihas been supported by the German Federal Ministry of Education and Research (BMBF) through the project ADIMEM, FKZ 01IS18052 A-D).ADIMEMis a collaborative project between the groups of Jakob Macke (Uni Tübingen), Philipp Berens (Uni Tübingen), Philipp Hennig (Uni Tübingen) and Marcel Oberlaender (caesar Bonn) which aims to develop inference methods for mechanistic models.LicenseAffero General Public License v3 (AGPLv3)CitationIf you usesbiconsider citing thesbi software paper, in addition to the original research articles 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 thesbiproject and has a persistent DOI.
Additionally, new releases ofsbiare citable viaZenodo, where we create a new DOI for every release.