Description Usage Arguments Details Value References Examples
whiten transforms a multivariate K-dimensional signal \mathbf{X} with mean
\boldsymbol μ_X and covariance matrix Σ_{X} to a whitened
signal \mathbf{U} with mean \boldsymbol 0 and Σ_U = I_K.
Thus it centers the signal and makes it contemporaneously uncorrelated.
See Details.
check_whitened checks if data has been whitened; i.e., if it has
zero mean, unit variance, and is uncorrelated.
sqrt_matrix computes the square root \mathbf{B} of a square matrix
\mathbf{A}. The matrix \mathbf{B} satisfies
\mathbf{B} \mathbf{B} = \mathbf{A}.
1 2 3 4 5 | whiten(data)
check_whitened(data, check.attribute.only = TRUE)
sqrt_matrix(mat, return.sqrt.only = TRUE, symmetric = FALSE)
|
data |
n \times K array representing |
check.attribute.only |
logical; if |
mat |
a square K \times K matrix. |
return.sqrt.only |
logical; if |
symmetric |
logical; if |
whiten uses zero component analysis (ZCA) (aka zero-phase whitening filters)
to whiten the data; i.e., it uses the
inverse square root of the covariance matrix of \mathbf{X} (see
sqrt_matrix) as the whitening transformation.
This means that on top of PCA, the uncorrelated principal components are
back-transformed to the original space using the
transpose of the eigenvectors. The advantage is that this makes them comparable
to the original \mathbf{X}. See References for details.
The square root of a quadratic n \times n matrix \mathbf{A} can be computed by using the eigen-decomposition of \mathbf{A}
\mathbf{A} = \mathbf{V} Λ \mathbf{V}',
where Λ is an n \times n matrix with the eigenvalues λ_1, …, λ_n in the diagonal. The square root is simply \mathbf{B} = \mathbf{V} Λ^{1/2} \mathbf{V}' where Λ^{1/2} = diag(λ_1^{1/2}, …, λ_n^{1/2}).
Similarly, the inverse square root is defined as \mathbf{A}^{-1/2} = \mathbf{V} Λ^{-1/2} \mathbf{V}', where Λ^{-1/2} = diag(λ_1^{-1/2}, …, λ_n^{-1/2}) (provided that λ_i \neq 0).
whiten returns a list with the whitened data, the transformation,
and other useful quantities.
check_whitened throws an error if the input is not
whitened, and returns (invisibly) the data with an attribute 'whitened'
equal to TRUE. This allows to simply update data to have the
attribute and thus only check it once on the actual data (slow) but then
use the attribute lookup (fast).
sqrt_matrix returns an n \times n matrix. If \mathbf{A}
is not semi-positive definite it returns a complex-valued \mathbf{B}
(since square root of negative eigenvalues are complex).
If return.sqrt.only = FALSE then it returns a list with:
values |
eigenvalues of \mathbf{A}, |
vectors |
eigenvectors of \mathbf{A}, |
sqrt |
square root matrix \mathbf{B}, |
sqrt.inverse |
inverse of \mathbf{B}. |
See appendix in http://www.cs.toronto.edu/~kriz/learning-features-2009-TR.pdf.
See http://ufldl.stanford.edu/wiki/index.php/Implementing_PCA/Whitening.
1 2 3 4 5 6 7 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.