Learn R Programming

NMF (version 0.2.2)

connectivity: Clustering Connectivity and Consensus Matrices

Description

connectivity is an S4 generic that computes the connectivity matrix based on the clustering of samples obtained from a model's predict method.

The consensus matrix has been proposed by Brunet et al. (2004) to help visualising and measuring the stability of the clusters obtained by NMF approaches. For objects of class NMF (e.g. results of a single NMF run, or NMF models), the consensus matrix reduces to the connectivity matrix.

Usage

connectivity(object, ...)

## S3 method for class 'NMF': connectivity(object, no.attrib = FALSE)

consensus(object, ...)

Arguments

object
an object with a suitable predict method.
...
extra arguments to allow extension. They are passed to predict, except for the vector and factor methods.
no.attrib
a logical that indicates if attributes containing information about the NMF model should be attached to the result (TRUE) or not (FALSE).

Value

  • a square matrix of dimension the number of samples in the model, full of 0s or 1s.

Details

The connectivity matrix of a given partition of a set of samples (e.g. given as a cluster membership index) is the matrix $C$ containing only 0 or 1 entries such that: $$C_{ij} = \left{\begin{array}{l} 1\mbox{ if sample }i\mbox{ belongs to the same cluster as sample }j\ 0\mbox{ otherwise} \end{array}\right..$$

References

Brunet J, Tamayo P, Golub TR and Mesirov JP (2004). "Metagenes and molecular pattern discovery using matrix factorization." _Proceedings of the National Academy of Sciences of the United States of America_, *101*(12), pp. 4164-9. ISSN 0027-8424, , .

See Also

predict

Examples

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

#----------
# connectivity,ANY-method
#----------
# clustering of random data
h <- hclust(dist(rmatrix(10,20)))
connectivity(cutree(h, 2))

#----------
# connectivity,factor-method
#----------
connectivity(gl(2, 4))

Run the code above in your browser using DataLab