swyft lightning

PyPI version codecov https://joss.theoj.org/papers/10.21105/joss.04205/status.svg https://zenodo.org/badge/DOI/10.5281/zenodo.5752734.svg

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.

Note

As of v0.4.0, swyft will be based on pytorch-lightning, and the entire API will be overhauled. Right now v0.4.0 is still in pre-release, and documentation is not yet fully updated.

swyft:

  • estimates likelihood-to-evidence ratios for arbitrary marginal posteriors; they typically require fewer simulations than the corresponding joint.

  • performs targeted inference by prior truncation, combining simulation efficiency with empirical testability.

  • seamless reuses simulations drawn from previous analyses, even with different priors. (not yet supported in swyft lightning, see v0.3.2)

  • integrates dask and zarr to make complex simulation easy. (not yet supported in swyft lightning, see v0.3.2)

swyft is designed to solve the Bayesian inverse problem when the user has access to a simulator that stochastically maps parameters to observational data. 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 dask simulator manager with zarr storage to simplify use with complex simulators.