[mlpack-svn] [MLPACK] #204: PCA and KPCA could be faster

MLPACK Trac trac at coffeetalk-1.cc.gatech.edu
Tue Feb 28 11:38:05 EST 2012


#204: PCA and KPCA could be faster
-------------------------+--------------------------------------------------
 Reporter:  rcurtin      |        Owner:                          
     Type:  enhancement  |       Status:  new                     
 Priority:  minor        |    Milestone:  mlpack 1.1.0            
Component:  mlpack       |     Keywords:  pca kpca transpose trans
 Blocking:               |   Blocked By:                          
-------------------------+--------------------------------------------------
 Right now we are transposing the data matrices:

 {{{

 void PCA::Apply(const arma::mat& data,
                 arma::mat& transformedData,
                 arma::vec& eigVal,
                 arma::mat& coeffs) const
 {
   arma::mat transData = trans(data);

   ...
 }
 }}}

 {{{
 template <typename KernelType>
 void KernelPCA<KernelType>::Apply(const arma::mat& data,
                                   arma::mat& transformedData,
                                   arma::vec& eigVal,
                                   arma::mat& coeffs)
 {
   arma::mat transData = trans(data);

   ...
 }
 }}}

 I'm convinced we could avoid transposing the matrices and end up with a
 speed gain as a result.  There is a function in arma_extend,
 `arma::ccov()`, which will be useful for this.  It's the equivalent to
 `cov(trans(matrix))`, but without actually performing the transpose.

-- 
Ticket URL: <https://trac.research.cc.gatech.edu/fastlab/ticket/204>
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