Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v2.1.1
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: >-
./dist/*.tar.gz
Expand Down
164 changes: 164 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,169 @@
# Changelog

# Changelog

## v0.25.0

### ✨ Highlights

#### 🚀 New Inference Methods

* **MNPE class similar to MNLE** by @dgedon in https://github.com/sbi-dev/sbi/pull/1362
* **Implementing SNPE-B (#199)** by @etouron1 in https://github.com/sbi-dev/sbi/pull/1471

#### 🧠 Neural Network Architectures & Embedding Networks

* **Simple transformer implementation** by @NicolasRR in https://github.com/sbi-dev/sbi/pull/1494
* **Add embedding net that uses 1D causal convolutions (#1459)** by @Aranka-S in https://github.com/sbi-dev/sbi/pull/1499
* **Add LRU-backed embedding networks** by @famura in https://github.com/sbi-dev/sbi/pull/1512
* **Add ResNet as embedding model** by @StefanWahl in https://github.com/sbi-dev/sbi/pull/1472
* **Spectral convolution embedding net** by @L-in-da in https://github.com/sbi-dev/sbi/pull/1503

#### ⭐ Major Features & Capabilities

* **Unify flow matching and score-based models** by @StarostinV in https://github.com/sbi-dev/sbi/pull/1497
* **Model misspecification based on MMD** by @coschroeder in https://github.com/sbi-dev/sbi/pull/1502
* **Marginal estimator log-prob based test for misspecification** by @swag2198 in https://github.com/sbi-dev/sbi/pull/1522
* **Adding interface for unconditional flow training** by @plcrodrigues in https://github.com/sbi-dev/sbi/pull/1470
* **Support using trained estimators in Pyro models** by @sethaxen in https://github.com/sbi-dev/sbi/pull/1491
* **Add util to generate mcmc samples from user defined potential (#1405)** by @hayden-johnson in https://github.com/sbi-dev/sbi/pull/1483
* **Logit transform** by @anastasiakrouglova in https://github.com/sbi-dev/sbi/pull/1485

#### 📚 Documentation & Tutorials

* **Tutorial on new features for score-based methods #1392** by @touronc in https://github.com/sbi-dev/sbi/pull/1489
* **Docs: Introduce Readthedocs website** by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1463

### 🐛 Bug Fixes

* z_score correct order in Zuko by @anastasiakrouglova in https://github.com/sbi-dev/sbi/pull/1492
* Minor fix when moving thetas from GPU to CPU by @famura in https://github.com/sbi-dev/sbi/pull/1515
* Minor fix while using unconditional density estimator and LRU embedding by @ARna06 in https://github.com/sbi-dev/sbi/pull/1556
* fix: replace 'in' operator with '==' for proper classifier comparison by @abelaba in https://github.com/sbi-dev/sbi/pull/1550
* flowmatching condition shape fix by @gmoss13 in https://github.com/sbi-dev/sbi/pull/1584
* patch for torch bug in tarp, run torch.histogram with cpu-only tensor by @psteinb in https://github.com/sbi-dev/sbi/pull/1596
* fix failing tarp test by @janfb in https://github.com/sbi-dev/sbi/pull/1628
* fix: cap max_sampling_batch_size to prevent excessive memory by @janfb in https://github.com/sbi-dev/sbi/pull/1624
* 1561 computation of denoising posterior precision matrix in jac method score fn iid by @manuelgloeckler in https://github.com/sbi-dev/sbi/pull/1636
* fix xfail test, fix deprecation warnings by @janfb in https://github.com/sbi-dev/sbi/pull/1642

### 🛠️ Maintenance & Improvements

#### 🔧 Code Quality & Refactoring

* Refactoring flow and score matching classes and nets by @manuelgloeckler in https://github.com/sbi-dev/sbi/pull/1544
* Rename inference trainer classes by @abelaba in https://github.com/sbi-dev/sbi/pull/1605
* Rename VectorFieldInference to VectorFieldTrainer by @abelaba in https://github.com/sbi-dev/sbi/pull/1614
* Refactor build_posterior to Eliminate Duplication Across Trainers by @abelaba in https://github.com/sbi-dev/sbi/pull/1610
* Refactor build posterior method arguments to use Literals by @abelaba in https://github.com/sbi-dev/sbi/pull/1606
* Refactor build_posterior Posterior Configuration Using Dataclasses by @abelaba in https://github.com/sbi-dev/sbi/pull/1619
* Use TypeAlias and consistent naming for sbi types by @janfb in https://github.com/sbi-dev/sbi/pull/1637
* Add protocol for estimator builder by @abelaba in https://github.com/sbi-dev/sbi/pull/1633
* Improve abc implementation by @janfb in https://github.com/sbi-dev/sbi/pull/1615

#### 🏷️ Type Hints & API Improvements

* fix: add enum for flow options to fix type hints. by @janfb in https://github.com/sbi-dev/sbi/pull/1562
* fix LC2ST kwarg typing by @janfb in https://github.com/sbi-dev/sbi/pull/1565
* fix: Update RatioEstimator classifier argument to use a Protocol by @abelaba in https://github.com/sbi-dev/sbi/pull/1582
* Update append_simulations return type to Self by @abelaba in https://github.com/sbi-dev/sbi/pull/1622
* Deprecation Warnings for build_posterior stringly typed parameters by @abelaba in https://github.com/sbi-dev/sbi/pull/1627

#### 🧪 Testing & CI/CD

* Testmon by @manuelgloeckler in https://github.com/sbi-dev/sbi/pull/1452
* disable testmon for now by @manuelgloeckler in https://github.com/sbi-dev/sbi/pull/1467
* chore: Use pytest-split plugin in ci workflow by @schroedk in https://github.com/sbi-dev/sbi/pull/1465
* tests: refactor "not slow" tests to be not so slow by @janfb in https://github.com/sbi-dev/sbi/pull/1495
* Test for known pytorch distribution transform issue by @dgedon in https://github.com/sbi-dev/sbi/pull/1504
* xfail scan test on python 3.13 by @manuelgloeckler in https://github.com/sbi-dev/sbi/pull/1533
* Gpu test for VectorFieldPosterior by @jorobledo in https://github.com/sbi-dev/sbi/pull/1542
* set vector field iid-tests xfail by @janfb in https://github.com/sbi-dev/sbi/pull/1554
* Changed the xfail condition for LRU tests with mode='scan' by @famura in https://github.com/sbi-dev/sbi/pull/1552
* Fix/lru test by @Matthijspals in https://github.com/sbi-dev/sbi/pull/1568
* refactor sbc funcs and tests by @janfb in https://github.com/sbi-dev/sbi/pull/1578
* chore: remove testmon, add codecov test analytics by @janfb in https://github.com/sbi-dev/sbi/pull/1592
* chore: reorder setup steps for Python and uv in CI/CD workflows by @janfb in https://github.com/sbi-dev/sbi/pull/1601
* Fix/lc2st numpy type fixes by @janfb in https://github.com/sbi-dev/sbi/pull/1613
* Fix failing CI on main. by @janfb in https://github.com/sbi-dev/sbi/pull/1618

#### 📖 Documentation & Website

* Fix tests for new docs by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1475
* Prevent notebook execution upon doc build by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1477
* Fix broken links on website by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1480
* fix: Update documentation folder path by @abelaba in https://github.com/sbi-dev/sbi/pull/1510
* fix path to contribute.md by @psteinb in https://github.com/sbi-dev/sbi/pull/1507
* Add utils to docs by @sethaxen in https://github.com/sbi-dev/sbi/pull/1520
* Update new Readthedocs website by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1519
* fix broken links on new website by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1538
* Fixups for new website landing page by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1539
* Fix: add tutorial page to mkdocs website by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1540
* Fix broken links in some tutorials by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1541
* Add examples to documentation by @jorobledo in https://github.com/sbi-dev/sbi/pull/1548
* docs: Add importance_sampling_parameters to build_posterior docstring. by @abelaba in https://github.com/sbi-dev/sbi/pull/1558
* Add missing arguments to LikelihoodEstimator and RatioEstimator docstrings. by @abelaba in https://github.com/sbi-dev/sbi/pull/1571
* Fixups for new RTD website by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1573
* Tutorial with a more representative training loop by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1574
* Fixups for rendering of HH tutorial notebook by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1575
* fix for colors in Hodgkin-Huxley notebook by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1576
* Add citations to how-to guide by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1579
* Clarify fullscreen view of applications-explorer by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1580
* Fixups for the documentation by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1585
* fixed misrendered bullet list, tested locally by @psteinb in https://github.com/sbi-dev/sbi/pull/1594
* Improvements to L-C2ST tutorial by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1588
* docs: Change colortheme in light mode by @michaeldeistler in https://github.com/sbi-dev/sbi/pull/1638

#### 🏗️ Infrastructure & Dependencies

* Add uv support by @abelaba in https://github.com/sbi-dev/sbi/pull/1518
* switch to numfocus code of conduct by @janfb in https://github.com/sbi-dev/sbi/pull/1560
* Update readme with new JOSS citation by @janfb in https://github.com/sbi-dev/sbi/pull/1564
* update numfocus code of conduct by @janfb in https://github.com/sbi-dev/sbi/pull/1602
* Added Apache License reference comments to source files + CI bash script check by @nMaax in https://github.com/sbi-dev/sbi/pull/1599

#### 👥 User Experience & Warnings

* Change xfail to skipif as outcome is not consistent by @gmoss13 in https://github.com/sbi-dev/sbi/pull/1487
* Add warning when using append_simulations with exclude_invalid_x=True by @abelaba in https://github.com/sbi-dev/sbi/pull/1486
* Batch sampling slow without warning by @dgedon in https://github.com/sbi-dev/sbi/pull/1490
* Clarify pbar annotation in sample_batched for DirectPosterior by @StefanWahl in https://github.com/sbi-dev/sbi/pull/1493

#### 🎮 GPU Support & Device Handling

* Prior to(device) by @jorobledo in https://github.com/sbi-dev/sbi/pull/1505
* posterior.to(device) by @jorobledo in https://github.com/sbi-dev/sbi/pull/1527

#### 🔧 Miscellaneous Improvements

* ref: update tests, add types and docs to marginal trainer by @janfb in https://github.com/sbi-dev/sbi/pull/1516
* integrate sbi application eplorer by @lappalainenj in https://github.com/sbi-dev/sbi/pull/1567
* fix: update notebook references by @emmanuel-ferdman in https://github.com/sbi-dev/sbi/pull/1563
* Update sbiutils.py to use one-dimensional batch by @vivienr in https://github.com/sbi-dev/sbi/pull/1577
* fix: remove empty list default argument by @abelaba in https://github.com/sbi-dev/sbi/pull/1608
* fix: throw exception on unsupported activation function by @emmanuel-ferdman in https://github.com/sbi-dev/sbi/pull/1609
* fix: resolve logger warnings by @emmanuel-ferdman in https://github.com/sbi-dev/sbi/pull/1598
* fix paths by @manuelgloeckler in https://github.com/sbi-dev/sbi/pull/1641

### 🎉 New Contributors

* @abelaba made their first contribution in https://github.com/sbi-dev/sbi/pull/1486
* @dgedon made their first contribution in https://github.com/sbi-dev/sbi/pull/1490
* @StefanWahl made their first contribution in https://github.com/sbi-dev/sbi/pull/1493
* @touronc made their first contribution in https://github.com/sbi-dev/sbi/pull/1489
* @jorobledo made their first contribution in https://github.com/sbi-dev/sbi/pull/1505
* @hayden-johnson made their first contribution in https://github.com/sbi-dev/sbi/pull/1483
* @sethaxen made their first contribution in https://github.com/sbi-dev/sbi/pull/1491
* @etouron1 made their first contribution in https://github.com/sbi-dev/sbi/pull/1471
* @Aranka-S made their first contribution in https://github.com/sbi-dev/sbi/pull/1499
* @swag2198 made their first contribution in https://github.com/sbi-dev/sbi/pull/1522
* @StarostinV made their first contribution in https://github.com/sbi-dev/sbi/pull/1497
* @L-in-da made their first contribution in https://github.com/sbi-dev/sbi/pull/1503
* @NicolasRR made their first contribution in https://github.com/sbi-dev/sbi/pull/1494
* @vivienr made their first contribution in https://github.com/sbi-dev/sbi/pull/1577

**Full Changelog**: https://github.com/sbi-dev/sbi/compare/v0.24.0...v0.25.0

## v0.24.0

### ✨ Highlights
Expand Down
20 changes: 18 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
# Documentation

To build the sphinx documentation, run
## Building and serving the documentation locally

To build the Sphinx documentation with autoreload (recommended for development):

```bash
# Install documentation dependencies
uv sync --extra doc

# Start development server with autoreload
sphinx-autobuild . _build/html
```

This will automatically rebuild the documentation when you make changes and serve it locally (usually at `http://127.0.0.1:8000`).

Alternatively, for a one-time build and simple HTTP server:

```bash
make html && python -m http.server --directory _build/html
```
This will find all jupyter notebooks, run them, collect the output, and incorporate them into the documentation.

The autoreload method is recommended as it will find all Jupyter notebooks, run them, collect the output, and incorporate them into the documentation, while automatically rebuilding when you make changes.
57 changes: 19 additions & 38 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,29 +61,19 @@ git clone git@github.com:$USERNAME/sbi.git
cd sbi
```

**Step 4**: Install a recent version of Python (we currently recommend 3.10)
for instance using [`miniforge`](https://github.com/conda-forge/miniforge). We
strongly recommend you create a specific `conda` environment for doing
development on `sbi` as per:
**Step 4**: Set up your development environment. Follow the [installation
instructions](installation.md) to install Python and create a virtual environment with
`uv`.

```bash
conda create -n sbi_dev python=3.10
conda activate sbi_dev
```

**Step 5**: Install `sbi` in editable mode with
**Step 5**: Install `sbi` in editable mode with development dependencies:

```bash
pip install -e ".[dev]"
uv pip install -e ".[dev]"
```

This installs the `sbi` package into the current environment by creating a
link to the source code directory (instead of copying the code to pip’s `site_packages`
directory, which is what normally happens). This means that any edits you make
to the `sbi` source code will be reflected the next time you open a Python interpreter
and `import sbi` (the `-e` flag of pip stands for an “editable” installation,
and the `dev` flag installs development and testing dependencies). This requires
at least Python 3.8.
This installs the `sbi` package in editable mode, meaning changes to the source code
will be immediately reflected when you import `sbi`, along with all development and
testing dependencies.

**Step 6**: Add the upstream remote. This saves a reference to the main `sbi`
repository, which you can use to keep your repository synchronized with the latest
Expand All @@ -106,7 +96,6 @@ upstream git@github.com:sbi-dev/sbi.git (push)
**Step 7**: Install `pre-commit` to run code style checks before each commit:

```bash
pip install pre-commit
pre-commit install
```

Expand Down Expand Up @@ -270,33 +259,25 @@ test suite in `tests/test_bm.py`.

## Contributing to the documentation

Most of the documentation for `sbi` is written in markdown and the website is generated
using `mkdocs` with `mkdocstrings` and `mike`. The tutorials and examples are converted
from jupyter notebooks into markdown files to be shown on the website. To work on
improvements of the documentation, you should first install the `doc` dependencies:
Most of the documentation for `sbi` is written in reStructuredText and the website is
generated using `Sphinx`. The tutorials and examples are Jupyter notebooks that are
automatically converted during the build process. To work on improvements of the
documentation, you should first install the `doc` dependencies:

```bash
pip install -e ".[doc]"
uv sync --extra doc
```

Then, you can build the website locally by executing in the `docs` folder
Then, you can build and serve the website locally by executing in the `docs` folder

```bash
mkdocs serve
sphinx-autobuild . _build/html
```

This will build the website on a local host address shown in the terminal. Changes to
the website files or a browser refresh will immediately rebuild the website.

If you updated the tutorials or examples, you need to convert them to markdown first:

```bash
cd docs
jupyter nbconvert --to markdown ../docs/tutorials/*.ipynb --output-dir docs/tutorials/
jupyter nbconvert --to markdown ../docs/advanced_tutorials/*.ipynb --output-dir docs/tutorials/
jupyter nbconvert --to markdown ../docs/how_to_guide/09_sampler_interface.ipynb --output-dir docs/tutorials/
mkdocs serve
```
This command will automatically build the website and start a local development server with
automatic rebuilding and live reload, so you can open it in your browser and see changes
as you edit. Changes to the documentation files will automatically trigger a rebuild and
be displayed locally.

### Using AI Coding Assistants

Expand Down
61 changes: 43 additions & 18 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,64 @@
(installation)=
# Installation

`sbi` requires Python 3.10 or higher. A GPU is not required, but can lead to
speed-up in some cases. We recommend using a
[`conda`](https://docs.conda.io/en/latest/miniconda.html) virtual environment
([Miniconda installation
instructions](https://docs.conda.io/en/latest/miniconda.html)). If `conda` is
installed on the system, an environment for installing `sbi` can be created as
follows:

```console
# Create an environment for sbi (indicate Python 3.10 or higher); activate it
$ conda create -n sbi_env python=3.10 && conda activate sbi_env
`sbi` requires Python 3.10 or higher. We recommend using Python 3.12 for the best
experience. A GPU is not required, but can lead to speed-up in some cases.

## Recommended: Installation with uv

We recommend using [`uv`](https://docs.astral.sh/uv)
for package and environment management. If you haven't installed `uv` yet, follow
the [installation instructions](https://docs.astral.sh/uv/getting-started/installation/).

Create a virtual environment and install `sbi`:

```bash
# Create a virtual environment with Python 3.12
uv venv --python 3.12

# Activate the environment (on macOS/Linux)
source .venv/bin/activate

# On Windows
# .venv\Scripts\activate

# Install sbi
uv pip install sbi
```

Independent of whether you are using `conda` or not, `sbi` can be installed
using `pip`:
## Alternative installation methods

### Using pip

If you prefer using `pip` directly:

```bash
python -m pip install sbi
```

To install and add `sbi` to a project with [`pixi`](https://pixi.sh/), from the project directory run
### Using conda

To install into a conda environment:

```bash
pixi add sbi
# Create an environment for sbi (Python 3.10 or higher)
conda create -n sbi_env python=3.12 && conda activate sbi_env

# Install sbi from conda-forge
conda install --channel conda-forge sbi
```

and to install into a particular conda environment with [`conda`](https://docs.conda.io/projects/conda/), in the activated environment run
### Using pixi

To install and add `sbi` to a project with [`pixi`](https://pixi.sh/):

```bash
conda install --channel conda-forge sbi
pixi add sbi
```

To test the installation, drop into a Python prompt and run
## Testing the installation

To test the installation, drop into a Python prompt and run:

```python
from sbi.examples.minimal import simple
Expand Down
8 changes: 8 additions & 0 deletions mkdocs/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# `sbi`: simulation-based inference toolkit

!!! warning "Documentation Moved"

**This documentation is deprecated.** Please visit our new documentation at:

**[https://sbi.readthedocs.io/en/latest/](https://sbi.readthedocs.io/en/latest/)**

The documentation below is no longer maintained and may contain outdated information.

`sbi` is a Python package for simulation-based inference, designed to meet the needs of
both researchers and practitioners. Whether you need fine-grained control or an
easy-to-use interface, `sbi` has you covered.
Expand Down
Loading