Skip to main content

JAX-native simulation-based inference with PyMC and NumPyro integration

Project description

setu

A bridge from simulation-based inference to PyMC and NumPyro.

Many scientific models are simulators: they generate data from parameters, but do not provide the likelihood $p(x \mid \theta)$, the probability of an observation for a given set of parameters. That is exactly what Bayesian tools like PyMC and NumPyro need to recover the parameters behind observed data, so a simulator cannot be plugged into them directly.

setu (Sanskrit for bridge) closes that gap. It learns the likelihood from simulated data and exports it to a probabilistic programming language (PPL) in a single call, so the model, including priors, hierarchy, and posterior-predictive checks, is written in PyMC or NumPyro as usual. setu provides NLE, NRE, and MixedNLE estimators; training is backend-agnostic.

sbi implements neural likelihood estimation too; setu is a JAX-native complement to it, not a replacement. Because the estimator, its gradient, and the sampler compile into one program, setu targets JAX-native samplers such as BlackJAX and NumPyro and tends to be faster on the benchmarked task (see the benchmarks).

Installation

pip install setu-sbi                     # core (JAX + FlowJAX)
pip install "setu-sbi[pymc]"             # + PyMC / BlackJAX
pip install "setu-sbi[numpyro]"          # + NumPyro
pip install "setu-sbi[tuning]"           # + Optuna hyperparameter tuning
pip install "setu-sbi[all]"              # everything above

The distribution is named setu-sbi on PyPI; the import name is setu.

Documentation

Full documentation lives at https://aai-institute.github.io/setu/:

  • Tutorials: hand-held walkthroughs, from a simulator to a posterior in one sitting.
  • How-to guides: task-oriented recipes, starting with installation.
  • Reference: the full API, the (G, S, T, *E) shape conventions, and a glossary.
  • Explanation: what SBI is, why validation matters, and why hierarchical inference is powerful.

New here? Start with the tutorials.

Contributing

Contributions and questions are welcome, from bug reports to documentation fixes to code. See CONTRIBUTING.md for setup, workflow, and how to file an issue. New contributors: CONTEXT.md is the project glossary, so a quick skim is the fastest way to get oriented.

uv sync --dev
uv run pytest tests/ -m "not slow"  # fast tests (~2 min)
uv run ruff check setu/ tests/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

setu_sbi-0.1.0.tar.gz (123.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

setu_sbi-0.1.0-py3-none-any.whl (94.7 kB view details)

Uploaded Python 3

File details

Details for the file setu_sbi-0.1.0.tar.gz.

File metadata

  • Download URL: setu_sbi-0.1.0.tar.gz
  • Upload date:
  • Size: 123.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for setu_sbi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 db2206da63138f3c9219c78a136def6ac3471b1d70c207ea45a2ce91f7279fb0
MD5 1ca8b59697232e97372f66807cbf405f
BLAKE2b-256 88a17134c21cc08beed13f1b16227edb3b0f9d7fe62653f79921e4dbf23c83be

See more details on using hashes here.

File details

Details for the file setu_sbi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: setu_sbi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 94.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for setu_sbi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e9edad6ee1aeec47511da2d3f5371014f7348692326b35f319c704f87dbd7aa
MD5 c2d4d90f5b8d89104c04a212d4ad03b9
BLAKE2b-256 ff04ae1637a51a3426b6b9d017f593ca123180c7aa0fac3695f8c51b9af4bf80

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page