Learn R Programming

NMF (version 0.5.06)

NMF-utils: Class and Utility Methods for NMF objects

Description

Define generic interface methods for class NMF, which is the base -- virtual -- class of the results from any NMF algorithms implemented within package NMF's framework.

Usage

## S3 method for class 'NMF':
connectivity(x, ...)

## S3 method for class 'NMF,factor':
entropy(x, class, ...)

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

## S3 method for class 'NMFfit':
residuals(object, track=FALSE, ...)

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

## S3 method for class 'NMF':
featureScore(object, method=c('kim', 'max'))

## S3 method for class 'NMF':
extractFeatures(object, method=c('kim', 'max')
, format=c('list', 'combine', 'subset'))

## S3 method for class 'NMF':
metaHeatmap(object, what=c('samples', 'features'), filter=FALSE, ...)

## S3 method for class 'NMF':
nmfApply(object, MARGIN, FUN, ...)

## S3 method for class 'NMFfit':
plot(x, ...)

## S3 method for class 'NMF':
predict(object, what = c('samples', 'features'), prob=FALSE)

## S3 method for class 'NMF,factor':
purity(x, class, ...)

randomize(x, ...)

## S3 method for class 'NMF':
sparseness(x)

syntheticNMF(n, r, p, offset=NULL, noise=FALSE, return.factors=FALSE)

Arguments

class
A factor giving a known class membership for each sample. In methods entropy and purity, argument class is coerce to a factor if necessary.
filter
Relevant when what='features'. It specifies how to filter the features that will appear in the heatmap. When FALSE (default), all the features are used. Other possible values are:
  • TRUE: only the
format
the output format of the extracted features. Possible values are:
  • list(default) a list with one element per basis vector, each containing the indices of the basis-specific features.
  • combinea single intege
FUN
the function to be applied: see 'Details'. In the case of functions like +, %*%, etc., the function name must be backquoted or quoted. See link[base]{apply} for more details.
MARGIN
a vector giving the subscripts which the function will be applied over. 1 indicates rows, 2' indicates columns, c(1,2) indicates rows and columns. See link[base]{apply} for more details.
method
Method used to compute the feature scores and selecting the features. Possible values are:
  • kim(default) to use Kim and Park (2007) scoring schema and feature selection method. The features are first scored using the fun
n
Number of rows of the synthetic target matrix.
noise
if TRUE, a random noise is added the target matrix.
object
A matrix or an object that inherits from class NMF or NMFfit -- depending on the method.
offset
a vector giving the offset to add to the synthetic target matrix. Its length should be equal to the number of rows n.
prob
Should the probability associated with each cluster prediction be computed and returned.
p
Number of columns of the synthetic target matrix. Not used if parameter r is a vector (see description of argument r).
r
Underlying factorization rank. If a single numeric is given, the classes are randomly generated from a multinomial distribution. If a numerical vector is given, then it should contain the counts in the different classes (i.e integers
return.factors
If TRUE, the underlying matrices W and H are also returned.
target
the target object estimated by model object. It can be a matrix or an ExpressionSet.
track
if TRUE, the whole residuals track is returned. Otherwise only the last residuals computed is returned.
what
Specifies on which matrix, basis components (what='features') or mixture coefficients (what='samples') the computation should be performed.
x
for randomize: the matrix or ExpressionSet object whose entries will be randomised. for plot: An object that inherits from class NMFfit. otherwis
...
Used to pass extra parameters to subsequent calls:
  • inmetaHeatmap: Graphical parameters passed to functionheatmap.2
  • innmfApply: optional arguments to func

Details

[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

References

Metagenes and molecular pattern discovery using matrix factorization Brunet, J.~P., Tamayo, P., Golub, T.~R., and Mesirov, J.~P. (2004) Proc Natl Acad Sci U S A 101(12), 4164--4169. Sparse non-negative matrix factorizations via alternating non-negativity-constrained least squares for microarray data analysis Kim, H. & Park, H. (2007) Bioinformatics. http://dx.doi.org/10.1093/bioinformatics/btm134. Non-negative Matrix Factorization with Sparseness Constraints Hoyer, P. O. (2004) Journal of Machine Learning Research 5 (2004) 1457--1469 Biclustering of gene expression data by non-smooth non-negative matrix factorization Carmona-Saez, Pedro and Pascual-Marqui, Roberto and Tirado, F and Carazo, Jose and Pascual-Montano, Alberto (2006) BMC Bioinformatics 7(1), 78

See Also

NMF, summary

Examples

Run this code
# 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, noise=TRUE)
metaHeatmap(V)

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

# perform default NMF
res <- nmf(V, 2)
res

metaHeatmap(res, class=groups)
metaHeatmap(res, 'features')
# see the predicted clusters of samples
predict(res)
# compute entropy and purity
entropy(res, class=groups)
purity(res, class=groups)

# perform NMF with the right number of basis components
res <- nmf(V, 3)

metaHeatmap(res)
metaHeatmap(res, 'features')
entropy(res, class=groups)
purity(res, class=groups)

Run the code above in your browser using DataLab