NbClust Package : finding the relevant number of clusters in a - - PowerPoint PPT Presentation

nbclust package finding the relevant number of clusters
SMART_READER_LITE
LIVE PREVIEW

NbClust Package : finding the relevant number of clusters in a - - PowerPoint PPT Presentation

Introduction NbClust package Examples Conclusion NbClust Package : finding the relevant number of clusters in a dataset Malika Charrad, Nadia Ghazzali, V eronique Boiteau, Azam Niknafs Laval University, Quebec, Canada June 13th, 2012


slide-1
SLIDE 1

Introduction NbClust package Examples Conclusion

NbClust Package : finding the relevant number of clusters in a dataset

Malika Charrad, Nadia Ghazzali, V´ eronique Boiteau, Azam Niknafs

Laval University, Quebec, Canada

June 13th, 2012

UseR !2012, Nashville NbClust Package

slide-2
SLIDE 2

Introduction NbClust package Examples Conclusion

Outline

1 Introduction 2 NbClust package 3 Examples 4 Conclusion

UseR !2012, Nashville NbClust Package

slide-3
SLIDE 3

Introduction NbClust package Examples Conclusion

Outline

1 Introduction 2 NbClust package 3 Examples 4 Conclusion

UseR !2012, Nashville NbClust Package

slide-4
SLIDE 4

Introduction NbClust package Examples Conclusion

Introduction

Clustering is the task of assigning a set of objects into groups (clusters) so that the objects in the same cluster are more similar to each other than objects in other clusters. Most of the clustering algorithms depend on input parameters such as the number of clusters, the minimum number of objects in a cluster, or the diameter of a cluster .. ⇒ The selection of different parameters leads to different clusters of data.

UseR !2012, Nashville NbClust Package

slide-5
SLIDE 5

Introduction NbClust package Examples Conclusion

How many clusters are there in the dataset ?

UseR !2012, Nashville NbClust Package

slide-6
SLIDE 6

Introduction NbClust package Examples Conclusion

How to select the best number of clusters in a dataset ?

If the clustering algorithm parameters are assigned improper values, the clustering method may result in a partitioning scheme that’s not

  • ptimal ⇒ Wrong decisions.

The user is faced with the dilemma of selecting the number of clusters in the dataset. The problem of deciding the number of clusters better fitting a dataset as well as the evaluation of the clustering results is known under the term cluster validity.

UseR !2012, Nashville NbClust Package

slide-7
SLIDE 7

Introduction NbClust package Examples Conclusion

Related work

(Milligan and Cooper, 1985) examined 30 indices with simulated data. There are other criteria which were not examined in Milligan and Cooper study such as : Dunn index (Dunn, 1974) Silhouette statistic (Rousseeuw, 1987) Gap statistic (Tibshirani, 2001) Dindex (Lebart, 2000) SD index and SDbw index (Halkidi et al., 2000, 2001) Statistic of Hubert ((Hubert and Arabie, 1985))

UseR !2012, Nashville NbClust Package

slide-8
SLIDE 8

Introduction NbClust package Examples Conclusion

Related work

⇒ 19 among all existing indices are implemented in SAS and R packages : cclust, clusterSim, clv and clvalid.

UseR !2012, Nashville NbClust Package

slide-9
SLIDE 9

Introduction NbClust package Examples Conclusion

1 Introduction 2 NbClust package 3 Examples 4 Conclusion

UseR !2012, Nashville NbClust Package

slide-10
SLIDE 10

Introduction NbClust package Examples Conclusion

NbClust package

  • 1. NbClust package provides 30 indices to determine the

number of clusters :

11 other indices :

”duda” Duda and Hart (1973) ”beale” Beale (1969) ”gplus” Rohlf (1974), Milligan (1981) ”frey” Frey and Van Groenewoud (1972) ”tau” Rohlf (1974), Milligan (1981) ”mcclain” McClain and Rao (1975), ”gap” Tibshirani (2001), ”dindex” Lebart (2000), ”hubert” Hubert and Arabie (1985), ”sdindex” Halkidi et al. (2000), ”sdbw” Halkidi et al. (2001).

  • 2. NbClust offers the user the best clustering scheme among

different results.

UseR !2012, Nashville NbClust Package

slide-11
SLIDE 11

Introduction NbClust package Examples Conclusion

NbClust function

NbClust(data, diss=”NULL”, distance=”euclidean”, min.nc=2, max.nc=15, method=”ward”, index=”all”, alphaBeale=0.1) Arguments : data matrix or data set diss dissimilarity matrix to be used. By default, diss=”NULL”, but if it is replaced by a dissimilarity matrix, distance should be ”NULL”. distance the distance measure to be used to compute the dissimilarity

  • matrix. This must be one of : ”euclidean”, ”maximum”,

”manhattan”, ”canberra”, ”binary”, ”minkowski” or ”NULL”.

UseR !2012, Nashville NbClust Package

slide-12
SLIDE 12

Introduction NbClust package Examples Conclusion

NbClust function

NbClust(data, diss=”NULL”, distance=”euclidean”, min.nc=2, max.nc=15, method=”ward”, index=”all”, alphaBeale=0.1) Arguments : min.nc minimum number of clusters, between 2 and (number of

  • bjects - 1).

max.nc maximum number of clusters, between 2 and (number of

  • bjects - 1), greater or equal to min.nc.

