| 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. |
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 |
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. |
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 of selection criteria: |
Satoh, K. (2024). Applying Non-negative Matrix Factorization with Covariates to the Longitudinal Data as Growth Curve Model. 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. (2025). Applying non-negative matrix factorization with covariates to label matrix for classification. arXiv:2510.10375. https://arxiv.org/abs/2510.10375
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).
nmfkc.cv, nmfkc.rank, nmfkc.kernel, nmfkc.ar, 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)
# 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.