| nmfkc.ecv | R Documentation |
nmfkc.ecv performs k-fold cross-validation by randomly holding out
individual elements of the data matrix (element-wise), assigning them a
weight of 0 via Y.weights, and evaluating the reconstruction error on
those held-out elements.
This method (also known as Wold's CV) is theoretically robust for determining
the optimal rank (Q) in NMF. This function supports vector input for Q,
allowing simultaneous evaluation of multiple ranks on the same folds.
For symmetric (network) data use nmfkc.net.ecv, which
creates upper-triangle folds to prevent information leakage through
the symmetric entries Y_{ij} = Y_{ji}. Passing the old
Y.symmetric argument here is no longer supported and stops
with a redirect message.
nmfkc.ecv(Y, A = NULL, rank = 1:3, data, ...)
Y |
Observation matrix, or a formula (see |
A |
Covariate matrix. Ignored when |
rank |
Vector of ranks to evaluate (e.g., 1:5). For backward compatibility,
|
data |
A data frame (required when |
... |
Additional arguments passed to |
A list with components:
objfunc |
Numeric vector containing the Mean Squared Error (MSE) for each Q. |
sigma |
Numeric vector containing the Residual Standard Error (RMSE) for each Q. Only available if method="EU". |
objfunc.fold |
List of length equal to Q vector. Each element contains the MSE values for the k folds. |
folds |
A list of length |
Wold, S. (1978). Cross-validatory estimation of the number of
components in factor and principal components models.
Technometrics, 20(4), 397–405.
\Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/00401706.1978.10489693")}
Owen, A. B., & Perry, P. O. (2009). Bi-cross-validation of the SVD
and the nonnegative matrix factorization. Ann. Appl. Stat.
3(2), 564–594. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/08-AOAS227")} (cross-validation of the
NMF rank; see also nmfkc.bicv).
nmfkc, nmfkc.cv; other rank-selection
criteria: nmfkc.rank, nmfkc.bicv,
nmfkc.consensus, nmfkc.ard.
# Element-wise CV to select rank
Y <- t(iris[1:30, 1:4])
res <- nmfkc.ecv(Y, rank = 1:2, nfolds = 3)
res$objfunc
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.