[SciPy-user] getting the "best" two eigenvectors for a PCA analysis with a power method

Robert Kern rkern at ucsd.edu
Fri Aug 26 19:57:24 CDT 2005

Syd Diamond wrote:
> I'll be honest -- I'm mostly interested in the end not the means right
> now.  I need to find the first and second principal components of a
> 120x520 matrix.
> Right now, I'm using the "from LinearAlgebra import eigenvectors"
> method to find eigenvectors of the covariance matrix.  This worked
> fine for my 120x90 matrix, but it's choking on the 120x520 matrix. 

Use the SVD instead (after subtracting out the mean vector). It's
equivalent. It works quite quickly on my G4 Powerbook with a 120x520 matrix.

Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter

More information about the SciPy-user mailing list