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?
Here’s a numpy implementation of some Matlab code for matrix whitening I got from here.
You can also whiten a matrix using SVD:
The second way is a bit slower, but probably more numerically stable.