Skip to content

Transforms

Normalising-flow transforms for OAK input preprocessing.

Provides a :class:SinhArcsinhTransform (a NumPyro Transform subclass) and convenience functions for fitting per-feature normalising flows that map raw inputs to approximately standard normal.

SinhArcsinhTransform

SinhArcsinhTransform(skewness, tailweight)

Bases: Transform

Jones & Pewsey (2009) sinh-arcsinh bijector.

.. math:: y = \sinh\bigl(\tau\,\operatorname{arcsinh}(x) - \varepsilon\bigr)

where :math:\varepsilon (skewness) is unconstrained and :math:\tau (tailweight) is strictly positive.

Parameters:

  • skewness –

    Skewness parameter :math:\varepsilon.

  • tailweight –

    Tailweight parameter :math:\tau > 0.

fit_normalising_flow

fit_normalising_flow(x_col: Array) -> ComposeTransform

Fit a per-feature normalising flow mapping raw values to ~N(0,1).

The bijector chain is Shift -> Log -> Standardise -> SinhArcsinh. Only the SinhArcsinh skewness and tailweight are optimised (via BFGS); the first three steps are determined by summary statistics of x_col.

Parameters:

  • x_col (Array) –

    1-D array of feature values (training data only).

Returns:

  • A ( ComposeTransform ) –

    class:~numpyro.distributions.transforms.ComposeTransform

  • ComposeTransform –

    mapping raw feature values to approximately standard normal.

fit_all_normalising_flows

fit_all_normalising_flows(
    X: Array,
) -> list[ComposeTransform]

Fit independent normalising flows for each column of X.

Parameters:

  • X (Array) –

    Array of shape (N, D).

Returns:

  • list[ComposeTransform] –

    List of D :class:~numpyro.distributions.transforms.ComposeTransform

  • list[ComposeTransform] –

    instances, one per feature.