Skip to content


User experiences, bugs, and feature requests

If you are using sbi to infer the parameters of a simulator, we would be delighted to know how it worked for you. If it didn’t work according to plan, please open up an issue and tell us more about your use case: the dimensionality of the input parameters and of the output, as well as the setup you used to run inference (i.e. number of simulations, number of rounds,…).

To report bugs and suggest features (including better documentation), please equally head over to issues on GitHub.

Code contributions

In general, we use pull requests to make changes to sbi.

Development environment

Clone the repo and install all the dependencies using the environment.yml file to create a conda environment: conda env create -f environment.yml. If you already have an sbi environment and want to refresh dependencies, just run conda env update -f environment.yml --prune.

Alternatively, you can install via using pip install -e ".[dev]" (the dev flag installs development and testing dependencies).

Contributing inference algorithms

sbi was developed to be extensible and we welcome implementations of additional inference algorithms. Your new inference algorithm should be a class in sbi/inference/your_type_of_algorithm/ The class should have a __call__() function which runs inference and returns a posterior object. The posterior object itself should have a .sample() function following the signature of sbi/inference/NeuralPosterior, allowing to draw samples from the posterior. Currently, SNPE, SNLE, and SNRE all share the NeuralPosterior class in sbi/inference/, but future versions of sbi will refactor them into separate classes.

Style conventions

For docstrings and comments, we use Google Style.

Code needs to pass through the following tools, which are installed alongside sbi:

black: Automatic code formatting for Python. You can run black manually from the console using black . in the top directory of the repository, which will format all files.

isort: Used to consistently order imports. You can run isort manually from the console using isort in the top directory.

Online documentation

Most of the documentation is written in markdown (basic markdown guide).

You can directly fix mistakes and suggest clearer formulations in markdown files simply by initiating a PR on through GitHub. Click on documentation file and look for the little pencil at top right.