[mlpack-svn] [MLPACK] #166: PCA fails comparison with MATLAB

MLPACK Trac trac at coffeetalk-1.cc.gatech.edu
Mon Nov 28 01:07:40 EST 2011


#166: PCA fails comparison with MATLAB
----------------------+-----------------------------------------------------
 Reporter:  rcurtin   |        Owner:  ajinkya                                      
     Type:  defect    |       Status:  new                                          
 Priority:  critical  |    Milestone:  MLPACK 1.0                                   
Component:  MLPACK    |     Keywords:  pca incorrect dimensionality reduction matlab
 Blocking:  126       |   Blocked By:                                               
----------------------+-----------------------------------------------------
 So, I hate to file a second bug against this in one day, but I wanted to
 be sure that PCA worked for dimensionality reduction and it does not
 appear that it does.

 I coded up a test case in pca_test.cpp [10433] but it does not work.  I
 took a very simple 3-dimensional dataset and used MATLAB to project the
 dimensions down to 2 using the following command:

 {{{
 >>> [a, b, c] = princomp(X) % X is our fake dataset
 }}}

 and in that case, `a` is the PC coefficients, `b` is the transformed data
 (what I am comparing against), and `c` is the eigenvalues of the
 covariance.  `c` appears to be correct (although I am not explicitly
 checking that in the test case I wrote).

 I suspect that this may have to do with an incorrect transformation.  When
 transforming the input data to the principal component space, the mean
 must not be present in the data.

 Also, is it possible to reduce code duplication in Apply()?  I see a lot
 of the same...

-- 
Ticket URL: <http://trac.research.cc.gatech.edu/fastlab/ticket/166>
MLPACK <www.fast-lab.org>
MLPACK is an intuitive, fast, and scalable C++ machine learning library developed by the FASTLAB at Georgia Tech under Dr. Alex Gray.


More information about the mlpack-svn mailing list