Learn R Programming

NMF (version 0.20.5)

NMFfit-class: Base Class for to store Nonnegative Matrix Factorisation results

Description

Base class to handle the results of general Nonnegative Matrix Factorisation algorithms (NMF).

The function NMFfit is a factory method for NMFfit objects, that should not need to be called by the user. It is used internally by the functions nmf and seed to instantiate the starting point of NMF algorithms.

Usage

NMFfit(fit = nmfModel(), ..., rng = NULL)

Arguments

fit
an NMF model
...
extra argument used to initialise slots in the instantiating NMFfit object.
rng
RNG settings specification (typically a suitable value for .Random.seed).

code

fit

Details

It provides a general structure and generic functions to manage the results of NMF algorithms. It contains a slot with the fitted NMF model (see slot fit) as well as data about the methods and parameters used to compute the factorization.

The purpose of this class is to handle in a generic way the results of NMF algorithms. Its slot fit contains the fitted NMF model as an object of class NMF.

Other slots contains data about how the factorization has been computed, such as the algorithm and seeding method, the computation time, the final residuals, etc...

Examples

Run this code
# roxygen generated flag
options(R_CHECK_RUNNING_EXAMPLES_=TRUE)

# run default NMF algorithm on a random matrix
n <- 50; r <- 3; p <- 20
V <- rmatrix(n, p)
res <- nmf(V, r)

# result class is NMFfit
class(res)
isNMFfit(res)

# show result
res

# compute summary measures
summary(res, target=V)

Run the code above in your browser using DataLab