• Stars
    star
    433
  • Rank 100,464 (Top 2 %)
  • Language
    Python
  • License
    GNU Affero Genera...
  • Created almost 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simulation-based inference toolkit

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 of the simulator, conditional on the observations. The package implements a variety of inference algorithms, including amortized and sequential methods. 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.

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)

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:

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 how sbi is working for your inference problems (see Discussions) and are happy to receive bug reports, pull requests and other feedback (see contribute). We wish to maintain a positive community, please read our Code of Conduct.

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 supported by the German Federal Ministry of Education and Research (BMBF) through the project ADIMEM, FKZ 01IS18052 A-D). ADIMEM is 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.

License

Affero General Public License v3 (AGPLv3)

Citation

If you use sbi consider citing the sbi 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 the sbi project and has a persistent DOI. Additionally, new releases of sbi are citable via Zenodo, where we create a new DOI for every release.

More Repositories

1

delfi

Density estimation likelihood-free inference. No longer actively developed see https://github.com/mackelab/sbi instead
Python
71
star
2

neural_timeseries_diffusion

This repository contains research code for the paper "Generating realistic neurophysiological time series with denoising diffusion probabilistic models".
Python
64
star
3

simformer

Combination of transformers and diffusion models for flexible all-in-one simulation-based inference
Jupyter Notebook
42
star
4

machine-learning-I

Slides and lecture notes for the course 'machine learning I' taught at the Graduate School Neural Information Processing in Tuebingen.
TeX
29
star
5

pyknos

don't regress
Python
24
star
6

autohmm

Hidden Markov Models (HMMs) with tied states and autoregressive observations
Python
22
star
7

CorBinian

CorBinian: A toolbox for modelling and simulating high-dimensional binary and count-data with correlations
MATLAB
19
star
8

poisson-gpfa

Gaussian process factor analysis with Poisson observations
Python
18
star
9

gatsbi

GATSBI: Generative Adversarial Training for Simulation-Based Inference
Python
17
star
10

mnle-for-ddms

Research code for Mixed Neural Likelihood Estimation (MNLE, Boelts et al. 2022)
Jupyter Notebook
17
star
11

multispike_tempotron

To identify features by aggregate-label learning in spiking neurons
Jupyter Notebook
14
star
12

smc_rnns

Code accompanying Inferring stochastic low-rank RNNs from neural data. @matthijspals
Jupyter Notebook
12
star
13

DeepSpike

Jupyter Notebook
9
star
14

neuralgbi

Richard @rdgao & Michael @michaeldeistler: using neural network-based regression and density estimation for Generalized Bayesian Inference
Jupyter Notebook
8
star
15

epiphyte

Python toolkit for working with high-dimensional neural data recorded during naturalistic, continuous stimuli @a-darcher @rachrapp
Jupyter Notebook
7
star
16

S3ID

subspace identficiation for partially observed high-dimensional data
Python
5
star
17

phase-limit-cycle-RNNs

Code for "Trained recurrent neural networks develop phase-locked limit cycles in a working memory task" - Matthijs Pals (@matthijspals) , Jakob Macke and Omri Barak.
Python
5
star
18

neuro-behavior-conditioning

Masked variational autoencoders for modeling conditional distributions of neural and behavioral data
Python
5
star
19

dg_python

Dichotomized Gaussian model implemented in python
Jupyter Notebook
5
star
20

msne-datascience-2020

Fundamentals of Computer Science for Computational Neuroengineering 2020
Jupyter Notebook
5
star
21

snvi_repo

Reproduce results from the SVNI paper, Glöckler et al. 2022, ICLR
Jupyter Notebook
4
star
22

msne-datascience-2018

Course material for the Fundamentals of Computer Science for Computational Neuroengineering course at TUM
HTML
4
star
23

apt_icml

Anonymized code for ICML 2019 submission
Python
4
star
24

grassmann_binary_distribution

Implementation of binary distribution in the Grassmann formalism, including conditional version. Main contributor: Cornelius Schröder (@coschroeder)
Jupyter Notebook
4
star
25

