Learn R Programming

NMF (version 0.5.06)

NMFfitXn-class: Class to Store the Result from Multiple Runs of a NMF Algorithm when Keeping All the Fits

Description

This class is used to return the result from a multiple run of a single NMF algorithm performed with function nmf with option keep.all=TRUE (cf. nmf).

It extends both classes NMFfitX and list, and stores the result of each run (i.e. a NMFfit object) in its list structure.

IMPORTANT NOTE: This class is designed to be read-only, even though all the list-methods can be used on its instances. Adding or removing elements would most probably lead to incorrect results in subsequent calls. Capability for concatenating and merging NMF results is for the moment only used internally, and should be included and supported in the next release of the package.

Arguments

Extends

Class "NMFfitX", directly. Class "list", from data part. Class "vector", by class "list", distance 2. Class "AssayData-class", by class "list", distance 2.

Validity

NMFfitXn objects are designed to store results of single runs of the same NMF algorithm, that have the same dimensions. The following checks are performed in the class validity method:
  • All elements must be the result of a single NMF run. That is they must be of classNMFfit, and objects of classNMFfitXare not allowed.
  • All elements must be the result of the same NMF algorithm.
  • The dimension of the fitted problem must be the same for all elements: same dimension of the target matrix, and same factorisation rank.

See Also

NMFfitX , nmf-methods, nmf-multiple

Examples

Run this code
# generate a synthetic dataset with known classes
n <- 50; counts <- c(5, 5, 8);
V <- syntheticNMF(n, counts, noise=TRUE)

# build the class factor
groups <- as.factor(do.call('c', lapply(seq(3), function(x) rep(x, counts[x]))))

# perform multiple runs of one algorithm, keeping all the fits
res <- nmf(V, 3, nrun=5, .options='k') # .options=list(keep.all=TRUE) also works
res
summary(res)
# get more info
summary(res, target=V, class=groups)

# compute/show computational times
runtime.all(res)
seqtime(res)

Run the code above in your browser using DataLab