NMF minimizing the Frobenius norm using sequential quadratic programming.
nmf.sqp(x, k, W = NULL, H = NULL, maxiter = 1000, tol = 1e-4, ridge = 1e-8,
history = FALSE, ncores = 1)The \(W\) matrix, an \(n \times k\) matrix with the mapped data.
The \(H\) matrix, an \(k \times D\) matrix.
The reconstruction error, \( ||x - Z||_F^2\).
If the argument history was set to TRUE the reconstruction error at each iteration will be performed, otherwise this is NULL.
The number of iterations performed.
The runtime required by the algorithm.
An \(n \times D\) dgC class sparse matrix with data.
The number of lower dimensions. It must be less than the dimensionality of the data, at most \(D-1\).
If you have an initial estimate for W supply it here. Otherwise leave it NULL.
If you have an initial estimate for H supply it here, otherwise leave it NULL.
The maximum number of iterations allowed.
The tolerance value to terminate the quadratic programming algorithm. The value is set to 1e-4 in this case because with large scale and/or sparse data the computation time is really high. So, we sacrifice some accuracy over speed.
A small quantity added in the diagonal of the \(D\) matrix.
If this is TRUE, the reconstruction error at each iteration is returned.
Do you want the update of W to be performed in parallel? If yes, specify the number of cores to use.
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
Nonnegative matrix factorization using quadratic programming is performed. The objective function to be minimized is the square of the Frobenius norm. This function is suitable for large scale sparse data, and parallel computing is a must in this case. Note that we do not use k-means here and that the reconstruced matrix Z is not returned with this function for capacity purposes.
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.
nmf.qp
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