| naive_nmf | R Documentation |
A pure-R vanilla implementation assuming inputs are non-negative matrices
without NA.
naive_nmf(x, k, tol = c(1e-04, 1e-08), max_iters = 10000, verbose = TRUE)
x |
a matrix, or can be converted into a matrix; all negative or missing values will be treated as zero |
k |
decomposition rank |
tol |
stop criteria, a numeric of two; the first number is the
tolerance for root-mean-squared residuals, relative to the largest number in
|
max_iters |
maximum iterations |
verbose |
whether to report the progress; logical or a positive integer (of step intervals) |
A list of weights (non-negative template matrix W and
non-negative H) and errors (root mean squared error of fitted,
matrix W, and W versus their previous iteration, respectively).
x <- stats::toeplitz(.9 ^ (0:31))
nmf <- naive_nmf(x, k = 7, verbose = FALSE)
fitted <- nmf$W %*% nmf$H
oldpar <- par(mfrow = c(1, 2))
on.exit({ par(oldpar )})
image(x, zlim = c(0, 1), main = "Input")
image(fitted, zlim = c(0, 1),
main = sprintf("Fitted with rank=%d", nmf$k))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.