Learn R Programming

NMF (version 0.2.2)

summary: Assessing and Comparing NMF Models

Description

The NMF package defines summary methods for different classes of objects, which helps assessing and comparing the quality of NMF models by computing a set of quantitative measures, e.g. with respect to their ability to recover known classes and/or the original target matrix.

The most useful methods are for classes NMF, NMFfit, NMFfitX and NMFList, which compute summary measures for, respectively, a single NMF model, a single fit, a multiple-run fit and a list of heterogenous fits performed with the function nmf.

Usage

summary(object, ...)

## S3 method for class 'NMF': summary(object, class, target)

Arguments

object
an NMF object. See available methods in section Methods.
...
extra arguments passed to the next summary method.
class
known classes/cluster of samples specified in one of the formats that is supported by the functions entropy and purity.
target
target matrix specified in one of the formats supported by the functions rss and evar

Details

Due to the somehow hierarchical structure of the classes mentionned in Description, their respective summary methods call each other in chain, each super-class adding some extra measures, only relevant for objects of a specific class.

Examples

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

#----------
# summary,NMF-method
#----------
# random NMF model
x <- rnmf(3, 20, 12)
summary(x)
summary(x, gl(3, 4))
summary(x, target=rmatrix(x))
summary(x, gl(3,4), target=rmatrix(x))

#----------
# summary,NMFfit-method
#----------
# generate a synthetic dataset with known classes: 50 features, 18 samples (5+5+8)
n <- 50; counts <- c(5, 5, 8);
V <- syntheticNMF(n, counts)
cl <- unlist(mapply(rep, 1:3, counts))

# perform default NMF with rank=2
x2 <- nmf(V, 2)
summary(x2, cl, V)
# perform default NMF with rank=2
x3 <- nmf(V, 3)
summary(x2, cl, V)

Run the code above in your browser using DataLab