NMF Multiplicative Updates for Euclidean Distance

Description

Multiplicative updates from Lee et al. (2001) for standard Nonnegative Matrix Factorization models V \approx W H, where the distance between the target matrix and its NMF estimate is measured by the -- euclidean -- Frobenius norm.

nmf_update.euclidean.w_R and nmf_update.euclidean.h_R implement the same updates in plain R.

Usage

nmf_update.euclidean.h(v, w, h, eps = 10^-9, nbterms = 0L, ncterms = 0L, copy = TRUE)

nmf_update.euclidean.h_R(v, w, h, wh = NULL, eps = 10^-9)

nmf_update.euclidean.w(v, w, h, eps = 10^-9, nbterms = 0L, ncterms = 0L, weight = NULL, 
  copy = TRUE)

nmf_update.euclidean.w_R(v, w, h, wh = NULL, eps = 10^-9)

Arguments

eps
small numeric value used to ensure numeric stability, by shifting up entries from zero to this fixed value.
wh
already computed NMF estimate used to compute the denominator term.
weight
numeric vector of sample weights, e.g., used to normalise samples coming from multiple datasets. It must be of the same length as the number of samples/columns in v -- and h.
v
target matrix
w
current basis matrix
h
current coefficient matrix
nbterms
number of fixed basis terms
ncterms
number of fixed coefficient terms
copy
logical that indicates if the update should be made on the original matrix directly (FALSE) or on a copy (TRUE - default). With copy=FALSE the memory footprint is very small, and some speed-up may be achieved in the case of big matrices. However, greater care should be taken due the side effect. We recommend that only experienced users use copy=TRUE.

Value

a matrix of the same dimension as the input matrix to update (i.e. w or h). If copy=FALSE, the returned matrix uses the same memory as the input object.

Details

nmf_update.euclidean.w and nmf_update.euclidean.h compute the updated basis and coefficient matrices respectively. They use a C++ implementation which is optimised for speed and memory usage.

The coefficient matrix (H) is updated as follows:

 H_kj <-
  max(H_kj (W^T V)_kj, eps) / ( (W^T W H)_kj + eps ) 

These updates are used by the built-in NMF algorithms Frobenius and lee.

The basis matrix (W) is updated as follows:

 W_ik <- max(W_ik (V
  H^T)_ik, eps) / ( (W H H^T)_ik + eps ) 

References

Lee DD and Seung H (2001). "Algorithms for non-negative matrix factorization." _Advances in neural information processing systems_. .

Author

Update definitions by Lee2001. C++ optimised implementation by Renaud Gaujoux.