mlpack
Public Member Functions | List of all members
mlpack::cf::SVDWrapper< Factorizer > Class Template Reference

This class acts as the wrapper for all SVD factorizers which are incompatible with CF module. More...

#include <svd_wrapper.hpp>

Public Member Functions

 SVDWrapper (const Factorizer &factorizer=Factorizer())
 
double Apply (const arma::mat &V, arma::mat &W, arma::mat &sigma, arma::mat &H) const
 Factorizer function which takes SVD of the given matrix and returns the frobenius norm of error. More...
 
double Apply (const arma::mat &V, size_t r, arma::mat &W, arma::mat &H) const
 Factorizer function which computes SVD and returns matrices as required by CF module. More...
 
template<>
double Apply (const arma::mat &V, arma::mat &W, arma::mat &sigma, arma::mat &H) const
 
template<>
double Apply (const arma::mat &V, size_t r, arma::mat &W, arma::mat &H) const
 

Detailed Description

template<class Factorizer = DummyClass>
class mlpack::cf::SVDWrapper< Factorizer >

This class acts as the wrapper for all SVD factorizers which are incompatible with CF module.

Normally SVD factrorizers implement Apply method which takes matrix V and factorizes it into P, sigma and Q where V = P * sigma * trans(Q). But CF module requires factrorization to be V = W * H. This class multiplies P and sigma and takes the first 'r' eigenvectors out where 'r' is the rank of factorization. Q matrix is transposed and trimmed to support the rank of factorization. The Factroizer class should implement Apply which takes matrices P, sigma, Q and V as their parameter respectively.

Member Function Documentation

◆ Apply() [1/2]

template<class Factorizer >
double mlpack::cf::SVDWrapper< Factorizer >::Apply ( const arma::mat &  V,
arma::mat &  W,
arma::mat &  sigma,
arma::mat &  H 
) const

Factorizer function which takes SVD of the given matrix and returns the frobenius norm of error.

Parameters
Vinput matrix
Wfirst unitary matrix
sigmaeigenvalue matrix
Hsecond unitary matrix
Note
V = W * sigma * arma::trans(H)

◆ Apply() [2/2]

template<class Factorizer >
double mlpack::cf::SVDWrapper< Factorizer >::Apply ( const arma::mat &  V,
size_t  r,
arma::mat &  W,
arma::mat &  H 
) const

Factorizer function which computes SVD and returns matrices as required by CF module.

Parameters
Vinput matrix
rrank
Wfirst unitary matrix
Hsecond unitary matrix
Note
V = W * H

The documentation for this class was generated from the following files: