Learn R Programming

nnmf (version 1.1)

nmf.qp: NMF minimizing the Frobenius norm

Description

NMF minimizing the Frobenius norm using quadratic programming.

Usage

nmf.qp(x, k, W = NULL, H = NULL, k_means = TRUE, bs = 1, veo = FALSE, lr_h = 0.1,
maxiter = 1000, tol = 1e-6, ridge = 1e-8, history = FALSE, ncores = 1)

Value

W

The \(W\) matrix, an \(n \times k\) matrix with the mapped data.

H

The \(H\) matrix, an \(k \times D\) matrix.

Z

The reconstructed data, \(Z = WH\).

obj

The reconstruction error, \( ||x - Z||_F^2\).

error

If the argument history was set to TRUE the reconstruction error at each iteration will be performed, otherwise this is NULL.

iters

The number of iterations performed.

runtime

The runtime required by the algorithm.

Arguments

x

An \(n \times D\) numerical matrix with data.

k

The number of lower dimensions. It must be less than the dimensionality of the data, at most \(D-1\).

W

If you have an initial estimate for W supply it here. Otherwise leave it NULL.

H

If you have an initial estimate for H supply it here, otherwise leave it NULL.

k_means

If this is TRUE, then the K-means algorithm is used to initiate the W and H matrices.

bs

If you use the K-means algorithm for initialization, you may want to use the mini batch K-means if you have millions of observations. In this case, you need to define the number of batches.

veo

If the number of variables excceeds the number of observations set this is equal to TRUE.

lr_h

If veo is TRUE, then the exponentiated gradient descent method is used to update the H matrix. In this case you need to supply the value of the learning rate, which is 0.1 by default.

maxiter

The maximum number of iterations allowed.

tol

The tolerance value to terminate the quadratic programming algorithm.

ridge

A small quantity added in the diagonal of the \(D\) matrix.

history

If this is TRUE, the reconstruction error at each iteration is returned.

ncores

Do you want the update of W to be performed in parallel? If yes, specify the number of cores to use.

Author

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

Details

Nonnegative matrix factorization using quadratic programming is performed. The objective function to be minimized is the square of the Frobenius norm.

References

Alenazi A. and Tsagris M. (2026). Simplicial nonnegative matrix factorization. In preparation.

Cutler A. and Breiman L. (1994). Archetypal analysis. Technometrics, 36(4): 338--347.

See Also

nmf.sqp

Examples

Run this code
x <- as.matrix(iris[, 1:4])
mod <- nmf.qp(x, 2)
group <- as.numeric(iris[, 5])
plot(mod$W, col = group)

Run the code above in your browser using DataLab