Description Usage Arguments Value Author(s) Examples
Reindexes (rekeys) the cluster assignments to maximize overlap across algorithms.
Ignores algorithms which could not find k
clusters; i.e. when one of the clusters is smaller than the min.size
argument.
Use this after determining the optimal number of clusters (via plotRange3D
).
1 | clusterKeys(clusters, min.size = 3)
|
clusters |
Data frame of cluster assignments, where rows are samples, columns are algorithms, assignments are integers. For example, the output of the |
min.size |
Minimum cluster size. Algorithms that return clusters smaller than this (or that don't have |
Returns a matrix of rekeyed cluster assignments, such that cluster 'n' refers to the same cluster across all algorithms. Cluster 0 contains the samples for which no consistent 'core' cluster could be identified.
Albert Chen and Timothy E Sweeney
Maintainer: Albert Chen acc2015@stanford.edu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # reindexes cluster numbers to agree
clusters <- data.frame(
alg1=as.integer(c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3)),
alg2=as.integer(c(1,1,1,1,1,3,3,3,3,3,2,2,2,2,2)),
alg3=as.integer(c(3,3,3,3,3,1,1,1,1,1,2,2,2,2,2))
)
mat.key <- clusterKeys(clusters)
mat.key # cluster indices are relabeled
examineCounts(mat.key)
core <- returnCore(mat.key, agreement.thresh=50) # find 'core' clusters
table(core) # the 'core' clusters
# some clusters assignments are undetermined
clusters <- data.frame(
alg1=as.integer(c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,1,1,2,2,3,3)),
alg2=as.integer(c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,1,2,2,3,3,1)),
alg3=as.integer(c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,2,3,1,1,2,3))
)
mat.key <- clusterKeys(clusters)
mat.key # last six samples have conflicting assignments
examineCounts(mat.key)
core <- returnCore(mat.key, agreement.thresh=66) # at least 2 of 3 algs must agree
table(core)
core <- returnCore(mat.key, agreement.thresh=99) # all algs must agree
table(core)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.