Selects the basis rank \(Q\) for nmfre by Wold-style
element-wise (entry-holdout) cross-validation that exercises the
random effects. For each fold the held-out entries are hidden and filled by
iterative imputation: fit the NMF-RE model on the current matrix, replace the
held-out entries with the BLUP prediction \(X(\Theta A + U)\), and repeat.
The score is the held-out prediction RMSE (sigma); the selected
rank minimizes it.
Because the held-out entries of a column are predicted using the random
effect \(u_n\) fitted from that column's retained entries, this
evaluates the full NMF-RE model (including \(U\)) — unlike
nmfkc.ecv, which masks entries by zero weight and predicts from
the fixed-effect fit \(X\Theta A\) only. The two scores are therefore
not directly comparable.
Arguments
- Y
Observation matrix (P x N), non-negative.
- A
Covariate matrix (K x N). Default is a row of ones (intercept only).
- rank
Integer vector of ranks \(Q\) to evaluate (default
1:3).- C.signed
Logical. Sign convention for \(\Theta\) passed to each
nmfrefit (TRUE= sign-free, default;FALSE= non-negative). The basis update rule follows this choice automatically.- ...
Additional arguments:
nfolds: Number of folds (default 5; legacynfoldalso accepted).rounds: Iterative-imputation rounds per fold (default 4).seed: RNG seed for the fold assignment (default 1).print.trace: Logical; print per-rank scores (defaultFALSE).Convergence controls forwarded to
nmfre:epsilon(default1e-5),epsilon.outer(default1e-3),inner.maxit(default1500),outer.maxit(default80),maxit(default40000). CV does not need the tight tolerances of a final fit, so these are loosened by default.
Value
A list of class "nmfre.ecv" with components:
rankThe ranks evaluated.
sigmaNamed numeric vector of held-out RMSE per rank (same field name as
nmfkc.ecv).bestThe rank minimizing
sigma.nfolds,rounds,C.signedSettings used.
