API Reference¶
gauss_flows is a JAX / FlowJax
toolkit for Gaussianization flows — normalizing flows that iteratively map data to a
standard normal by alternating marginal CDF transforms with learned rotations (the RBIG
pattern), together with the SurVAE hierarchy of
bijections, surjections, and stochastic transforms, and the information-theoretic measures
those flows unlock. It ships as two packages of one uv workspace: gauss-flows-maps (import gauss_flows_maps), the invertible and conditioned maps, and gauss-flows-models (import gauss_flows_models), the flows, filters, distributions and measures built on them. The reference is organised by theme rather than dumped as one flat page,
and the capability index lists every public name on one page, with a
one-line summary each, followed by the public API of the libraries gauss_flows builds on:
| Section | What's inside |
|---|---|
| Bijections | gauss_flows_maps.bijections and .conditioning: exactly-invertible transforms — coupling, marginal CDFs, linear/rotation, normalisation, periodic and classic residual layers — and the conditioner; FFJORD is in gauss_flows_models.flows |
| Conditioners | gauss_flows_maps.conditioning: the conditioners c(h, z) -> y shared by conditional flows and conditioned neural fields: ConcatConditioner, AffineModulation (FiLM) and HyperLinear |
| Surjections & Stochastic | gauss_flows_maps.surjections: deterministic surjections (abs, sort, max-pool, augment/slice) and stochastic transforms (VAE, permutation) with lower-bound likelihoods |
| Monotone inverses | gauss_flows_maps.monotone: monotone_inverse, the bracketed inverse of an elementwise increasing function (a mixture-CDF quantile, a flow transformer), and the Chandrupatla root finder it uses by default |
| Reparametrisations | gauss_flows_maps.reparam: constrained parameters x = g(u) (exp, softplus and sigmoid with bounds, compositions, Cholesky factors, simplex weights) and their paramax.Parameterize leaves |
| Base Distributions | gauss_flows_models.distributions: latent distributions for the flow base — Gaussian mixtures, low-rank PCA Gaussian, conditional/class-conditional diagonals, and manifold (sphere) distributions |
| Flows & RBIG | gauss_flows_models.flows and .filters: flow containers (SurVAEFlow) and one-call factories — gaussianization_flow, coupling_gaussianization_flow, iterative_rbig, plus the fit_rbig warm-start |
| Training | gauss_flows_models.inference: the negative_log_likelihood loss and the fit_gaussianization_flow loop (the NumPyro bridges live in pyrox-flows) |
| Information Theory | gauss_flows_models.info_theory: entropy, total correlation, mutual information, KL, negentropy — Monte-Carlo (flow-based), analytical Gaussian closed forms, and RBIG-way reductions |
Conventions¶
A few patterns hold across the whole package:
-
Built on FlowJax. Every bijection subclasses
flowjax.bijections.AbstractBijection; base distributions subclassflowjax/equinoxmodules. Compose transforms with FlowJaxChain/Scanand wrap them withTransformed— or use the package'sSurVAEFlowcontainer when a chain mixes surjections and stochastic steps. -
Single-event, not batched. Transform methods (
transform_and_log_det/inverse_and_log_det/forward_and_log_det) assumex.shape == self.shapeand return a scalarlog_det. Vectorise over a batch withjax.vmap/eqx.filter_vmap; theSurVAEFlowcontainer already vmapslog_prob/sampleover any leadingsample_shape. This matches the FlowJax convention, which runtime-enforcesx.shape == bijection.shape.import jax, jax.numpy as jnp, jax.random as jr from gauss_flows_maps.bijections import MixtureGaussianCDF t = MixtureGaussianCDF(n_components=8, shape=(4,)) x = jr.normal(jr.key(0), (4,)) # one event, shape == t.shape y, log_det = t.transform_and_log_det(x) # y: (4,), log_det: scalar xs = jr.normal(jr.key(1), (32, 4)) # a batch ys, log_dets = jax.vmap(t.transform_and_log_det)(xs) # (32, 4), (32,) -
Immutable Equinox modules. Transforms and distributions are
equinox.Modulepytrees — immutable, JIT/grad/vmap friendly. Trainable parameters are array leaves; filter them witheqx.filter(model, eqx.is_inexact_array)when building an optimiser. Constructors that draw random weights take akey(jax.random.PRNGKey/jax.random.key). -
Unicode math in docstrings. Docstrings use mathematical Unicode freely (
−,×,σ,ℝ,∑) —RUF002is ignored project-wide for this reason. Public transforms and distributions document a Shape: section (per-method input/output shapes, single-event convention) and a runnable Example: block.
Every public name is reached through its module (gauss_flows_maps.bijections.AffineCoupling, gauss_flows_models.flows.gaussianization_flow); never import from the internal _src/ paths.
Package overview¶
Invertible and conditioned maps for normalizing flows.
Bijections, surjections, conditioning, monotone inverses, maps on the sphere and
reparametrisations. A Core-layer package: among the stack's libraries it imports only
functax. Every public name is reached through its module, e.g.
from gauss_flows_maps.bijections import AffineCoupling.