print.nmf: Print method for fitted NMF models

View source: R/s3methods.R

print.nmfR Documentation

Print method for fitted NMF models

Description

Prints the call, the model shape and whether the fit converged, in the spirit of print.lm: enough to see what was fitted and whether to trust it, with everything else left to summary(). Registered on the shared "nmf" class, so it covers every optimizer that returns one (nmfkc, nmf.rrr / nmf.rrr, nmfre, nmf.ffb and the signed variants); nmf.gmm has its own methods.

Without it, printing a fit dumps the whole list — over 350 lines for a 4\times82 problem, and unusable for a large one.

Unlike lm, the coefficient matrix is not shown: it is Q\times K with K the number of covariates — the number of samples when there is no covariate matrix — so it is routinely far too large for a print method. Use coef for it.

Usage

## S3 method for class 'nmf'
print(x, digits = max(3L, getOption("digits") - 3L), ...)

Arguments

x

A fitted model object inheriting class "nmf".

digits

Number of significant digits.

...

Additional arguments (currently unused).

Value

x, invisibly.

See Also

summary.nmfkc, nmfkc

Examples

Y <- matrix(cars$dist, nrow = 1)
A <- rbind(1, cars$speed)
result <- nmfkc(Y, A, rank = 1)
result
coef(result)   # the coefficient matrix C


nmfkc documentation built on Oct. 30, 2026, 9:06 a.m.