Skip to content

RationalQuadraticSpline Bijector¤

distreqx.bijectors.RationalQuadraticSpline(distreqx.bijectors.AbstractForwardInverseBijector, distreqx.bijectors.AbstractInvLogDetJacBijector, distreqx.bijectors.AbstractFwdLogDetJacBijector) ¤

A rational-quadratic spline bijector.

This bijector is a monotonically increasing spline operating on an interval \([a, b]\), such that \(f(a) = a\) and \(f(b) = b\). Outside the interval \([a, b]\), the bijector defaults to a linear transformation whose slope matches that of the spline at the nearest boundary (either \(a\) or \(b\)). The range boundaries \(a\) and \(b\) are hyperparameters passed to the constructor.

References
@article{durkan2019neural,
    title={Neural Spline Flows},
    author={Durkan, Conor and Bekasov, Artur and Murray, Iain and
            Papamakarios, George},
    journal={arXiv:1906.04032},
    year={2019}
}
__init__(params: Array, range_min: float, range_max: float, boundary_slopes: str = 'unconstrained', min_bin_size: float = 0.0001, min_knot_slope: float = 0.0001) ¤

Initializes a RationalQuadraticSpline bijector.

Arguments:

  • params: array of shape [..., 3 * num_bins + 1], the unconstrained parameters of the bijector. The number of bins is implicitly defined by the last dimension of params. The parameters can take arbitrary unconstrained values; the bijector will reparameterize them internally and make sure they obey appropriate constraints. If params is the all-zeros array, the bijector becomes the identity function everywhere on the real line.
  • range_min: the lower bound of the spline's range. Below range_min, the bijector defaults to a linear transformation.
  • range_max: the upper bound of the spline's range. Above range_max, the bijector defaults to a linear transformation.
  • boundary_slopes: controls the behaviour of the slope of the spline at the range boundaries (range_min and range_max). Available options are:
    • "unconstrained": no boundary conditions are imposed; the slopes at the boundaries can vary freely.
    • "lower_identity": the slope of the spline is set equal to 1 at the lower boundary (range_min), making the bijector equal to the identity function for values less than range_min.
    • "upper_identity": as "lower_identity", but for the upper boundary (range_max).
    • "identity": combines "lower_identity" and "upper_identity", making the bijector equal to the identity function outside [range_min, range_max].
    • "circular": makes the slope at range_min and range_max be the same. Use this when the spline operates on a circle parameterized by an angle in [range_min, range_max], where range_min and range_max correspond to the same point.
  • min_bin_size: the minimum bin size, in either the x or the y axis. Should be a small positive number, chosen for numerical stability.
  • min_knot_slope: the minimum slope at each knot point. Should be a small positive number, chosen for numerical stability.