Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

gaussianization tutorial

Part 0 — Foundations

The conceptual bedrock for the whole Gaussianization curriculum. Before fitting any flow, these seven notebooks build — from scratch in JAX, then confirmed against the mature rbig and gauss_flows packages — the small set of ideas every later method reuses: the change-of-variables formula and its log-determinant, how those compose, the forward/inverse trade-off, why N(0,I)\mathcal{N}(0, I) is the target, what a density destructor is, the numerics that keep one stable, and how to certify it converged.

Each notebook follows the same pattern: derive the idea by hand, then show the exact same quantity coming out of the library. That way the packages stop being black boxes — you have seen what every call computes.

Notebooks

#notebookmaster listwhat you take away
00Change of variables0.1pX(x)=pZ(T(x))detJTp_X(x)=p_Z(T(x))\lvert\det J_T\rvert; the library’s log_det is this Jacobian
01Composition & log-det0.2stacking maps ⇒ log-dets add; rotations are free
02Forward vs. inverse0.3density vs. sampling cost; differentiating a root-find by the adjoint (optimistix)
03Why N(0,I)\mathcal{N}(0,I)?0.4max-entropy, separability (TC0\to0), trivial score z-z
04Density destructors0.5–0.6Gaussianization = iterated whitening + nonlinearity (RBIG)
05Numerical mechanics0.7–0.9jitter/clamp, float64 log-dets, the round-trip CI test
06Gaussianity diagnostics0.10–0.12QQ/moments, negentropy, energy-distance normality test

The numbering and scope follow the Part 0 rows of the project TUTORIAL_MASTER_LIST.md.

Packages

These notebooks use two of the author’s libraries as the source of truth:

Running

The foundations notebooks need rbig + gauss_flows + a Jupyter stack, which live outside the conda-forge pixi envs. Create a dedicated uv virtual environment (paths assume the sibling checkouts of rbig and gauss_flows):

cd projects/gaussianization
uv venv .venv-tutorials --python 3.13
uv pip install --python .venv-tutorials/bin/python \
  -e ../../../rbig -e ../../../ml4eo/gauss_flows \
  ipykernel jupyter nbconvert jupytext matplotlib seaborn

# Re-execute the whole section end-to-end:
.venv-tutorials/bin/jupyter nbconvert --to notebook --execute --inplace \
  notebooks/00_foundations/0*.ipynb --ExecutePreprocessor.timeout=600

Notebooks are paired (jupytext, py:percent): edit the .py, then jupytext --sync to update the .ipynb. All notebooks set jax_enable_x64 so log-determinant accumulation stays exact.