swyft

swyft: Truncated Marginal Neural Ratio Estimation in Python - Published in JOSS (2022)

https://github.com/undark-lab/swyft

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 8 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: arxiv.org, joss.theoj.org, zenodo.org
  • Committers with academic emails
    2 of 17 committers (11.8%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

likelihood-free-inference machine-learning marginal-neural-ratio-estimation neural-ratio-estimation parameter-estimation python pytorch simulation-based-inference truncated-neural-ratio-estimation
Last synced: 4 months ago · JSON representation

Repository

A system for scientific simulation-based inference at scale.

Basic Info
  • Host: GitHub
  • Owner: undark-lab
  • License: other
  • Language: Jupyter Notebook
  • Default Branch: master
  • Homepage:
  • Size: 380 MB
Statistics
  • Stars: 164
  • Watchers: 10
  • Forks: 16
  • Open Issues: 20
  • Releases: 19
Topics
likelihood-free-inference machine-learning marginal-neural-ratio-estimation neural-ratio-estimation parameter-estimation python pytorch simulation-based-inference truncated-neural-ratio-estimation
Created over 5 years ago · Last pushed over 1 year ago
Metadata Files
Readme Contributing License Authors

README.rst

Swyft
=====

.. image:: https://raw.githubusercontent.com/undark-lab/swyft/v0.4.1/docs/source/_static/img/swyft_logo_wide.png
   :width: 800
   :align: center

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

.. image:: https://badge.fury.io/py/swyft.svg
   :target: https://badge.fury.io/py/swyft
   :alt: PyPI version


.. .. image:: https://github.com/undark-lab/swyft/actions/workflows/tests.yml/badge.svg
..    :target: https://github.com/undark-lab/swyft/actions
..    :alt: Tests


.. .. image:: https://github.com/undark-lab/swyft/actions/workflows/syntax.yml/badge.svg
..    :target: https://github.com/undark-lab/swyft/actions
..    :alt: Syntax


.. image:: https://codecov.io/gh/undark-lab/swyft/branch/master/graph/badge.svg?token=E253LRJWWE
   :target: https://codecov.io/gh/undark-lab/swyft
   :alt: codecov


.. .. image:: https://readthedocs.org/projects/swyft/badge/?version=latest
..    :target: https://swyft.readthedocs.io/en/latest/?badge=latest
..    :alt: Documentation Status


.. .. image:: https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat
..    :target: https://github.com/undark-lab/swyft/blob/master/CONTRIBUTING.md
..    :alt: Contributions welcome


.. .. image:: https://colab.research.google.com/assets/colab-badge.svg
..    :target: https://colab.research.google.com/github/undark-lab/swyft/blob/master/notebooks/Quickstart.ipynb
..    :alt: colab


.. image:: https://joss.theoj.org/papers/10.21105/joss.04205/status.svg
   :target: https://doi.org/10.21105/joss.04205


.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5752734.svg
   :target: https://doi.org/10.5281/zenodo.5752734


*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
---------------


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



* 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

- “Fast and Credible Likelihood-Free Cosmology with Truncated Marginal Neural Ratio Estimation“ Cole+ https://arxiv.org/abs/2111.08030

2022

- “Estimating the warm dark matter mass from strong lensing images with truncated marginal neural ratio estimation” Anau Montel+, https://arxiv.org/abs/2205.09126
- “SICRET: Supernova Ia Cosmology with truncated marginal neural Ratio EsTimation” Karchev+ https://arxiv.org/abs/2209.06733
- “One never walks alone: the effect of the perturber population on subhalo measurements in strong gravitational lenses” Coogan+ https://arxiv.org/abs/2209.09918
- “Detection is truncation: studying source populations with truncated marginal neural ratio estimation” Anau Montel+ https://arxiv.org/abs/2211.04291

2023

- “Debiasing Standard Siren Inference of the Hubble Constant with Marginal Neural Ratio Estimation” Gagnon-Hartman+ https://arxiv.org/abs/2301.05241
- “Constraining the X-ray heating and reionization using 21-cm power spectra with Marginal Neural Ratio Estimation” Saxena+ https://arxiv.org/abs/2303.07339
- “Peregrine: Sequential simulation-based inference for gravitational wave signals”, Bhardwaj+ https://arxiv.org/abs/2304.02035
- “Albatross: A scalable simulation-based inference pipeline for analysing stellar streams in the Milky Way”, Alvey+ https://arxiv.org/abs/2304.02032


Further information
-------------------

* **Documentation & installation**: https://swyft.readthedocs.io/
* **Example usage**: https://swyft.readthedocs.io/en/latest/tutorial-notebooks.html
* **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
* **Contributing**: https://swyft.readthedocs.io/en/latest/contributing-link.html
* **Citation**: https://swyft.readthedocs.io/en/latest/citation.html


*Swyft* history
---------------

* As of v0.4.0, *Swyft* is based on pytorch-lightning, with a completely updated
* `v0.3.2 `_ is the version that was submitted to `JOSS `_.
* `tmnre `_ is the implementation of the paper `Truncated Marginal Neural Ratio Estimation `_.
* `v0.1.2 `_ is the implementation of the paper `Simulation-efficient marginal posterior estimation with swyft: stop wasting your precious time `_.

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.

Owner

  • Name: UnDark Lab
  • Login: undark-lab
  • Kind: organization
  • Email: c.weniger@uva.nl
  • Location: Netherlands

Exploring the Dark Universe with Deep Learning

JOSS Publication

swyft: Truncated Marginal Neural Ratio Estimation in Python
Published
July 19, 2022
Volume 7, Issue 75, Page 4205
Authors
Benjamin Kurt Miller ORCID
Gravitation Astroparticle Physics Amsterdam (GRAPPA), University of Amsterdam, Science Park 904, 1098 XH Amsterdam, Amsterdam Machine Learning Lab (AMLab), University of Amsterdam, Science Park 904, 1098 XH Amsterdam, AI4Science Lab, University of Amsterdam, Science Park 904, 1098 XH Amsterdam
Alex Cole ORCID
Gravitation Astroparticle Physics Amsterdam (GRAPPA), University of Amsterdam, Science Park 904, 1098 XH Amsterdam
Christoph Weniger ORCID
Gravitation Astroparticle Physics Amsterdam (GRAPPA), University of Amsterdam, Science Park 904, 1098 XH Amsterdam
Francesco Nattino ORCID
Netherlands eScience Center, Science Park 140, 1098 XG Amsterdam, The Netherlands
Ou Ku ORCID
Netherlands eScience Center, Science Park 140, 1098 XG Amsterdam, The Netherlands
Meiert W. Grootes ORCID
Netherlands eScience Center, Science Park 140, 1098 XG Amsterdam, The Netherlands
Editor
Pierre de Buyl ORCID
Tags
simulation-based inference likelihood-free inference machine learning bayesian inference system identification parameter identification inverse problem

GitHub Events

Total
  • Issues event: 2
  • Watch event: 5
  • Issue comment event: 1
  • Fork event: 3
Last Year
  • Issues event: 2
  • Watch event: 5
  • Issue comment event: 1
  • Fork event: 3

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 1,095
  • Total Committers: 17
  • Avg Commits per committer: 64.412
  • Development Distribution Score (DDS): 0.482
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Christoph Weniger c****r@u****l 567
bkmi 1****i 323
Francesco Nattino f****o@e****l 79
Alex Cole a****1@g****m 34
rogerkuou r****u@g****m 33
Christoph Weniger w****r@t****l 21
Meiert Grootes m****s@e****l 12
Christoph Weniger c****r@f****r 5
Noemi Anau Montel n****l@g****m 4
Adam Coogan d****n@g****m 4
Alex Cole a****e@f****r 3
Adam Coogan a****n@a****n 2
Alex Cole a****e@A****l 2
Christoph Weniger c****r@c****e 2
Christoph Weniger c****r@s****l 2
Alexander Cole a****1@t****l 1
Anchal Saxena 7****9 1

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 80
  • Total pull requests: 47
  • Average time to close issues: 6 months
  • Average time to close pull requests: 19 days
  • Total issue authors: 14
  • Total pull request authors: 8
  • Average comments per issue: 1.8
  • Average comments per pull request: 1.04
  • Merged pull requests: 44
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 3
  • Pull request authors: 0
  • Average comments per issue: 0.33
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • bkmi (33)
  • cweniger (22)
  • GertKl (4)
  • fnattino (3)
  • adam-coogan (3)
  • CHBKoenders (3)
  • samgagnon (2)
  • rogerkuou (2)
  • elidub (1)
  • g-puleo (1)
  • WangYun1995 (1)
  • Haowen-Zhong (1)
  • NoemiAM (1)
  • erinaldi (1)
  • maxwelltsai (1)
Pull Request Authors
  • cweniger (23)
  • fnattino (8)
  • bkmi (4)
  • rogerkuou (3)
  • NoemiAM (3)
  • anchal-009 (1)
  • meiertgrootes (1)
  • adam-coogan (1)
Top Labels
Issue Labels
enhancement (24) v0.3 (15) documentation (4) bug (4) next release (3) help wanted (2) good first issue (2) consolidation (1)
Pull Request Labels
enhancement (1) consolidation (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 88 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 21
  • Total maintainers: 2
pypi.org: swyft

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

  • Versions: 21
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 88 Last month
Rankings
Stargazers count: 6.1%
Dependent packages count: 10.0%
Forks count: 10.2%
Average: 12.6%
Downloads: 15.2%
Dependent repos count: 21.7%
Maintainers (2)
Last synced: 4 months ago

Dependencies

.github/workflows/pypi-publish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite
.github/workflows/syntax.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/tests.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • codecov/codecov-action v1 composite
pyproject.toml pypi
setup.py pypi