Data Transformation

Whitening

A whitening transformation is a decorrelation transformation that transforms a set of random variables into a set of new random variables with identity covariance (uncorrelated with unit variances).

In particular, suppose a random vector has covariance $\mathbf{C}$, then a whitening transform $\mathbf{W}$ is one that satisfy:

\[ \mathbf{W}^T \mathbf{C} \mathbf{W} = \mathbf{I}\]

Note that $\mathbf{W}$ is generally not unique. In particular, if $\mathbf{W}$ is a whitening transform, so is any of its rotation $\mathbf{W} \mathbf{R}$ with $\mathbf{R}^T \mathbf{R} = \mathbf{I}$.

The package uses Whitening to represent a whitening transform.

Whitening transformation can be fitted to data using the fit method.

StatsAPI.fitMethod
fit(Whitening, X::AbstractMatrix{T}; kwargs...)

Estimate a whitening transform from the data given in X.

This function returns an instance of Whitening

Keyword Arguments:

  • regcoef: The regularization coefficient. The covariance will be regularized as follows when regcoef is positive C + (eigmax(C) * regcoef) * eye(d). Default values is zero(T).

  • dims: if 1 the transformation calculated from the row samples. fit standardization parameters in column-wise fashion; if 2 the transformation calculated from the column samples. The default is nothing, which is equivalent to dims=2 with a deprecation warning.

  • mean: The mean vector, which can be either of:

    • 0: the input data has already been centralized
    • nothing: this function will compute the mean (default)
    • a pre-computed mean vector

Note: This function internally relies on cov_whitening to derive the transformation W.

source
MultivariateStats.transformMethod
transform(f, x)

Apply the whitening transform f to a vector or a matrix x with samples in columns, as $\mathbf{W}^T (\mathbf{x} - \boldsymbol{\mu})$.

source
Statistics.meanMethod
mean(f)

Get the mean vector of the whitening transformation f.

Note: if mean is empty, this function returns a zero vector of length(f).

source
Base.sizeMethod
size(f)

Dimensions of the coefficient matrix of the whitening transform f.

source

Additional methods

MultivariateStats.cov_whiteningFunction
cov_whitening(C)

Derive the whitening transform coefficient matrix W given the covariance matrix C. Here, C can be either a square matrix, or an instance of Cholesky.

Internally, this function solves the whitening transform using Cholesky factorization. The rationale is as follows: let $\mathbf{C} = \mathbf{U}^T \mathbf{U}$ and $\mathbf{W} = \mathbf{U}^{-1}$, then $\mathbf{W}^T \mathbf{C} \mathbf{W} = \mathbf{I}$.

Note: The return matrix W is an upper triangular matrix.

source
cov_whitening(C, regcoef)

Derive a whitening transform based on a regularized covariance, as C + (eigmax(C) * regcoef) * eye(d).

source
MultivariateStats.cov_whitening!Function
cov_whitening!(C)

In-place version of cov_whitening(C), in which the input matrix C will be overwritten during computation. This can be more efficient when C is no longer used.

source
cov_whitening!(C, regcoef)

In-place version of cov_whitening(C, regcoef), in which the input matrix C will be overwritten during computation. This can be more efficient when C is no longer used.

source