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

MLPACK Trac trac at coffeetalk-1.cc.gatech.edu
Fri May 10 16:06:01 EDT 2013


#204: PCA could be faster
----------------------------------+-----------------------------------------
  Reporter:  rcurtin              |        Owner:  rcurtin     
      Type:  enhancement          |       Status:  assigned    
  Priority:  minor                |    Milestone:  mlpack 1.0.6
 Component:  mlpack               |   Resolution:              
  Keywords:  pca transpose trans  |     Blocking:              
Blocked By:                       |  
----------------------------------+-----------------------------------------
Changes (by rcurtin):

  * keywords:  pca kpca transpose trans => pca transpose trans
  * owner:  mamidon => rcurtin
  * milestone:  mlpack 1.1.0 => mlpack 1.0.6


Old description:

> 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.

New description:

 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);

   ...
 }
 }}}

 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.

--

Comment:

 r15050, which was to fix #280, significantly helps this along too.  Only
 PCA remains.

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