RHGCPlotARIs: Calculating and Visualizing ARIs of the clustering results...

Description Usage Arguments Details Value Examples

Description

The function cut the dendrogram into specific clusters at different levels and compared the clusterings with given labels using Adjusted Rand Index (ARI)

Usage

1
HGC.PlotARIs(tree, k.min, k.max, labels, return.ARI)

Arguments

tree

the input clustering tree saved as hclust data structure.

k.min

the minimum number to cut the tree.

k.max

the maximum number to cut the tree.

labels

a data frame or a matrix to store the label information. Different labels should be in different columns and the users should name the columns correspondingly.

return.ARI

a bool variable to choose whether output the ARI matrix.

Details

ARI is a widely used index to evaluate the consistence between two partitions of the same samples. This function will first cut a given tree into specific number of clusters using the function cutree. Then it calculates the ARIs between the clustering result and the given labels with the help of R package mclust. The function does such cutting and calculation for different ks between k.min and k.max. Finally it visualize these results using a line chart. ARIs with different labels are shown as different lines with different colors in the figure.

Value

A line chart will be drawn and a matrix of the ARIs will be returned.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(Pollen)
Pollen.PCs <- Pollen[["PCs"]]
Pollen.Label.Tissue <- Pollen[["Tissue"]]
Pollen.Label.CellLine <- Pollen[["CellLine"]]

Pollen.SNN <- SNN.Construction(Pollen.PCs)
Pollen.ClusteringTree <- HGC.dendrogram(G = Pollen.SNN)
Pollen.labels <- data.frame(Tissue = Pollen.Label.Tissue,
                            CellLine = Pollen.Label.CellLine)
HGC.PlotARIs(tree = Pollen.ClusteringTree,
                            k.min = 2, k.max = 15,
                            labels = Pollen.labels)

XuegongLab/HGC documentation built on Dec. 18, 2021, 7:23 p.m.