clv.Dunn | R Documentation |
Function computes Dunn index - internal measure for given data and its partitioning.
clv.Dunn( index.list, intracls, intercls)
index.list |
object returned by function | ||
intracls |
string
| ||
intercls |
string
|
Dunn index:
D = [ min{ k,l - numbers of clusters } dist(Ck, Cl) ]/[ max{ m - cluster number } diam(Cm) ]
k,l,m | - numbers of clusters which come from the same partitioning, |
dist(Ck,Cl) | - inter cluster distance between clusters Ck and Cl, |
diam(Cm) | - intra cluster diameter computed for cluster Cm. |
As output user gets matrix of Dunn indices.
Matrix dimension depends on how many diam and dist measures are chosen by the user,
normally dim(D)=c(length(intercls),length(intracls))
.
Each pair: (inter-cluster dist, intra-cluster diam) have its own position in result matrix.
Lukasz Nieweglowski
M. Halkidi, Y. Batistakis, M. Vazirgiannis Clustering Validity Checking Methods : Part II, http://citeseer.ist.psu.edu/537304.html
Functions which produce index.list input argument: cls.scatt.data
, cls.scatt.diss.mx
.
Related functions: clv.Davies.Bouldin.
# load and prepare data
library(clv)
data(iris)
iris.data <- iris[,1:4]
# cluster data
agnes.mod <- agnes(iris.data) # create cluster tree
v.pred <- as.integer(cutree(agnes.mod,5)) # "cut" the tree
intraclust = c("complete","average","centroid")
interclust = c("single", "complete", "average","centroid", "aveToCent", "hausdorff")
# compute Dunn indicies (also Davies-Bouldin indicies)
# 1. optimal solution:
# compute intercluster distances and intracluster diameters
cls.scatt <- cls.scatt.data(iris.data, v.pred, dist="manhattan")
# once computed valuse use in both functions
dunn1 <- clv.Dunn(cls.scatt, intraclust, interclust)
davies1 <- clv.Davies.Bouldin(cls.scatt, intraclust, interclust)
# 2. functional solution:
# define new Dunn and Davies.Bouldin functions
Dunn <- function(data,clust)
clv.Dunn( cls.scatt.data(data,clust),
intracls = c("complete","average","centroid"),
intercls = c("single", "complete", "average","centroid", "aveToCent", "hausdorff")
)
Davies.Bouldin <- function(data,clust)
clv.Davies.Bouldin( cls.scatt.data(data,clust),
intracls = c("complete","average","centroid"),
intercls = c("single", "complete", "average","centroid", "aveToCent", "hausdorff")
)
# compute indicies
dunn2 <- Dunn(iris.data, v.pred)
davies2 <- Davies.Bouldin(iris.data, v.pred)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.