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.
MultivariateStats.Whitening — TypeA whitening transform representation.
Whitening transformation can be fitted to data using the fit method.
StatsAPI.fit — Methodfit(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 whenregcoefis positiveC + (eigmax(C) * regcoef) * eye(d). Default values iszero(T).dims: if1the transformation calculated from the row samples. fit standardization parameters in column-wise fashion; if2the transformation calculated from the column samples. The default isnothing, which is equivalent todims=2with a deprecation warning.mean: The mean vector, which can be either of:0: the input data has already been centralizednothing: 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.
MultivariateStats.transform — Methodtransform(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})$.
Base.length — Methodlength(f)Get the dimension of the whitening transform f.
Statistics.mean — Methodmean(f)Get the mean vector of the whitening transformation f.
Note: if mean is empty, this function returns a zero vector of length(f).
Base.size — Methodsize(f)Dimensions of the coefficient matrix of the whitening transform f.
Additional methods
MultivariateStats.cov_whitening — Functioncov_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.
cov_whitening(C, regcoef)Derive a whitening transform based on a regularized covariance, as C + (eigmax(C) * regcoef) * eye(d).
MultivariateStats.cov_whitening! — Functioncov_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.
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.