Learn R Programming

rareflow (version 0.1.0)

splinepwlinflowmodel: Piecewise-Linear Spline Flow (Monotone)

Description

A readable implementation of a monotone piecewise-linear spline flow. Each dimension is transformed independently using learned spline parameters.

Usage

splinepwlinflowmodel(d = 2, K = 8, theta = NULL)

Value

A flow model object with methods:

  • sampleq(n)

  • logq(z0)

  • applyflow(z0)

Arguments

d

Dimension of the latent space.

K

Number of spline bins.

theta

Optional parameter vector. If NULL, random initialization.

Details

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.