Metadata-Version: 2.4
Name: setu-sbi
Version: 0.1.0
Summary: JAX-native simulation-based inference with PyMC and NumPyro integration
Project-URL: Repository, https://github.com/aai-institute/setu
Project-URL: Issues, https://github.com/aai-institute/setu/issues
Author: Jan Teusen
License: Apache-2.0
License-File: LICENSE
Keywords: bayesian-inference,jax,likelihood-free,numpyro,pymc,sbi,simulation-based-inference
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Requires-Dist: equinox>=0.11.0
Requires-Dist: flowjax>=18.0.0
Requires-Dist: jax>=0.4.20
Requires-Dist: numpy>=1.24
Requires-Dist: optax>=0.2.0
Requires-Dist: pot>=0.9.0
Requires-Dist: scikit-learn>=1.0
Requires-Dist: tqdm>=4.0
Provides-Extra: all
Requires-Dist: arviz<1,>=0.20.0; extra == 'all'
Requires-Dist: blackjax<1.6,>=1.0.0; extra == 'all'
Requires-Dist: numpyro>=0.15.0; extra == 'all'
Requires-Dist: optuna>=4.7.0; extra == 'all'
Requires-Dist: pymc<6,>=5.10.0; extra == 'all'
Requires-Dist: scipy>=1.10.0; extra == 'all'
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: arviz>=0.20.0; extra == 'docs'
Requires-Dist: ipywidgets>=8.1.0; extra == 'docs'
Requires-Dist: jupyter-cache>=1.0.0; extra == 'docs'
Requires-Dist: matplotlib>=3.7.0; extra == 'docs'
Requires-Dist: myst-nb>=1.1.0; extra == 'docs'
Requires-Dist: pydata-sphinx-theme>=0.15.0; extra == 'docs'
Requires-Dist: sphinx-autodoc-typehints>=2.0.0; extra == 'docs'
Requires-Dist: sphinx-design>=0.6.0; extra == 'docs'
Requires-Dist: sphinx>=7.0; extra == 'docs'
Provides-Extra: numpyro
Requires-Dist: numpyro>=0.15.0; extra == 'numpyro'
Provides-Extra: pymc
Requires-Dist: arviz<1,>=0.20.0; extra == 'pymc'
Requires-Dist: blackjax<1.6,>=1.0.0; extra == 'pymc'
Requires-Dist: pymc<6,>=5.10.0; extra == 'pymc'
Provides-Extra: tuning
Requires-Dist: optuna>=4.7.0; extra == 'tuning'
Provides-Extra: validation
Requires-Dist: scipy>=1.10.0; extra == 'validation'
Description-Content-Type: text/markdown

<p align="center">
  <img src="docs/_static/logo.png" alt="setu" width="180">
</p>

<p align="center"><b>A bridge from simulation-based inference to PyMC and NumPyro.</b></p>

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`](https://sbi-dev.github.io/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](https://aai-institute.github.io/setu/explanation/benchmarks.html)).

## Installation

```bash
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](https://aai-institute.github.io/setu/tutorials/): hand-held walkthroughs, from a simulator to a posterior in one sitting.
- [How-to guides](https://aai-institute.github.io/setu/how-to/): task-oriented recipes, starting with [installation](https://aai-institute.github.io/setu/how-to/install.html).
- [Reference](https://aai-institute.github.io/setu/reference/): the full API, the `(G, S, T, *E)` shape conventions, and a glossary.
- [Explanation](https://aai-institute.github.io/setu/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](CONTRIBUTING.md) for setup, workflow, and how to
file an issue. New contributors: [CONTEXT.md](CONTEXT.md) is the project glossary,
so a quick skim is the fastest way to get oriented.

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