consensus_matrix: Compute consensus matrix from labels

Description Usage Arguments Value Examples

View source: R/cluster_validation.R

Description

Compute consensus matrix from labels

Usage

1

Arguments

labels

a matrix with each column corresponding to a the results of a single clustering routine. Each column should give the cluster assignment FIXME: What is the required format of entries??

scale

boolean, optional, default: TRUE. Whether to rescale the resulting consensus matrix so that entries correspond to proportions.

Value

a symmetric matrix of size NxN, where N is the number of rows of the input matrix labels. Each i,j entry of the matrix corresponds the number of times the two rows were in the same cluster across the clusterings (scale=FALSE) or the proportion of clustering that the two rows are in the same cluster (scale=TRUE).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(exampleData)
moanin <- create_moanin_model(data=testData,meta=testMeta)
#small function to run splines_kmeans on subsample of 50 genes
subsampleCluster<-function(){
   ind<-sample(1:nrow(moanin),size=50,replace=FALSE)
   km<-splines_kmeans(moanin[ind,],n_clusters=3)
   assign<-splines_kmeans_predict(moanin,km, 
      method="distance")
  }
kmClusters=replicate(10,subsampleCluster())
cm<-consensus_matrix(kmClusters)
heatmap(cm)

NelleV/moanin documentation built on July 28, 2021, 7:34 p.m.