IdentifyMechanisticModels_2020

Code for "Training deep neural density estimators to identify mechanistic models of neural dynamics"
Jupyter Notebook
4
star
26

RABI

Code for robust amortized bayesian inference package
Jupyter Notebook
4
star
27

automind

Automated Model Inference from Neural Dynamics
Jupyter Notebook
4
star
28

labproject

Labproject about comparing distributions metrics by @mackelab
Python
3
star
29

ddm_stride

Pipeline for applying simulation-based inference to Drift-Diffusion Models
Jupyter Notebook
3
star
30

pyrnn

General code for training (biologically inspired) recurrent neural networks. Code by Matthijs Pals (@matthijspals)
Jupyter Notebook
3
star
31

pyloric

Simulator of the pyloric network in cython.
Jupyter Notebook
3
star
32

tsnpe_neurips

Code to reproduce results from `Truncated proposals for scalable and hassle-free simulation-based inference`
Jupyter Notebook
3
star
33

msne-lsmlsda-2019

Programming exercises and mini-projects for LSMLSDA course, summer semester 2019
Jupyter Notebook
3
star
34

sbi_AIMS

Public repository for the sbi course at AIMS 2024
Jupyter Notebook
3
star
35

amortized-decision-making

Repository for the paper "Amortized Bayesian Decision Making for simulation-based models" - Mila @milagorecki and Michael @michaeldeistler
Jupyter Notebook
3
star
36

sbi-for-connectomics

Research code and results for the paper "Simulation-based inference for computational connectomics" (Boelts et al. 2023 PLoS CB, @janfb)
Jupyter Notebook
3
star
37

gp-maps-python

Gaussian process method for inferring cortical maps (Python version), code by Dominik Straub @dominikstrb
Python
2
star
38

critical_retina

Code and data for 'Signatures of criticality arise in simple neural populations models with correlations'
MATLAB
2
star
39

sequence-memory

Code for Liebe et al. "Phase of firing does not reflect temporal order in sequence memory of humans and recurrent neural networks", code by Matthijs Pals (@matthijspals)
Jupyter Notebook
2
star
40

msne-datascience-2019

Fundamentals of Computer Science for Computational Neuroengineering
Jupyter Notebook
2
star
41

DECODE

by @aspeiser
Jupyter Notebook
2
star
42

simulation_based_model_inference

Repository for the paper "Simultaneous identification of models and parameters of scientific simulators" -- Cornelius: @coschroeder
Jupyter Notebook
1
star
43

sourcerer

Code for the preprint "Sourcerer: Sample-based Maximum Entropy Source Distribution Estimation"
Python
1
star
44

pyLDS_dev

large-scale implementation of the expectation-maximisation algoithm in python for the linear dynamical system
Jupyter Notebook
1
star
45

neonatal_apnea_prediction

Neonatal apnea and hypopnea prediction in infants with Robin sequence with neural additive models for time series.
Python
1
star
46

spikefinder_SV-DeepSpike

Code for submission of Speiser et al to spike-finder-challenge 2017
Jupyter Notebook
1
star
47

LDNS

1
star
48

lsmlsda2020

Repo for students of the class 'Large Scale Modelling and Large Scale Data Analysis'
Jupyter Notebook
1
star
49

sinn

A library for both Simulation and INference of dynamical systems. Maintained by @alcrene
Python
1
star
50

open-comp-neuro

A first start as a resource for pooling lecture materials for computational neuroscience course
Jupyter Notebook
1
star
51

STG_energy

Repo for STG energy paper. Michael (@michaeldeistler) and Pedro (@ppjgoncalves).
Jupyter Notebook
1
star
52

mesoGIF

This repository archives the code used to obtain the results in René et al., 2020. Maintainer: @alcrene
Jupyter Notebook
1
star
53

sbi-ice

Simulation-Based Inference of Surface Accumulation and Basal Melt Rates of an Antarctic Ice Shelf from Isochronal Layers
Python
1
star
54

lfi-experiments

Applications of likelihoodfree to different problems
Jupyter Notebook
1
star