| nmfkc | R Documentation |
nmfkc fits a nonnegative matrix factorization with kernel covariates
under the tri-factorization model Y \approx X C A = X B.
This function supports two major input modes:
Matrix Mode (Existing): nmfkc(Y=matrix, A=matrix, ...)
Formula Mode (New): nmfkc(formula=Y_vars ~ A_vars, data=df, rank=Q, ...)
The rank of the basis matrix can be specified using either the rank argument
(preferred for formula mode) or the hidden Q argument (for backward compatibility).
nmfkc(
Y,
A = NULL,
rank = NULL,
data,
epsilon = 1e-04,
maxit = 5000,
verbose = TRUE,
...
)
Y |
Observation matrix (P x N), OR a formula object for Formula Mode.
In Formula Mode, use |
A |
Covariate matrix. Default is |
rank |
Integer. The rank of the basis matrix |
data |
Optional. A data frame from which variables in the formula should be taken. |
epsilon |
Positive convergence tolerance. From the 10th iteration
the fit stops when |
maxit |
Maximum number of iterations. |
verbose |
Logical. If |
... |
Additional arguments passed for fine-tuning regularization, initialization, constraints,
and output control. This includes the backward-compatible arguments
|
A list with components:
call |
The matched call, as captured by |
dims |
A character string summarizing the matrix dimensions of the model. |
runtime |
A character string summarizing the computation time. |
X |
Basis matrix. Column normalization depends on |
B |
Coefficient matrix |
XB |
Fitted values for |
C |
Parameter matrix. |
B.prob |
Soft-clustering probabilities derived from columns of |
B.cluster |
Hard-clustering labels (argmax over |
X.prob |
Row-wise soft-clustering probabilities derived from |
X.cluster |
Hard-clustering labels (argmax over |
X.anchor |
Present only when |
X.restriction |
The constraint that was applied to the columns of
|
A.attr |
List of attributes of the input covariate matrix |
formula.meta |
If fitted via Formula Mode, a list with |
objfunc |
Final objective value. |
objfunc.iter |
Objective values by iteration. The trace is trimmed to
|
iter |
Number of iterations performed. |
maxit |
The iteration cap that was in force. |
epsilon |
The convergence tolerance that was in force. |
epsilon.iter |
Relative change of the objective at the last step —
the quantity the stopping rule compares with |
objfunc.increases |
Number of steps at which the objective rose,
counted on the recorded (trimmed) trace. The multiplicative update is
monotone by itself, so a positive count means something outside it — a
restriction imposed by projection, or a numerical problem — is pushing
the iterate back, in which case the fit can oscillate and exhaust
|
converged |
Logical; whether |
r.squared |
|
r.squared.uncentered |
Uncentered |
r.squared.centered |
Row-mean centered |
method |
Character string indicating the optimization method used ( |
n.missing |
Number of missing (or zero-weighted) elements in |
n.total |
Total number of elements in |
rank |
The rank |
sigma |
The residual standard error, representing the typical deviation of the observed values |
mae |
Mean Absolute Error between |
criterion |
A list with
With
|
Satoh, K. (2026). Applying Non-negative Matrix Factorization with Covariates to the Longitudinal Data as Growth Curve Model. American Journal of Mathematical and Management Sciences. In press. arXiv:2403.05359. https://arxiv.org/abs/2403.05359
Satoh, K. (2025). Applying non-negative matrix factorization with covariates to multivariate time series data as a vector autoregression model. Japanese Journal of Statistics and Data Science. arXiv:2501.17446. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s42081-025-00314-0")}
Satoh, K. (2026). Applying non-negative matrix factorization with covariates to label matrix for classification. Japanese Journal of Statistics and Data Science. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s42081-026-00349-x")}
Ding, C., Li, T., Peng, W., & Park, H. (2006). Orthogonal Nonnegative Matrix Tri-Factorizations for Clustering. In Proc. 12th ACM SIGKDD (pp. 126–135). \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1145/1150402.1150420")}
Roy, O., & Vetterli, M. (2007). The effective rank: A measure of effective dimensionality. In 15th European Signal Processing Conference (EUSIPCO) (pp. 606–610).
Gillis, N., & Vavasis, S. A. (2014). Fast and robust recursive algorithms for separable nonnegative matrix factorization. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(4), 698–714. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1109/TPAMI.2013.226")}
nmfkc.inference (standard errors and p-values for
C), summary.nmfkc, plot.nmfkc,
nmfkc.cv, nmfkc.ecv, nmfkc.rank,
nmfkc.kernel, nmfkc.ar,
nmfkc.DOT, predict.nmfkc
# Example 1. Matrix Mode (Existing)
X <- cbind(c(1,0,1),c(0,1,0))
B <- cbind(c(1,0),c(0,1),c(1,1))
Y <- X %*% B
rownames(Y) <- paste0("P",1:nrow(Y))
colnames(Y) <- paste0("N",1:ncol(Y))
print(X); print(B); print(Y)
res <- nmfkc(Y,rank=2,epsilon=1e-6)
res$X
res$B
# Example 2. Formula Mode
set.seed(1)
dummy_data <- data.frame(Y1=rpois(10,5), Y2=rpois(10,10),
A1=abs(rnorm(10,5)), A2=abs(rnorm(10,3)))
res_f <- nmfkc(Y1 + Y2 ~ A1 + A2, data=dummy_data, rank=2)
# Example 3. Anchors: in Example 1, rows P1 and P2 of X carry one basis
# each. X.anchor imposes such rows (here found by SPA), which makes the
# factorization unique; X.init = "spa" only starts from them.
res_a <- nmfkc(Y, rank = 2, X.anchor = "spa", epsilon = 1e-6)
res_a$X.anchor
# For symmetric NMF (Y approximated by X X^T or X C X^T),
# use \code{\link{nmfkc.net}()} instead.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.