Universal scalable simulation-based inference with TMNRE (Truncated Marginal Neural Ratio Estimation) and pytorch-lightning.


Keywords
likelihood-free-inference, machine-learning, marginal-neural-ratio-estimation, neural-ratio-estimation, parameter-estimation, python, pytorch, simulation-based-inference, truncated-neural-ratio-estimation
License
MIT
Install
pip install swyft==0.4.5

Documentation

Swyft

https://raw.githubusercontent.com/undark-lab/swyft/v0.4.1/docs/source/_static/img/swyft_logo_wide.png

Swyft is a system for scientific simulation-based inference at scale.

PyPI version codecov

Swyft is the official implementation of Truncated Marginal Neural Ratio Estimation (TMNRE), a hyper-efficient, simulation-based inference technique for complex data and expensive simulators.

Swyft in action

https://raw.githubusercontent.com/undark-lab/swyft/v0.4.1/docs/source/_static/img/SBI-curve.gif

  • Swyft makes it convenient to perform Bayesian or Frequentist inference of hundreds, thousands or millions of parameter posteriors by constructing optimal data summaries.
  • To this end, Swyft estimates likelihood-to-evidence ratios for arbitrary marginal posteriors; they typically require fewer simulations than the corresponding joint.
  • Swyft performs targeted inference by prior truncation, combining simulation efficiency with empirical testability.
  • Swyft is based on stochastic simulators, which map parameters stochastically to observational data. Swyft makes it convenient to define such simulators as graphical models.
  • In scientific settings, a cost-benefit analysis often favors approximating the posterior marginality; swyft provides this functionality.
  • The package additionally implements our prior truncation technique, routines to empirically test results by estimating the expected coverage, and a simulator manager with zarr storage to simplify use with complex simulators.

Papers using Swyft/TMNRE

2021

2022

2023

Further information

Swyft history

Relevant packages

  • sbi is a collection of simulation-based inference methods. Unlike Swyft, the repository does not include our truncation scheme nor marginal estimation of posteriors.
  • lampe is an implementation of amoritzed simulation-based inference methods aimed at simulation-based inference researchers due to its flexibility.