Worked tutorials¶
Start with Compile your first function, then follow a complete workflow below. Each page combines the explanation, runnable code and output. Download its Python script or Jupyter notebook from the bottom of the page.
New to inference? Start with the Normal model and its known posterior.
Have a dataframe? Fit a mixed model with automatic coordinate transforms.
Have arrays? Pass runtime data to the Gaussian regression.
Want a portable analysis? Save a regression to ZIP, reload it, and fit MAP.
Using an inference package? Sample and approximate with BlackJAX, sample with NumPyro, fit with Optax, and diagnose with ArviZ, all from
module.logdensity(...).Fitting or sampling outside JAX? Read Hesse and Minos errors with iminuit, minimize with optimistix, or sample with nutpie.
Starting from ROOT files? Read histograms with uproot and hist, or build a workspace with cabinetry and run a discovery fit on the FlatPPL likelihood.
Shipping a model? Export the compiled density with
jax.exportand run it without FlatPPL.Running toys? Batch pseudo-experiments with
jax.vmapand switch the lowering target between CPU and GPU.Want the whole workflow? Go from a model file and a dataframe to checked posterior draws, or import the published Belle II likelihood, fit, profile and sample it.
Have a FlatPPL model? Query its bindings, inspect its graph, or run a file from the example corpus.
For a pyhf workspace, use Import a pyhf model. The Coordinate transforms for inference reference explains how to pass constrained parameters to an unconstrained sampler.
The documentation build executes these scripts against the installed package. Each script states its runtime budget; the build fails if it exceeds that limit.
Fit maximum a posteriori and maximum likelihood points with Optax
Fit a mixed model with automatic coordinate transforms
From a model file and a dataframe to checked posterior draws
A published Belle II likelihood: pyhf to FlatPPL to JAX
Read histograms from ROOT files with uproot and hist
A discovery fit from ROOT histograms with cabinetry