mlpack  1.0.12
Public Member Functions | Static Public Member Functions | List of all members
mlpack::amf::NMFALSUpdate Class Reference

This class implements a method titled 'Alternating Least Squares' described in the paper 'Positive Matrix Factorization: A Non-negative Factor Model with Optimal Utilization of Error Estimates of Data Values' by P Paatero and U Tapper. More...

Public Member Functions

 NMFALSUpdate ()
 Empty constructor required for the UpdateRule template. More...
 
template<typename MatType >
void Initialize (const MatType &dataset, const size_t rank)
 

Static Public Member Functions

template<typename MatType >
static void HUpdate (const MatType &V, const arma::mat &W, arma::mat &H)
 The update rule for the encoding matrix H. More...
 
template<typename MatType >
static void WUpdate (const MatType &V, arma::mat &W, const arma::mat &H)
 The update rule for the basis matrix W. More...
 

Detailed Description

This class implements a method titled 'Alternating Least Squares' described in the paper 'Positive Matrix Factorization: A Non-negative Factor Model with Optimal Utilization of Error Estimates of Data Values' by P Paatero and U Tapper.

It uses least squares projection formula to reduce the error value of $ \sqrt{\sum_i \sum_j(V-WH)^2} $ by alternately calculating W and H respectively while holding the other matrix constant.

Definition at line 30 of file nmf_als.hpp.

Constructor & Destructor Documentation

mlpack::amf::NMFALSUpdate::NMFALSUpdate ( )
inline

Empty constructor required for the UpdateRule template.

Definition at line 34 of file nmf_als.hpp.

Member Function Documentation

template<typename MatType >
static void mlpack::amf::NMFALSUpdate::HUpdate ( const MatType &  V,
const arma::mat &  W,
arma::mat &  H 
)
inlinestatic

The update rule for the encoding matrix H.

The formula used is

\[ H = \frac{W^TV}{W^TW} \]

The function takes in all the matrices and only changes the value of the H matrix.

Parameters
VInput matrix to be factorized.
WBasis matrix.
HEncoding matrix to be updated.

Definition at line 87 of file nmf_als.hpp.

template<typename MatType >
void mlpack::amf::NMFALSUpdate::Initialize ( const MatType &  dataset,
const size_t  rank 
)
inline

Definition at line 37 of file nmf_als.hpp.

template<typename MatType >
static void mlpack::amf::NMFALSUpdate::WUpdate ( const MatType &  V,
arma::mat &  W,
const arma::mat &  H 
)
inlinestatic

The update rule for the basis matrix W.

The formula used is

\[ W^T = \frac{HV^T}{HH^T} \]

The function takes in all the matrices and only changes the value of the W matrix.

Parameters
VInput matrix to be factorized.
WBasis matrix to be updated.
HEncoding matrix.

Definition at line 56 of file nmf_als.hpp.


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