A readable implementation of a monotone piecewise-linear spline flow. Each dimension is transformed independently using learned spline parameters.
splinepwlinflowmodel(d = 2, K = 8, theta = NULL)A flow model object with methods:
sampleq(n)
logq(z0)
applyflow(z0)
Dimension of the latent space.
Number of spline bins.
Optional parameter vector. If NULL, random initialization.
The spline flow uses:
\(K\) bins with learned widths \(w\) and heights \(h\)
a softmax transformation to ensure positivity and normalization
a sigmoid reparameterization for numerical stability
The flow is invertible and differentiable almost everywhere.