Skip to contents

An R implementation of classical non-negative matrix factorization (NMF).

Usage

NMF.optimized(X, K, maxiter = 2000L, tol = 1e-05)

Arguments

X

A non-negative numeric matrix (features x samples) to be factorized. All elements must be non-negative.

K

The rank of factorization, i.e., the number of components/latent features to extract. Must be a positive integer smaller than both dimensions of X.

maxiter

The maximum number of iterations for the optimization algorithm. Defaults to 2000.

tol

The convergence tolerance for the loss function. The algorithm stops when the absolute change in Euclidean distance between consecutive iterations is less than this value. Defaults to 1e-5.

Value

A list containing the factorization results:

  • W - The basis matrix (features x K), representing the learned features or components

  • H - The coefficient matrix (K x samples), representing the weights or activations of components for each sample

  • iter - The number of iterations actually performed

  • loss - The final value of the objective function (squared Euclidean distance)

See also

This function is from scAB package, and it is not recommended to use it because the computational efficiency of the R language is not very high. For more advanced NMF implementations, see: nmf from the NMF package, which is written in C++ and is much faster than this function.

Other scAB: DoscAB(), create_scAB.v5(), findSubset.optimized(), scAB.optimized(), select_K.optimized()