gsÜsem uygulamalı veri analizi sertifika programı...different aspects of cluster validation 1....

57
Clustering Evaluation Günce Keziban Orman Galatasaray University [email protected] This presentation is prepared from the slides of - Vincent Labatut Lecture of Datamining in GSU Comp. Eng. Master - Saeed Aghabozorgi Lectures of Cognitive Class - Ruoming Jin Lectures of Data Mining - Tan, Steinbach, Kumar - Lecture Notes for Introduction to Data Mining

Upload: others

Post on 13-Feb-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Clustering EvaluationGünce Keziban Orman

Galatasaray University

[email protected]

This presentation is prepared from the slides of

- Vincent Labatut – Lecture of Datamining in GSU – Comp. Eng. Master

- Saeed Aghabozorgi – Lectures of Cognitive Class

- Ruoming Jin – Lectures of Data Mining

- Tan, Steinbach, Kumar - Lecture Notes for Introduction to Data Mining

Page 2: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

7/22/2019 2

Page 3: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Cluster Validity

• For cluster analysis, the question is how to evaluate the

“goodness” of the resulting clusters?

• But “clusters are in the eye of the beholder”!

• Then why do we want to evaluate them?

• To avoid finding patterns in noise

• To compare clustering algorithms

• To compare two sets of clusters

• To compare two clusters

7/22/2019 3

Page 4: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Clusters found in Random Data

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

x

yRandom

Points

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

x

y

K-means

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

x

y

DBSCAN

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

x

y

Complete

Link

7/22/2019 4

Page 5: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Different Aspects of Cluster Validation1. Determining the clustering tendency of a set of data, i.e., distinguishing

whether non-random structure actually exists in the data.

2. Comparing the results of a cluster analysis to externally known results, e.g., to externally given class labels.

3. Evaluating how well the results of a cluster analysis fit the data withoutreference to external information.

- Use only the data

4. Comparing the results of two different sets of cluster analyses to determine which is better.

5. Determining the ‘correct’ number of clusters.For 2, 3, and 4, we can further distinguish whether we want to evaluate the entire clustering or just

individual clusters.7/22/2019 5

Page 6: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Framework for Cluster Validity

• Need a framework to interpret any measure.

• For example, if our measure of evaluation has the value, 10, is that good, fair, or poor?

• Statistics provide a framework for cluster validity

• The more “atypical” a clustering result is, the more likely it represents valid structure in the data

• Can compare the values of an index that result from random data or clusterings to those of a clustering result.

• If the value of the index is unlikely, then the cluster results are valid

• These approaches are more complicated and harder to understand.

• For comparing the results of two different sets of cluster analyses, a framework is less necessary.

• However, there is the question of whether the difference between two index values is significant7/22/2019 6

Page 7: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Measures of Cluster Validity

• Numerical measures that are applied to judge various aspects of cluster validity, are classified into the following three types.

• External Index: Used to measure the extent to which cluster labels match externally supplied class labels.• Purity

• Internal Index: Used to measure the goodness of a clustering structure without respect to external information. • Sum of Squared Error (SSE)

• Relative Index: Used to compare two different clusterings or clusters.• Often an external or internal index is used for this function, e.g., SSE or entropy

• Sometimes these are referred to as criteria instead of indices• However, sometimes criterion is the general strategy and index is the numerical measure that

implements the criterion.

7/22/2019 7

Page 8: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Measures of Cluster Validity

• External cluster validation, which consists in comparing the results of a cluster analysis to an externally known result, such as externally provided class labels. It measures the extent to which cluster labels match externally supplied class labels. Since we know the “true” cluster number in advance, this approach is mainly used for selecting the right clustering algorithm for a specific data set.

• Internal cluster validation, which uses the internal information of the clustering process to evaluate the goodness of a clustering structure without reference to external information. It can be also used for estimating the number of clusters and the appropriate clustering algorithm without any external data.

• Relative cluster validation, which evaluates the clustering structure by varying different parameter values for the same algorithm (e.g.,: varying the number of clusters k). It’s generally used for determining the optimal number of clusters.

7/22/2019 8

Page 9: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

External Validation

7/22/2019 9

Page 10: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

• It is the percent of the total number of objects(data points) that were classified correctly, in the unit range [0..1]

Purity Measure

7/22/2019 10

Page 11: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

• It is the percent of the total number of objects(data points) that were classified correctly, in the unit range [0..1]

Purity Measure

7/22/2019 11

Page 12: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Precision & Recall & F-measures

• True Positive (TP) Assignment: when similar members are assigned to the same cluster. This is a correct decision.

