How to whiten matrix in PCA

Viewed 23160

I'm working with Python and I've implemented the PCA using this tutorial.

Everything works great, I got the Covariance I did a successful transform, brought it make to the original dimensions not problem.

But how do I perform whitening? I tried dividing the eigenvectors by the eigenvalues:

S, V = numpy.linalg.eig(cov)
V = V / S[:, numpy.newaxis]

and used V to transform the data but this led to weird data values. Could someone please shred some light on this?

4 Answers

Use ZCA mapping instead

function [Xw] = whiten(X)
  % Compute and apply the ZCA mapping
  mu_X = mean(X, 1);
  X = bsxfun(@minus, X, mu_X);
  Xw = X / sqrtm(cov(X));
end 
Related