Re: Can't perform PCA
- From: Peter Perkins <pperkinsRemove@xxxxxxxxxxxxxxxxx>
- Date: Sat, 08 Dec 2007 04:52:33 GMT
Dave Krebs wrote:
My data set is too large for me to use the built-in Matlab functions such as "processpca" to compute principal components due to memory limitations.
Does anyone have an m-file that performs PCA interatively, returning one component at a time, or any algorithm that allows PCA to be performed in some way without computing the entire covariance matrix?
Dave, do you have access to the Statistics Toolbox? There is no good reason to compute the cov matrix, and at least two reasons not to. The PRINCOMP function computes a PCA directly from the data. If your data are wide, you'll want to use the 'econ' flag:
>> help princomp
PRINCOMP Principal Components Analysis.
[snip]
[...] = PRINCOMP(X,'econ') returns only the elements of LATENT that are
not necessarily zero, i.e., when N <= P, only the first N-1, and the
corresponding columns of COEFF and SCORE. This can be significantly
faster when P >> N.
Since you mention computing the cov matrix as the problem, I'm guessing your data _are_ wide.
That being said, there are any number of implementations of the NIPALS algorithm in MATLAB out there; that may be what you're looking for, but I'd look at PRINCOMP first.
Hope this helps.
- Peter Perkins
The MathWorks, Inc.
.
- Follow-Ups:
- Re: Can't perform PCA
- From: Bruno Luong
- Re: Can't perform PCA
- References:
- Can't perform PCA
- From: Dave Krebs
- Can't perform PCA
- Prev by Date: Re: Conversion of Columns into Decimals
- Next by Date: Implementing a Phaser in MATLAB
- Previous by thread: Re: Can't perform PCA
- Next by thread: Re: Can't perform PCA
- Index(es):
Relevant Pages
|