• True Negative (TN) Assignment: when dissimilar members are assigned to different clusters. This is a correct decision.

• False Negative (FN) Assignment: when similar members are assigned to different clusters. This is an incorrect decision.

• False Positive (FP) Assignment: when dissimilar members are assigned to the same cluster. This is an incorrect decision.

• Precision and Recall:

• F-measure:

7/22/2019 12

Page 13: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Precision & Recall & F-measures

7/22/2019 Reference Social Data Mining. by Reza Zafarani Mohammad Ali Abbasi Huan Liu13

Calculate TP, FP, TN, FN, Precision, Recall andF-measure

Page 14: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Precision & Recall & F-measures

7/22/2019 Reference Social Data Mining. by Reza Zafarani Mohammad Ali Abbasi Huan Liu14

Page 15: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Entropy

• Data clustering involves solving two main problems.

1. Defining exactly what makes a good clustering of data.

2. Determining an effective technique to search through all possible combinations of clustering to find the best clustering.

• Entropy addresses the first problem.

• It is the measure of the amount of disorder in a vector. There are several variations of entropy. The most common is called Shannon's entropy. Expressed mathematically, Shannon's entropy is:

7/22/2019 https://visualstudiomagazine.com/articles/2013/02/01/data-clustering-using-entropy-minimization.aspx 15

Page 16: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Entropy

• Suppose you have a vector = { red, red, blue, green, green, green }.• x0 = red, x1 = blue and x2 = green. • The probability of red is P(x0) = 2/6 = 0.33. P(x1) = 1/6 = 0.17 and P(x2) = 3/6 =

0.50.

• The smallest possible value for entropy is 0.0, which occurs when all symbols in a vector are the same. In other words, there's no disorder in the vector. The larger the value of entropy, the more disorder there is in the associated vector.

• Smaller values of entropy indicate less disorder in a clustering, which means a better clustering.

7/22/2019 https://visualstudiomagazine.com/articles/2013/02/01/data-clustering-using-entropy-minimization.aspx16

Page 17: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Entropy ~ EMIAC Algorithm• Here there are three clusters, k = 0, k = 1 and k = 2.

• Let us define the overall entropy of a clustering as the weightedsum of entropies for each cluster, where the entropy of a clusteris the sum of the entropies of each column.

• For k = 0, the three column entropies are:

• The entropy for cluster k = 0 is 0.92 + 0.92 + 0.00 = 1.84.

• The entropy for cluster k = 1 is 1.59 + 0.00 + 0.00 = 1.59.

• The entropy for cluster k = 2 is 0.00 + 1.00 + 0.00 = 1.00.

7/22/2019 https://visualstudiomagazine.com/articles/2013/02/01/data-clustering-using-entropy-minimization.aspx17

Page 18: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Entropy~ EMIAC Algorithm

• Now the overall entropy for the clustering is theweighted sum of the cluster entropies, where the weightfor each cluster is the probability of the cluster, which isjust the number of tuples in the cluster divided by thetotal number of tuples. So,

• P(cluster 0) = 3/8 = 0.375,

• P(cluster 1) = 3/8 = 0.375 and

• P(cluster 2) = 2/8 = 0.250.

• Putting the individual cluster entropies and theirweights together gives the overall EMIAC entropy ofthe clustering:

7/22/2019 https://visualstudiomagazine.com/articles/2013/02/01/data-clustering-using-entropy-minimization.aspx 18

Page 19: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Normalized Mutual Information

7/22/2019 19

Page 20: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Normalized Mutual Information

7/22/2019 20

Page 21: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Normalized Mutual Information

7/22/2019 21

Page 22: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Normalized Mutual Information

7/22/2019 22

Page 23: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Normalized Mutual Information

7/22/2019 23

Page 24: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Normalized Mutual Information

7/22/2019 24

Page 25: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Normalized Mutual Information

7/22/2019 25

Page 26: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Normalized Mutual Information

7/22/2019 26

Page 27: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Normalized Mutual Information

7/22/2019 27

Page 28: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Normalized Mutual Information

7/22/2019 28

Page 29: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Normalized Mutual Information

7/22/2019 29

Page 30: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Normalized Mutual Information

7/22/2019 30

Page 31: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Normalized Mutual Information

7/22/2019 31

Page 32: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Normalized Mutual Information

7/22/2019 32

Page 33: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Rand Index

• Rand Index (RI) is based on comparing pairs of elements.

• Theory suggests, that similar pairs of elements should be placed in the same cluster, while dissimilar pairs of elements should be placed in separate clusters.

