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

This follows a method described in the paper 'Algorithms for Non-negative. More...

#include <nmf_mult_div.hpp>

Public Member Functions

template<typename MatType >
void Initialize (const MatType &, const size_t)
 Initialize the factorization. More...
 
template<typename Archive >
void serialize (Archive &, const uint32_t)
 Serialize the object (in this case, there is nothing to serialize).
 

Static Public Member Functions

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

Detailed Description

This follows a method described in the paper 'Algorithms for Non-negative.

@inproceedings{lee2001algorithms,
title={Algorithms for non-negative matrix factorization},
author={Lee, D.D. and Seung, H.S.},
booktitle={Advances in Neural Information Processing Systems 13
(NIPS 2000)},
pages={556--562},
year={2001}
}

This is a multiplicative rule that ensures that the Kullback-Leibler divergence

\[ \sum_i \sum_j (V_{ij} \log\frac{V_{ij}}{(W H)_{ij}} - V_{ij} + (W H)_{ij}) \]

is non-increasing between subsequent iterations. Both of the update rules for W and H are defined in this file.

This set of update rules is not meant to work with sparse matrices. Using sparse matrices often causes NaNs in the output, so other choices of update rules are better in that situation.

Member Function Documentation

◆ HUpdate()

template<typename MatType >
static void mlpack::amf::NMFMultiplicativeDivergenceUpdate::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_{a\mu} \leftarrow H_{a\mu} \frac{\sum_{i} W_{ia} V_{i\mu}/(WH)_{i\mu}} {\sum_{k} H_{ka}} \]

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

◆ Initialize()

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

Initialize the factorization.

These rules don't store any state, so the input values are ignore.

◆ WUpdate()

template<typename MatType >
static void mlpack::amf::NMFMultiplicativeDivergenceUpdate::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_{ia} \leftarrow W_{ia} \frac{\sum_{\mu} H_{a\mu} V_{i\mu} / (W H)_{i\mu}} {\sum_{\nu} H_{a\nu}} \]

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.

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