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.
In general, we use pull requests to make changes to
sbi. So, if you are planning to
make a contribution, please fork, create a feature branch and then make a PR from
your feature branch to the upstream
sbi (more details).
Clone the repo and install all the dependencies using
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
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/your_algorithm.py. 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.
SNRE all share the
NeuralPosterior class in
sbi/inference/posterior.py, but future versions of
sbi will refactor them into
For docstrings and comments, we use Google Style.
Code needs to pass through the following tools, which are installed alongside
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
pyright: Used for static type checking.
pyright are checked as part of our CI actions. If these
checks fail please make sure you have installed the latest versions for each of them
and run them locally.
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.