• RI does not care about difference in number of clusters.

• It just cares about True/False pairs of elements.

• Based on this assumption, RI, is calculated;

7/22/2019 https://stats.stackexchange.com/questions/89030/rand-index-calculation/173581 33

Page 34: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

• In denominator, we have total possible pairs, which is (17 2) = 136

• True Positives or correct similar;• a = (5 2) + (1 2) + (2 2) + (1 2) + (4 2) + (0 2) + (0 2) + (1 2) + (3 2) = 10 + 0 + 1 + 0 + 6 + 0 + 0 + 0 + 3 = 20

• False Positives or incorrect dissimilar;• c = 5*1 + 5*2 + 1*2 + 1*4 + 1*0 + 4*0 + 0*1 + 0*3 + 1*3 = 5 + 10 + 2 + 4 + 0 + 0 + 0 + 0 + 3 = 24

• False Negative or incorrect similar;• d = 5*1 + 5*0 + 1*0 +1*4 + 1*1 + 4*1+2*0 + 2*3 + 0*3 = 5 + 0 + 0 + 4 + 1 + 4 + 0 + 6 + 0 = 20

• True Negatives or correct dissimilar;• d = 5*4 + 5*0 + 5*1 + 5*3 + 1*1 + 1*0 + 1*0 + 1*3 + 2*1 + 2*4 + 2*0 + 2*1+ 1*1 + 1*3+ 4*0 + 4*3 = 72

• Rand Index=(20 + 72) / 136 = 0.676

7/22/2019 https://stats.stackexchange.com/questions/89030/rand-index-calculation/173581 34

Page 35: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Rand Index

• In denominator, we have total possible pairs, which is (17 2) = 136

• True Positives or correct similar;• a = (5 2) + (1 2) + (2 2) + (1 2) + (4 2) + (0 2) + (0 2) + (1 2) + (3 2) = 10 + 0 + 1 + 0 + 6 + 0 +

0 + 0 + 3 = 20

• False Positives or incorrect dissimilar;• c = 5*1 + 5*2 + 1*2 + 1*4 + 1*0 + 4*0 + 0*1 + 0*3 + 1*3 = 5 + 10 + 2 + 4 + 0 + 0 + 0 + 0 +

3 = 24

7/22/2019 https://stats.stackexchange.com/questions/89030/rand-index-calculation/173581 35

Page 36: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Measuring Cluster Validity Via Correlation• Two matrices

• Proximity Matrix

• “Incidence” Matrix

• One row and one column for each data point

• An entry is 1 if the associated pair of points belong to the same cluster

• An entry is 0 if the associated pair of points belongs to different clusters

• Compute the correlation between the two matrices• Since the matrices are symmetric, only the correlation between n(n-1) / 2 entries needs to be

calculated.

• High correlation indicates that points that belong to the same cluster are close to each other.

• Not a good measure for some density or contiguity based clusters.

7/22/2019 36

Page 37: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Measuring Cluster Validity Via Correlation

• Correlation of incidence and proximity matrices for the K-means clusterings of the following two data sets.

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

x

y

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

x

y

Corr = -0.9235 Corr = -0.58107/22/2019 37

Page 38: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Using Similarity Matrix for Cluster Validation

• Order the similarity matrix with respect to cluster labels and inspect visually.

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

x

y

Points

Po

ints

20 40 60 80 100

10

20

30

40

50

60

70

80

90

100Similarity

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

7/22/2019 38

Page 39: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Using Similarity Matrix for Cluster Validation

• Clusters in random data are not so crisp

Points

Po

ints

20 40 60 80 100

10

20

30

40

50

60

70

80

90

100Similarity

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

DBSCAN

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

x

y7/22/2019 39

Page 40: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Points

Po

ints

20 40 60 80 100

10

20

30

40

50

60

70

80

90

100Similarity

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Using Similarity Matrix for Cluster Validation

• Clusters in random data are not so crisp

K-means

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

x

y7/22/2019 40

Page 41: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Using Similarity Matrix for Cluster Validation

• Clusters in random data are not so crisp

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

x

y

Points

Po

ints

20 40 60 80 100

10

20

30

40

50

60

70

80

90

100Similarity

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Complete Link

7/22/2019 41

Page 42: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Using Similarity Matrix for Cluster Validation

1 2

3

5

6

4

7

DBSCAN

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

500 1000 1500 2000 2500 3000

500

1000

1500

2000

2500

3000

7/22/2019 42

Page 43: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Internal Measures: SSE• Clusters in more complicated figures are not well separated

