The canonical RBIG loop
Alternate a marginal Gaussianization and a rotation until the data are a standard Gaussian, then run the stack backwards to generate
00 · The canonical RBIG loop¶
Part 1 built the marginal map that makes each coordinate standard normal, and Part 2 the rotation that mixes the coordinates so the next marginal map has something left to do. Rotation-Based Iterative Gaussianization (RBIG) Laparra et al., 2011 alternates the two: each layer is the density-destructor layer of (3), and the layers are composed as in (2). What makes it RBIG is how the layers are fitted: greedily, one at a time, each to the data as the previous layers left them, and never revisited.
import subprocess
import sys
try:
import google.colab # noqa: F401
IN_COLAB = True
except ImportError:
IN_COLAB = False
if IN_COLAB:
repo = "git+https://github.com/jejjohnson/gauss_flows@main"
subprocess.run(
[
sys.executable,
"-m",
"pip",
"install",
"-q",
f"gauss-flows-maps @ {repo}#subdirectory=packages/gauss-flows-maps",
f"gauss-flows-models @ {repo}#subdirectory=packages/gauss-flows-models",
f"gauss-flows-docs[notebooks] @ {repo}#subdirectory=docs",
],
check=True,
)import warnings
warnings.filterwarnings("ignore", message=r".*IProgress.*")
import jax
import jax.numpy as jnp
import jax.random as jr
import matplotlib.pyplot as plt
import numpy as np
import rbig
from jaxtyping import ArrayLike, Float
from scipy import stats
from scipy.spatial import cKDTree
from sklearn.datasets import make_moons
from flowjax.distributions import Transformed
from gauss_flows_docs.environment import watermark
from gauss_flows_docs.plotting import (
DATA_COLOR,
LATENT_COLOR,
SCATTER_KW,
style_ax,
use_compact_figures,
)
from gauss_flows_models.inference import fit_rbig
rng = np.random.default_rng(0)
# Figures are stored as palette PNGs to keep the notebook small.
use_compact_figures()
watermark("jax", "numpy", "scipy", "matplotlib", "rbig", "gauss_flows_models")Python implementation: CPython
Python version : 3.13.12
IPython version : 9.12.0
jax : 0.12.1
numpy : 2.4.3
scipy : 1.17.1
matplotlib : 3.11.2
rbig : 0.1.16
gauss_flows_models: 0.3.0
Compiler : Clang 21.1.4
OS : Linux
Release : 6.8.0-1044-azure
Machine : x86_64
Processor : x86_64
CPU cores : 16
Architecture: 64bit
Throughout, the data are points of the two-moons dataset, two interleaved half circles with Gaussian noise of standard deviation 0.07, standardised per coordinate. Both coordinates are far from Gaussian, and the dependence between them is curved, so no single rotation can remove it.
# Shapes: sample (N) = 4,000; state (D_x) = 2
SampleState = Float[ArrayLike, "sample state"]
# today (scikit-learn)
# two interleaved half circles with noise of standard deviation 0.07, (sample, state)
raw: SampleState
raw, _ = make_moons(n_samples=4000, noise=0.07, random_state=0)
PerState = Float[ArrayLike, " state"]
# x̄, the mean of each coordinate, (state)
data_mean: PerState = raw.mean(axis=0)
# s, the standard deviation of each coordinate, (state)
data_std: PerState = raw.std(axis=0)
# x = (raw − x̄) / s, (sample, state)
samples: SampleState = (raw - data_mean) / data_std1. One RBIG layer¶
The marginal step of layer is the probability integral transform of Part 1 with an empirical CDF fitted to the current state. rbig.MarginalGaussianize uses the midpoint empirical CDF, which puts the -th smallest value of a coordinate at the level
so that no level is exactly 0 or 1, and the marginal map of coordinate is
where is the midpoint empirical CDF of coordinate of the state . The rotation is then the PCA rotation (3) of .
# today (rbig)
# fit ĝ_1 to each coordinate of the data
first_marginal = rbig.MarginalGaussianize().fit(samples)
# today (rbig)
# g_1(x), (sample, state)
marginalised: SampleState = first_marginal.transform(samples)
# today (rbig)
# fit Q_1 = Vᵀ to the marginalised data
first_rotation = rbig.PCARotation(whiten=False).fit(marginalised)
# today (rbig)
# x_1 = Q_1 g_1(x), (sample, state)
one_layer: SampleState = first_rotation.transform(marginalised)We compare the standard deviations and the correlation of the two coordinates before and after each step.
for name, points in [
("data", samples),
("g_1(x)", marginalised),
("Q_1 g_1(x)", one_layer),
]:
# the correlation of the two coordinates
correlation: float = np.corrcoef(points.T)[0, 1]
print(
f"{name:11s} std {points.std(axis=0).round(3)}, correlation {correlation:+.3f}"
)data std [1. 1.], correlation -0.445
g_1(x) std [1. 1.], correlation -0.374
Q_1 g_1(x) std [1.172 0.791], correlation -0.000
panels = {
"data": samples,
"after the marginal step": marginalised,
"after the rotation": one_layer,
}
fig, axes = plt.subplots(1, 3, figsize=(13.5, 4.3), sharex=True, sharey=True)
for ax, (title, points) in zip(axes, panels.items(), strict=True):
color = DATA_COLOR if title == "data" else LATENT_COLOR
ax.scatter(points[:, 0], points[:, 1], color=color, **SCATTER_KW)
ax.set(title=title, xlabel="first coordinate", xlim=(-4, 4), ylim=(-4, 4))
ax.set_aspect("equal")
style_ax(ax)
axes[0].set_ylabel("second coordinate")
fig.tight_layout()
plt.show()
Figure 1:One RBIG layer on two moons. The marginal step makes both coordinates standard normal but keeps the two crescents, bent, because a map that acts on each coordinate separately cannot undo a curved dependence. The rotation removes the correlation and turns the cloud to a new frame, where the next marginal step has structure left to remove.
The data are already standardised, so the marginal step keeps both standard deviations at 1; it changes the correlation from -0.45 to -0.37 and bends the crescents. The rotation removes the correlation and spreads the variance unequally along its new axes. Neither step on its own makes the data Gaussian; the loop is meant to.
2. The loop¶
We wrap one layer in a function that takes the rotation to fit, and apply it again and again, each time to the state the previous layers produced. To tell whether the result is Gaussian we need more than its mean and covariance, which a PCA layer sets to and after the first pass. A joint test that is cheap in two dimensions projects the points onto unit directions : every projection of is , and a distribution whose every projection is is (the Cramér–Wold theorem). The statistic is the largest Kolmogorov–Smirnov distance over the directions,
where is the empirical CDF of the projections . We compare it with its value on standard-normal samples of the same size.
# Shapes: direction (J) = 64
# αⱼ ~ 𝒰(0, π), the angles of the directions, (direction)
angles: Float[ArrayLike, " direction"] = rng.uniform(0, np.pi, 64)
# unit directions eⱼ = (cos αⱼ, sin αⱼ), (direction, state)
directions: Float[ArrayLike, "direction state"] = np.column_stack(
[np.cos(angles), np.sin(angles)]
)
# user
# KS_max = maxⱼ supₜ |F̂_{N,j}(t) − Φ(t)|
def projection_ks(points: SampleState) -> float:
"""The largest Kolmogorov-Smirnov distance of a projection of ``points`` to N(0, 1)."""
# eⱼᵀ zₙ, (sample, direction)
projections: Float[ArrayLike, "sample direction"] = points @ directions.T
return max(stats.kstest(projections[:, j], "norm").statistic for j in range(64))Fifty standard-normal samples give the null distribution of the statistic.
# Shapes: draw = 50
# user
# KS_max of fifty draws of 4,000 points from 𝒩(0, I), (draw)
null_ks: Float[ArrayLike, " draw"] = np.array(
[projection_ks(rng.standard_normal((4000, 2))) for _ in range(50)]
)
# the 95% quantile of KS_max under 𝒩(0, I)
null_threshold: float = np.quantile(null_ks, 0.95)
print(f"KS_max of standard-normal samples, 95% quantile: {null_threshold:.4f}")KS_max of standard-normal samples, 95% quantile: 0.0282
One layer, for any rotation, is the function below.
# user
# fit g_k and Q_k to x_{k−1}, and return them with x_k = Q_k g_k(x_{k−1})
def fit_layer(points: SampleState, rotation):
"""Fit one RBIG layer with the unfitted ``rotation`` to ``points`` and apply it."""
# today (rbig)
# fit ĝ_k to each coordinate of x_{k−1}
marginal = rbig.MarginalGaussianize().fit(points)
# today (rbig)
# g_k(x_{k−1}), (sample, state)
marginalised_points: SampleState = marginal.transform(points)
# today (rbig)
# fit Q_k to the marginalised points
rotation.fit(marginalised_points)
# today (rbig)
# x_k = Q_k g_k(x_{k−1}), (sample, state)
new_state: SampleState = rotation.transform(marginalised_points)
return marginal, rotation, new_stateWe run thirty layers with PCA rotations, and thirty with a fresh random rotation from the Haar measure in each layer, keeping every fitted layer and every state.
# Shapes: layer (K) = 30
layers = {"PCA": [], "random": []}
states = {"PCA": [samples], "random": [samples]}
for k in range(1, 31):
# today (rbig)
# the two rotations of layer k, unfitted
rotations = {
"PCA": rbig.PCARotation(whiten=False),
"random": rbig.RandomRotation(random_state=k),
}
for kind, rotation in rotations.items():
# user
# g_k and x_k, with Q_k fitted in place, (sample, state)
marginal: rbig.MarginalGaussianize
state: SampleState
marginal, _, state = fit_layer(states[kind][-1], rotation)
layers[kind].append((marginal, rotation))
states[kind].append(state)Both latents have identity covariance to within 0.001, so we compare them by along the loop.
for kind in ["PCA", "random"]:
# the covariance of x_30, (state, state)
covariance: Float[ArrayLike, "state state"] = np.cov(states[kind][-1].T)
# user
# KS_max of x_k after selected numbers of layers
trace: list[str] = [
f"{projection_ks(states[kind][k]):.3f}" for k in (1, 2, 4, 8, 12, 30)
]
print(
f"{kind:6s} covariance {covariance.round(3).tolist()}, KS_max after 1, 2, 4, 8, 12, 30 layers: {trace}"
)PCA covariance [[1.0, 0.0], [0.0, 1.0]], KS_max after 1, 2, 4, 8, 12, 30 layers: ['0.145', '0.090', '0.050', '0.051', '0.051', '0.052']
random covariance [[0.999, -0.001], [-0.001, 1.001]], KS_max after 1, 2, 4, 8, 12, 30 layers: ['0.146', '0.087', '0.056', '0.040', '0.032', '0.009']
shown = [1, 2, 4, 12, 30]
fig, axes = plt.subplots(2, len(shown), figsize=(12.5, 5.2), sharex=True, sharey=True)
for row, kind in enumerate(["PCA", "random"]):
for ax, layer in zip(axes[row], shown, strict=True):
shown_points = states[kind][layer][::2]
ax.scatter(
shown_points[:, 0], shown_points[:, 1], color=LATENT_COLOR, **SCATTER_KW
)
ax.set(
title=f"{kind}, after {layer} layer{'s' if layer > 1 else ''}",
xlim=(-4, 4),
ylim=(-4, 4),
)
ax.set_aspect("equal")
style_ax(ax)
fig.tight_layout()
plt.show()
Figure 2:The state of two moons after 1, 2, 4, 12 and 30 RBIG layers, with PCA rotations (top) and random rotations (bottom), every second point shown. With PCA the loop settles by layer 4 on a four-armed shape that it never leaves; with random rotations the arms keep blurring into a round cloud.
With PCA rotations the loop stalls: falls to about 0.05 by layer 4 and stays there, almost twice the null quantile, while the four-armed shape in the figure stays put. Once each coordinate is Gaussian and the two are uncorrelated, PCA has no correlation left to rotate away and the marginal step has almost nothing to fix, so later layers change little. We measure how far the last PCA marginal step moves any point.
# user
# ĝ_30, the last PCA marginal step
last_marginal: rbig.MarginalGaussianize
last_marginal, _ = layers["PCA"][-1]
# today (rbig)
# maxₙ,d |g_30(x_29)_d − x_29,d|
largest_move: float = np.abs(
last_marginal.transform(states["PCA"][-2]) - states["PCA"][-2]
).max()
print(f"largest move of the 30th PCA marginal step: {largest_move:.4f}")largest move of the 30th PCA marginal step: 0.0155
The thirtieth marginal step moves no point by more than 0.02. Random rotations do not stall, because every new rotation shows the next marginal step directions in which the projections are not yet Gaussian, and after thirty layers is inside the null band. The stopping rule and the choice of rotation are the subjects of the next notebooks; from here on we use the random-rotation stack.
3. Running the stack backwards¶
Every layer is invertible, so the stack is too. The inverse of layer undoes the rotation and then the marginal map,
and the inverse of the stack applies these from layer down to layer 1. We check it with a round trip on the training data.
# z = x_K, the latent of the random-rotation stack, (sample, state)
latent: SampleState = states["random"][-1]
# user
# x = f_1⁻¹ ∘ … ∘ f_K⁻¹(z), with rbig's inverses
def invert_stack(points: SampleState) -> SampleState:
"""Run ``points`` back through every random-rotation layer, from the last to the first."""
for marginal, rotation in reversed(layers["random"]):
# today (rbig)
# Qₖᵀ z, (sample, state)
points: SampleState = rotation.inverse_transform(points)
# today (rbig)
# g_k⁻¹, (sample, state)
points: SampleState = marginal.inverse_transform(points)
return pointsWe measure the largest error of each point.
PerSample = Float[ArrayLike, " sample"]
# user
# x̂ = f⁻¹(f(x)), (sample, state)
recovered: SampleState = invert_stack(latent)
# the largest |x̂ − x| over the coordinates of each point, (sample)
round_trip_error: PerSample = np.max(np.abs(recovered - samples), axis=1)
print(
f"round trip: median {np.median(round_trip_error):.1e}, max {round_trip_error.max():.2f}"
)round trip: median 6.6e-03, max 0.23
The round trip is not exact: points come back up to about 0.2 away, in standardised units where the data span about 4. The cause is one marginal map. rbig.MarginalGaussianize places the sorted data at the midpoint levels (1) on the way forward, but its inverse_transform interpolates the sorted data at the levels , so a point comes back shifted towards a neighbour by up to half the gap between them. The shift is largest in the tails, where the gaps are widest, and the layers above compound it. Interpolating at the midpoint levels instead makes each marginal map invert its own forward map. This is a bug in rbig (rbig#161); until it is fixed we use our own inverse.
# user
# g_k⁻¹(z)_d = the sorted data of coordinate d interpolated at Φ(z_d), on the midpoint levels
def midpoint_inverse(
marginal: rbig.MarginalGaussianize, points: SampleState
) -> SampleState:
"""The inverse of ``marginal`` with the levels of its forward map."""
# (n − 1/2) / N for n = 1, …, N, (sample)
levels: PerSample = (np.arange(len(marginal.support_)) + 0.5) / len(
marginal.support_
)
# x_d = F̂⁻¹(Φ(z_d)) for each coordinate d, (sample, state)
columns: list[PerSample] = [
np.interp(stats.norm.cdf(points[:, d]), levels, marginal.support_[:, d])
for d in range(points.shape[1])
]
return np.stack(columns, axis=1)The stack’s inverse runs it in every layer.
# user
# x = f_1⁻¹ ∘ … ∘ f_K⁻¹(z), with the midpoint inverses
def invert_midpoint(stack, points: SampleState) -> SampleState:
"""Run ``points`` back through ``stack`` with the midpoint inverse in every layer."""
for marginal, rotation in reversed(stack):
# today (rbig)
# Qₖᵀ z, (sample, state)
points: SampleState = rotation.inverse_transform(points)
# user
# g_k⁻¹ on the midpoint levels, (sample, state)
points: SampleState = midpoint_inverse(marginal, points)
return pointsWe run the round trip again with it.
# user
# x̂ = f⁻¹(f(x)), with the midpoint inverses, (sample, state)
recovered_midpoint: SampleState = invert_midpoint(layers["random"], latent)
# the largest |x̂ − x| over the coordinates of each point, (sample)
midpoint_error: PerSample = np.max(np.abs(recovered_midpoint - samples), axis=1)
print(
f"round trip: median {np.median(midpoint_error):.1e}, max {midpoint_error.max():.1e}"
)round trip: median 3.3e-16, max 9.2e-12
With matching levels the stack inverts itself to rounding error.
4. Generation¶
Running the stack backwards from fresh standard-normal draws, as in (4), generates new data. How good the samples are depends on the latent being Gaussian, and on the marginal maps. The empirical CDF knows nothing between and beyond its training points, so its inverse interpolates linearly between them; the smooth Gaussian-mixture CDFs of Part 1 fill in between with a density. gauss_flows_models.inference.fit_rbig builds such a stack in closed form, each layer a PCA rotation followed by a per-coordinate Gaussian-mixture marginal fitted by EM to the current state. It offers no other rotation.
# Shapes: sample = 3,000 generated points
# today (gauss_flows)
# twelve layers of a PCA rotation and a 12-component mixture marginal, fitted greedily
smooth_rbig: Transformed = fit_rbig(
jnp.asarray(samples, dtype=jnp.float32), n_layers=12, n_components=12
)
# z ~ 𝒩(0, I), (sample, latent)
draws: Float[ArrayLike, "sample latent"] = rng.standard_normal((3000, 2))
# user
# x = f⁻¹(z) through the two empirical stacks, with the midpoint inverses
generated: dict[str, SampleState] = {
kind: invert_midpoint(layers[kind], draws) for kind in ["PCA", "random"]
}
# today (gauss_flows)
# x = f⁻¹(z) through the smooth stack, (sample, state)
generated["smooth"] = np.asarray(smooth_rbig.sample(jr.key(0), (3000,)))We score each set of samples by its distance to the noise-free moons, the share of points more than 0.3 from the curves, and compare it with a fresh draw of the dataset.
# today (scikit-learn)
# 20,000 noise-free points on the two half circles, standardised like the data, (test, state)
curve: Float[ArrayLike, "test state"] = (
make_moons(n_samples=20000, noise=0.0, random_state=2)[0] - data_mean
) / data_std
# a fresh draw of the dataset, standardised like the data, (sample, state)
fresh: SampleState = (
make_moons(n_samples=3000, noise=0.07, random_state=1)[0] - data_mean
) / data_std
# a k-d tree over the curve points, for nearest-neighbour distances
curve_tree: cKDTree = cKDTree(curve)
for name, points in [("fresh data", fresh), *generated.items()]:
# the distance from each point to the nearest point of the curves, (sample)
distance: PerSample = curve_tree.query(points)[0]
print(
f"{name:10s} share farther than 0.3 from the curves: {np.mean(distance > 0.3):.1%}"
)fresh data share farther than 0.3 from the curves: 0.8%
PCA share farther than 0.3 from the curves: 17.7%
random share farther than 0.3 from the curves: 3.5%
smooth share farther than 0.3 from the curves: 5.2%
The stalled PCA stack puts about one sample in six off the crescents: its latent is not Gaussian, so fresh Gaussian draws land in regions that no training point mapped to. The random-rotation stack does better than the smooth one, about one in thirty against one in twenty, because the smooth stack inherits PCA rotations. Its latent is close to Gaussian but not inside the null band.
# today (gauss_flows)
# z = f(x) through the smooth stack, one point at a time, (sample, latent)
smooth_latent: Float[ArrayLike, "sample latent"] = jax.vmap(
smooth_rbig.bijection.inverse
)(jnp.asarray(samples, dtype=jnp.float32))
# user
# KS_max of the smooth latent
smooth_ks: float = projection_ks(np.asarray(smooth_latent))
print(
f"KS_max of the smooth latent {smooth_ks:.3f}, null 95% quantile {null_threshold:.3f}"
)KS_max of the smooth latent 0.032, null 95% quantile 0.028
5. The density¶
The smooth stack also has a density, from (5) with every log-determinant exact. On standard-normal data it should recover the standard-normal log-density, which we can compute directly.
# Shapes: sample = 4,000 standard-normal points
# z ~ 𝒩(0, I), (sample, state)
gaussian_points: SampleState = jnp.asarray(
rng.standard_normal((4000, 2)), dtype=jnp.float32
)
# today (gauss_flows)
# the smooth RBIG of the standard-normal points
gaussian_rbig: Transformed = fit_rbig(gaussian_points, n_layers=12, n_components=12)
# today (gauss_flows)
# the mean log-density (1/N) ∑ₙ log p̂(xₙ)
mean_log_density: float = gaussian_rbig.log_prob(gaussian_points).mean()
# the exact mean (1/N) ∑ₙ log 𝒩(xₙ; 0, I)
exact_log_density: float = stats.norm.logpdf(gaussian_points).sum(axis=1).mean()
print(
f"mean log-density: smooth RBIG {mean_log_density:.4f}, exact {exact_log_density:.4f}"
)mean log-density: smooth RBIG -2.8372, exact -2.8323
The two agree to about 0.005. On two moons we evaluate the density on a grid over the square .
# Shapes: test = 14,400 grid points; grid_line = 120
# 120 evenly spaced values on [−2.5, 2.5], (grid_line)
grid_axis: Float[ArrayLike, " grid_line"] = np.linspace(-2.5, 2.5, 120)
# the two coordinates of every grid point, (grid_line, grid_line), (grid_line, grid_line)
grid_x: Float[ArrayLike, "grid_line grid_line"]
grid_y: Float[ArrayLike, "grid_line grid_line"]
grid_x, grid_y = np.meshgrid(grid_axis, grid_axis)
# the grid points as rows, (test, state)
grid_points: Float[ArrayLike, "test state"] = np.column_stack(
[grid_x.ravel(), grid_y.ravel()]
)
# today (gauss_flows)
# log p̂(x) at every grid point, (test)
grid_log_density: Float[ArrayLike, " test"] = np.asarray(
smooth_rbig.log_prob(jnp.asarray(grid_points, dtype=jnp.float32))
)We count the grid points where it is finite.
# whether log p̂(x) is finite, (test)
finite: Float[ArrayLike, " test"] = np.isfinite(grid_log_density)
print(f"grid points with a finite log-density: {finite.mean():.0%}")
print(f"lowest finite log-density: {grid_log_density[finite].min():.3g}")grid points with a finite log-density: 68%
lowest finite log-density: -3.01e+05
About a third of the grid has a log-density of , and some of the rest has absurdly low values. A point beyond the data is pushed further from the origin by every mixture marginal, whose tails are lighter than a standard normal’s. Once it is about a thousand component widths from every component, the log-space probit inside MixtureGaussianCDF returns NaN, which log_prob reports as ; that is a bug in gauss_flows (gauss_flows#248), not an underflow, and with it fixed almost every grid point gets a finite, if extremely low, log-density. Near the data the density is finite and higher than in the gaps between the crescents, but it is far from smooth: straight ridges cross the square, and some of the smooth samples follow them. Notebook 03 of this part deals with tails and support. The figure leaves the points with a log-density of white and floors the colour scale at -8.
fig, axes = plt.subplots(1, 5, figsize=(16.5, 3.7), sharex=True, sharey=True)
scatters = {
"data": samples,
**{f"{name} RBIG": points for name, points in generated.items()},
}
for ax, (title, points) in zip(axes, scatters.items(), strict=False):
ax.scatter(
points[:, 0],
points[:, 1],
color=DATA_COLOR if title == "data" else LATENT_COLOR,
**SCATTER_KW,
)
ax.set(title=title)
shown_log_density = np.ma.masked_invalid(
np.where(finite, np.maximum(grid_log_density, -8.0), np.nan)
).reshape(grid_x.shape)
axes[4].contourf(
grid_x, grid_y, shown_log_density, levels=np.linspace(-8, 1, 19), cmap="viridis"
)
axes[4].set(title="smooth RBIG log-density")
for ax in axes:
ax.set(xlim=(-2.5, 2.5), ylim=(-2.5, 2.5), xlabel="first coordinate")
ax.set_aspect("equal")
style_ax(ax)
axes[4].grid(False)
axes[0].set_ylabel("second coordinate")
fig.tight_layout()
plt.show()
Figure 3:From left to right: the data, samples generated by the empirical RBIG stacks with PCA and with random rotations (both with the midpoint inverse), samples from the smooth RBIG of gauss_flows, and the smooth stack’s log-density on the grid. The stalled PCA stack scatters points between and around the crescents. White grid cells are where the log-density is minus infinity.
Recap¶
| Piece | Equation | In code |
|---|---|---|
| the midpoint empirical CDF | (1) | rbig.MarginalGaussianize |
| the marginal step of layer | (2) | MarginalGaussianize().fit(x_{k-1}) |
| the rotation of layer | (3) | rbig.PCARotation(whiten=False), or rbig.RandomRotation |
| one layer and the stack | (3), (2) | fit_layer, thirty times |
| a joint test of Gaussianity | (3) | projection_ks |
| the inverse | (4) | inverse_transform, or midpoint_inverse for an exact round trip |
| generation | (4) | invert_midpoint on draws, smooth_rbig.sample |
| the density | (5) | smooth_rbig.log_prob, finite on the data |
Next. We fitted a fixed thirty layers. The next notebook asks how many a dataset needs, and how to tell from the data when to stop.
- Laparra, V., Camps-Valls, G., & Malo, J. (2011). Iterative Gaussianization: From ICA to Random Rotations. IEEE Transactions on Neural Networks, 22(4), 537–549. 10.1109/TNN.2011.2106511