4.8

4.8 | 6 ratings Rate this file 229 downloads (last 30 days) File Size: 5.45 KB File ID: #21524

Principal Component Analysis

by Mark Tygert

 

23 Sep 2008 (Updated 06 Feb 2009)

Code covered by BSD License  

Efficient, accurate principal component analysis

Download Now | Watch this File

File Information
Description

The enclosed function PCA implements what is probably the method of choice for computing principal component analyses fairly efficiently, while guaranteeing nearly optimal accuracy. The enclosed function DIFFSNORM provides an efficient, reliable means for checking the accuracies of the low-rank approximations produced by PCA (often the accuracies are slightly better than recently proven bounds guarantee).

Though recently obtained proofs guarantee the accuracy and efficiency of the algorithms implemented in these functions, the enclosed m-files should be considered to be in the beta-testing phase. Although the author has subjected the routines to a battery of tests, he would not be surprised if the functions respond inappropriately to sufficiently bizarre errant input.

Please note that these functions are tailored for the low-rank approximation of large matrices (both dense and sparse).

MATLAB release MATLAB 7.6 (R2008a)
Zip File Content  
Other Files diffsnorm.m,
pca.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (9)
26 Sep 2008 Mark Tygert

Sometimes the QR decomposition in the function PCA takes inordinately long compared to squaring a matrix of the same size. This presumably will not change until the recently introduced communication-avoiding QR decompositions become part of the LAPACK suites.

30 Jan 2009 Christos Boutsidis

Excellent implementation of a fast PCA method...

04 Feb 2009 Henry Nguyen  
05 Feb 2009 Henry Nguyen  
17 Mar 2009 Gabriel Akira Schreiber  
04 Apr 2009 Jon Jackson

Works really well, thanks. Is it possible to get the percentage of the explained variance for each component?

06 May 2009 Wolfgang  
06 May 2009 Wolfgang

But the same question as Jon Jackson. Is it possible to get the explained variances when i just compute (for example) the first three components?

30 Oct 2009 nsmaan Singh

Hello, This is the first time I am trying to use matlab. Since I only have fairly small job to do I am not trying to delve too deep. I have a 5000x5000 matrix like this (just a part...n=till 5000)
 1.0 0.2 0.3 0.1.........n
0.2 1.0 0.1 0.3.........n
0.3 0.1 1.0 0.2..........n
... ... ... ...
n n n n
  
I have been using SpotFire so far for PCA analysis, but this matrix is too huge for its memory, hence trying matlab.
Any help on how i can decompose it into 3 PC's would be greatly appreciated.
Thank you

 

Please login to add a comment or rating.
Updates
25 Sep 2008

Improvements to the documentation and slight performance enhancement

25 Sep 2008

Minor bug fix

26 Sep 2008

Performance enhancement

29 Sep 2008

Performance enhancement

29 Sep 2008

Performance enhancement

10 Oct 2008

Enhancement for complex arithmetic

13 Oct 2008

The zip file did not get updated during my last submission

13 Oct 2008

Improved documentation

16 Oct 2008

Updated documentation

03 Nov 2008

Improved memory management

02 Feb 2009

Reduced memory requirements

06 Feb 2009

PCA now will not transpose the matrix being approximated.

Tag Activity for this File
Tag Applied By Date/Time
statistics Mark Tygert 22 Oct 2008 10:20:55
probability Mark Tygert 22 Oct 2008 10:20:55
pca Mark Tygert 22 Oct 2008 10:20:55
svd Mark Tygert 22 Oct 2008 10:20:55
lanczos Mark Tygert 22 Oct 2008 10:20:55
power Mark Tygert 22 Oct 2008 10:20:55
sparse Mark Tygert 22 Oct 2008 10:20:55
principal components analysis Mark Tygert 22 Oct 2008 10:20:55
principal components analysis amine moutaouakil 02 Nov 2008 22:29:08
mathematics Mark Tygert 03 Nov 2008 16:50:58
mathematics Cristina McIntire 07 Nov 2008 12:57:08
probability Cristina McIntire 10 Nov 2008 11:05:33
statistics Cristina McIntire 10 Nov 2008 11:05:35
sparse Henry Nguyen 04 Feb 2009 22:40:05
sparse Anjali Samani 03 Mar 2009 10:01:01
pca Mark 26 May 2009 09:28:55
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com