Skip to content

Examples

Example What it shows
Hierarchical Gaussian model (experiments/notebooks/experiment_toymodel_hgm.ipynb) a three-level conjugate model, a PAVI guide with affine and conditional_affine, training, and a comparison with the exact posterior
Individual brain functional networks the HCP application: generative model, PAVI choices, outputs, transfer to new subjects, and how to run the experiments/ pipeline
experiments/notebooks/experiment_fcon_test.ipynb post-processing of the brain parcellation model: individual and population maps, behavior prediction from posterior samples (requires HCP data and a trained run)

The code snippets of these docs are also complete examples. Every python block of a page runs top to bottom against the current API.

Roadmap: further examples and documentation

Proposed additions, not yet written:

Tutorial notebooks

  • Inference on new subjects: train on a dataset, then freeze the shared networks and refit only the encodings of new groups. Compare with training from scratch on the new groups alone.
  • A Gaussian mixture with enumeration: a small analogue of the parcellation model (discrete label per observation marginalized with TraceEnum_ELBO), to show hidden_sites for enumerated sites.
  • Mini-batch training: PlateSampler + DataLoader + InferenceModule on a synthetic dataset too large for full-batch training.
  • Richer posteriors: full-covariance (tril), Householder reflections and Pyro flows on a non-Gaussian posterior, with the cost/benefit trade-off.

Data

  • A small synthetic "fake fMRI" dataset (FC profiles generated from the model itself, a few subjects × a few hundred vertices). The application pipeline could then run end to end without HCP data, in CI as well.

Tooling

  • Run the documentation snippets in CI (e.g. pytest --markdown-docs or a small script), so the docs cannot drift from the API.
  • GitHub Actions: tests, mkdocs build --strict, and deployment of the site to GitHub Pages.
  • "Open in Colab" badges on the notebooks.
  • CONTRIBUTING.md (environment, tests, docs, figure regeneration) and a CHANGELOG.md.