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.
Documentation & installation: https://swyft.readthedocs.io/en/latest/
Source code: https://github.com/undark-lab/swyft
Support & discussion: https://github.com/undark-lab/swyft/discussions
Bug reports: https://github.com/undark-lab/swyft/issues
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.
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.