• Internal Index: Used to measure the goodness of a clustering structure without respect to external information

• Sum of Squared Error

• SSE is good for comparing two clusterings or two clusters (average SSE).

• Can also be used to estimate the number of clusters

2 5 10 15 20 25 300

1

2

3

4

5

6

7

8

9

10

K

SS

E

5 10 15

-6

-4

-2

0

2

4

6

7/22/2019 43

Page 44: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Internal Measures: SSE

• SSE curve for a more complicated data set

1 2

3

5

6

4

7

SSE of clusters found using K-means

7/22/2019 44

Page 45: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Internal Measures: Cohesion and Separation

• Cluster Cohesion: Measures how closely related are objects in a cluster• Cluster Separation: Measure how distinct or well-separated a cluster is from other

clusters

• Example: Squared Error

• Cohesion is measured by the within cluster sum of squares (SSE)

• Separation is measured by the between cluster sum of squares

Where |Ci| is the size of cluster i

i Cx

ii

mxWSS2)(

i

ii mmCBSS 2)(

7/22/2019 45

Page 46: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Internal Measures: Cohesion and Separation

• Example: SSE• BSS + WSS = constant

1091

9)35.4(2)5.13(2

1)5.45()5.44()5.12()5.11(

22

2222

Total

BSS

WSS

1 2 3 4 5 m1 m2

m

K=2 clusters:

10010

0)33(4

10)35()34()32()31(

2

2222

Total

BSS

WSSK=1 cluster:

7/22/2019 46

Page 47: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Internal Measures: Silhouette Coefficient

• Silhouette Coefficient combine ideas of both cohesion and separation, but for individual points, as well as clusters and clusterings

• For an individual point, i

• Calculate a = average distance of i to the points in its cluster

• Calculate b = min (average distance of i to points in another cluster)

• The silhouette coefficient for a point is then given by

s = 1 – a/b if a < b, (or s = b/a - 1 if a b, not the usual case)

• Typically between 0 and 1.

• The closer to 1 the better.

• Can calculate the Average Silhouette width for a cluster or a clustering

a

b

7/22/2019 47

Page 48: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Iris Dataset Example

7/22/2019 http://www.sthda.com/english/wiki/print.php?id=241 48

KMEANS PAMHierarchical

Page 49: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Silhouette Coefficient Example

7/22/2019 https://scikit-learn.org/stable/auto_examples/cluster/plot_kmeans_silhouette_analysis.html 49

Page 50: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Silhouette Coefficient Example

507/22/2019 https://scikit-learn.org/stable/auto_examples/cluster/plot_kmeans_silhouette_analysis.html

Page 51: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Silhouette Coefficient Example

517/22/2019 https://scikit-learn.org/stable/auto_examples/cluster/plot_kmeans_silhouette_analysis.html

Page 52: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Silhouette Coefficient Example

527/22/2019 https://scikit-learn.org/stable/auto_examples/cluster/plot_kmeans_silhouette_analysis.html

Page 53: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Silhouette Coefficient Example

537/22/2019 https://scikit-learn.org/stable/auto_examples/cluster/plot_kmeans_silhouette_analysis.html

Page 54: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Silhouette Coefficient Example

547/22/2019 https://scikit-learn.org/stable/auto_examples/cluster/plot_kmeans_silhouette_analysis.html

Page 55: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Internal Measures: Gap statistic

• The gap statistic compares the total within intra-cluster variation for different values of k with their expected values under null reference distribution of the data.

• The estimate of the optimal clusters will be value that maximize the gap statistic (i.e, that yields the largest gap statistic).

• This means that the clustering structure is far away from the random uniform distribution of points.

7/22/2019 https://www.datanovia.com/en/lessons/determining-the-optimal-number-of-clusters-3-must-know-methods/#gap-statistic-method 55

Page 56: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

How to decide best cluster number?

7/22/2019 https://www.datanovia.com/en/lessons/determining-the-optimal-number-of-clusters-3-must-know-methods/#gap-statistic-method 56

Page 57: GSÜSEM Uygulamalı Veri Analizi Sertifika Programı...Different Aspects of Cluster Validation 1. Determining the clustering tendency of a set of data, i.e., distinguishing whether

Final Comment on Cluster Validity

“The validation of clustering structures is the most difficult and frustrating

part of cluster analysis.

Without a strong effort in this direction, cluster analysis will remain a black

art accessible only to those true believers who have experience and great

courage.”

Algorithms for Clustering Data, Jain and Dubes

7/22/2019 57