# PCA for sparse matrices, tolerance of eigenvalues Classic List Threaded 4 messages Open this post in threaded view
|

## PCA for sparse matrices, tolerance of eigenvalues

 Dear all,I tried using the 'scipy.sparse.eigs' tool for performing principal component analysis on a matrix which is roughly 80% sparse. First of all, is that a good way to go about it?Second, the operation failed when the function failed to converge on accurate eigenvalues. I noticed the 'tol' attribute in the function, but how does one define a reasonable tolerance and calculate it? Thanks _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user
Open this post in threaded view
|

## Re: PCA for sparse matrices, tolerance of eigenvalues

 Thu, 24 Feb 2011 09:58:00 +0530, Jaidev Deshpande wrote: > I tried using the 'scipy.sparse.eigs' tool for performing principal > component analysis on a matrix which is roughly 80% sparse. > > First of all, is that a good way to go about it? If it doesn't work as a dense matrix, then you don't have much choice than to rely on an iterative method. 'eigs' uses ARPACK. > Second, the operation failed when the function failed to converge on > accurate eigenvalues. I noticed the 'tol' attribute in the function, but > how does one define a reasonable tolerance and calculate it? As the docstring states, `tol` is the desired relative tolerance for the eigenvalue. One should expect that the error is approximately         abs(exact_value - estimate) < tol*abs(exact_value) You can also try increasing `maxiter` or `ncv` to make it try harder to reach convergence. What are reasonable values for these paremeters depends on the problem in question. You can consult the ARPACK user guide for more:         http://www.sc.fsu.edu/~burkardt/pdf/arpack.pdfCheck e.g. the section on "Stopping criterion". _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user