Initialization strategies for the NMF based on the k-means algorithm.
init(x, k, bs = 1, veo = FALSE)The \(W\) matrix, an \(n \times k\) matrix with the mapped data.
The \(H\) matrix, an \(k \times D\) matrix.
The reconstructed data, \(Z = WH\).
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\) numerical matrix with data.
The number of lower dimensions. It must be less than the dimensionality of the data, at most \(D-1\).
The batch size in case the user wants to use the mini-batch k-means algorithm. If bs=1, the classical k-means is used.
If the (number of) variables exceed the (number of) observations set this equal to true. In this case, the sparse k-means algorithm of Witten and Tibshirani (2010) is used to initiate the H matrix.
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.
Alenazi A. and Tsagris M. (2026). Simplicial nonnegative matrix factorization. In preparation.
Witten D. M. and Tibshirani R. (2010). A framework for feature selection in clustering. Journal of the American Statistical Association, 105(490): 713--726.
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)
plot(mod$W, colour = iris[, 5])
Run the code above in your browser using DataLab