method the cluster analysis method to be used. Available methods are : ”ward”, ”single”, ”complete”, ”average”, ”mcquitty”, ”median”, ”centroid” ”kmeans”

UseR !2012, Nashville NbClust Package

slide-13
SLIDE 13

Introduction NbClust package Examples Conclusion

NbClust function

Nb.clusters(data, diss=”NULL”, distance=”euclidean”, min.nc=2, max.nc=15, method=”ward”, index=”all”, alphaBeale=0.1) Arguments : index the index to be calculated. This should be one of : ”kl”, ”ch”, ”hartigan”, ”ccc”, ”scott”, ”marriot”, ”trcovw”, ”tracew”, ”friedman”, ”rubin”, ”cindex”, ”db”, ”silhouette”, ”duda”, ”pseudot2”, ”beale”, ”ratkowsky”, ”ball”, ”ptbiserial”, ”gap”, ”frey”, ”mcclain”, ”gamma”, ”gplus”, ”tau”, ”dunn”, ”hubert”, ”sdindex”, ”dindex”, ”sdbw”, ”alllong” : all indices included ”all” : all indices except GAP, Gamma, Gplus and Tau. alphaBeale significance value for Beale’s index.

UseR !2012, Nashville NbClust Package

slide-14
SLIDE 14

Introduction NbClust package Examples Conclusion

1 Introduction 2 NbClust package 3 Examples 4 Conclusion

UseR !2012, Nashville NbClust Package

slide-15
SLIDE 15

Introduction NbClust package Examples Conclusion

Example1 : Simulated dataset with 2 variables and 4 clusters

UseR !2012, Nashville NbClust Package

slide-16
SLIDE 16

Introduction NbClust package Examples Conclusion

NbClust output : Gap index

UseR !2012, Nashville NbClust Package

slide-17
SLIDE 17

Introduction NbClust package Examples Conclusion

NbClust output : ”alllong” option

[All.index] Values of indices for each partition of the dataset

  • btained with a number of clusters between min.nc and max.nc.

UseR !2012, Nashville NbClust Package

slide-18
SLIDE 18

Introduction NbClust package Examples Conclusion

NbClust output : Critical values

[All.CriticalValues] Critical values of some indices for each partition

  • btained with a number of clusters between min.nc and max.nc.

UseR !2012, Nashville NbClust Package

slide-19
SLIDE 19

Introduction NbClust package Examples Conclusion

NbClust output : Best number of clusters

[Best.nc] Best number of clusters proposed by each index and the corresponding index value.

UseR !2012, Nashville NbClust Package

slide-20
SLIDE 20

Introduction NbClust package Examples Conclusion

NbClust output : Best number of clusters

UseR !2012, Nashville NbClust Package

slide-21
SLIDE 21

Introduction NbClust package Examples Conclusion

NbClust output : Hubert index and Dindex

UseR !2012, Nashville NbClust Package

slide-22
SLIDE 22

Introduction NbClust package Examples Conclusion

NbClust output : Hubert index and Dindex

UseR !2012, Nashville NbClust Package

slide-23
SLIDE 23

Introduction NbClust package Examples Conclusion

Example2 : Iris dataset (Fisher 1936)

Iris dataset is composed of 3 species : ”Setosa”, ”Virginica” and ”Versicolor”

UseR !2012, Nashville NbClust Package

slide-24
SLIDE 24

Introduction NbClust package Examples Conclusion

Clustering of Iris dataset (1)

UseR !2012, Nashville NbClust Package

slide-25
SLIDE 25

Introduction NbClust package Examples Conclusion

Clustering of Iris dataset (2)

UseR !2012, Nashville NbClust Package

slide-26
SLIDE 26

Introduction NbClust package Examples Conclusion

Clustering of Iris dataset (3)

UseR !2012, Nashville NbClust Package

slide-27
SLIDE 27

Introduction NbClust package Examples Conclusion

1 Introduction 2 NbClust package 3 Examples 4 Conclusion

UseR !2012, Nashville NbClust Package

slide-28
SLIDE 28

Introduction NbClust package Examples Conclusion

How to decide on the correct number of clusters ?

UseR !2012, Nashville NbClust Package

slide-29
SLIDE 29

Introduction NbClust package Examples Conclusion

How to decide on the correct number of clusters ?

  • 1. Majority rule : User can select the number of clusters

proposed by the majority of indices. ex : 4 in 1st example and 3 in 2nd example.

  • 2. User can consider only indices that performed best in

simulations studies. Top-5 indices in Milligan and Cooper study are : CH index, Duda index, Cindex, Gamma and Beale index.

UseR !2012, Nashville NbClust Package

slide-30
SLIDE 30

Introduction NbClust package Examples Conclusion

Conclusion

NbClust package provides a large list of indices, many of them are not implemented anywhere. The current version contains up to 30 indices. NbClust package permits the user to simultaneously vary the number of clusters, the clustering method and the indices to decide how best to group observations in his dataset or to compare all indices or clustering methods. NbClust package is available at http ://cran.r-project.org/web/packages/NbClust/index.html

UseR !2012, Nashville NbClust Package

slide-31
SLIDE 31

Introduction NbClust package Examples Conclusion

Thank you !

UseR !2012, Nashville NbClust Package