Data Mining
Cluster Analysis: Basic Concepts
and Algorithms
Lecture Notes for Chapter 8
Introduction to Data Mining
by
Tan, Steinbach, Kumar
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 1 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 2
Clustering Algorithms
l K-means and its variants
l Hierarchical clustering
l Density-based clustering
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 3
Hierarchical Clustering
l Produces a set of nested clusters organized as a
hierarchical tree
l Can be visualized as a dendrogram
– A tree like diagram that records the sequences of
merges or splits
1 3 2 5 4 6
0 0.05 0.1 0.15 0.2
1 2
3 4
5 6
1 2
3 4
5
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 4
Strengths of Hierarchical Clustering
l Do not have to assume any particular number of
clusters
– Any desired number of clusters can be obtained by
‘cutting’ the dendogram at the proper level
l They may correspond to meaningful taxonomies
– Example in biological sciences (e.g., animal kingdom,
phylogeny reconstruction, …)
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 5
Hierarchical Clustering
l Two main types of hierarchical clustering
– Agglomerative:
u
Start with the points as individual clusters
u
At each step, merge the closest pair of clusters until only one cluster
(or k clusters) left
– Divisive:
u
Start with one, all-inclusive cluster
u
At each step, split a cluster until each cluster contains a point (or
there are k clusters)
l Traditional hierarchical algorithms use a similarity or
distance matrix
– Merge or split one cluster at a time
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 6
Agglomerative Clustering Algorithm
l Most popular hierarchical clustering technique
l Basic algorithm is straightforward
1. Compute the proximity matrix
2. Let each data point be a cluster
3. Repeat
4. Merge the two closest clusters
5. Update the proximity matrix
6. Until only a single cluster remains
l Key operation is the computation of the proximity of
two clusters
– Different approaches to defining the distance between
clusters distinguish the different algorithms
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 7
Starting Situation
l Start with clusters of individual points and a
proximity matrix
p1
p3
p5 p4 p2
p1 p2 p3 p4 p5 . . .
. .
.
Proximity Matrix
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 8
Intermediate Situation
l
After some merging steps, we have some clusters
C1
C4
C2 C5
C3
C2 C1 C1
C3
C5 C4 C2
C3 C4 C5
Proximity Matrix
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 9
Intermediate Situation
l
We want to merge the two closest clusters (C2 and C5) and
update the proximity matrix.
C1
C4
C2 C5
C3
C2 C1 C1
C3
C5 C4 C2
C3 C4 C5
Proximity Matrix
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 10
After Merging
l
The question is “How do we update the proximity matrix?”
C1
C4
C2 U C5 C3
? ? ? ?
?
?
? C2 U C5 C1 C1
C3 C4 C2 U C5
C3 C4
Proximity Matrix
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 11
How to Define Inter-Cluster Similarity
p1
p3
p5 p4 p2
p1 p2 p3 p4 p5 . . .
. . . Similarity?
l MIN
l MAX
l Group Average
l Distance Between Centroids
l Other methods driven by an objective
function
– Ward’s Method uses squared error
Proximity Matrix
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 12
How to Define Inter-Cluster Similarity
p1
p3
p5 p4 p2
p1 p2 p3 p4 p5 . . .
. .
.
Proximity Matrix
l MIN
l MAX
l Group Average
l Distance Between Centroids
l Other methods driven by an objective
function
– Ward’s Method uses squared error
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 13
How to Define Inter-Cluster Similarity
p1
p3
p5 p4 p2
p1 p2 p3 p4 p5 . . .
. .
.
Proximity Matrix
l MIN
l MAX
l Group Average
l Distance Between Centroids
l Other methods driven by an objective
function
– Ward’s Method uses squared error
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 14
How to Define Inter-Cluster Similarity
p1
p3
p5 p4 p2
p1 p2 p3 p4 p5 . . .
. .
.
Proximity Matrix
l MIN
l MAX
l Group Average
l Distance Between Centroids
l Other methods driven by an objective
function
– Ward’s Method uses squared error
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 15
How to Define Inter-Cluster Similarity
p1
p3
p5 p4 p2
p1 p2 p3 p4 p5 . . .
. .
.
Proximity Matrix
l MIN
l MAX
l Group Average
l Distance Between Centroids
l Other methods driven by an objective
function
– Ward’s Method uses squared error
×××× ××××
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 16
Cluster Similarity: MIN or Single Link
l Similarity of two clusters is based on the two
most similar (closest) points in the different
clusters.
I1 I2 I3 I4 I5
I1 1.00 0.90 0.10 0.65 0.20
I2 0.90 1.00 0.70 0.60 0.50
I3 0.10 0.70 1.00 0.40 0.30
I4 0.65 0.60 0.40 1.00 0.80
I5 0.20 0.50 0.30 0.80 1.00 1 2 3 4 5
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 17
Hierarchical Clustering: MIN
Nested Clusters Dendrogram
1
2
3
4
5
6
1
2
3
4
5
3 6 2 5 4 1
0 0.05 0.1 0.15 0.2
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 18
Strength of MIN
Original Points Two Clusters
• Can handle non-elliptical shapes
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 19
Limitations of MIN
Original Points Two Clusters
• Sensitive to noise and outliers
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 20
Cluster Similarity: MAX or Complete Linkage
l Similarity of two clusters is based on the two least
similar (most distant) points in the different
clusters.
I1 I2 I3 I4 I5
I1 1.00 0.90 0.10 0.65 0.20
I2 0.90 1.00 0.70 0.60 0.50
I3 0.10 0.70 1.00 0.40 0.30
I4 0.65 0.60 0.40 1.00 0.80
I5 0.20 0.50 0.30 0.80 1.00 1 2 3 4 5
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 21
Hierarchical Clustering: MAX
Nested Clusters Dendrogram
3 6 4 1 2 5
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
1
2
3
4
5
6
1
2 5
3
4
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 22
Strength of MAX
Original Points Two Clusters
• Less susceptible to noise and outliers
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 23
Limitations of MAX
Original Points Two Clusters
•Tends to break large clusters
•Biased towards globular clusters
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 24
Cluster Similarity: Group Average
l
Proximity of two clusters is the average of pairwise proximity
between points in the two clusters.
|
|Cluster
|
|Cluster ) p , p proximity(
) Cluster , Cluster proximity(
j i Cluster pCluster p
j i
j i
j j
i i
= ∗
∑
∈∈
I1 I2 I3 I4 I5
I1 1.00 0.90 0.10 0.65 0.20
I2 0.90 1.00 0.70 0.60 0.50
I3 0.10 0.70 1.00 0.40 0.30
I4 0.65 0.60 0.40 1.00 0.80
I5 0.20 0.50 0.30 0.80 1.00 1 2 3 4 5
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 25
Hierarchical Clustering: Group Average
Nested Clusters Dendrogram
3 6 4 1 2 5
0 0.05 0.1 0.15 0.2 0.25
1
2
3
4
5
6
1
2
5
3
4
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 26
Hierarchical Clustering: Group Average
l Compromise between Single and Complete
Linkage
l Strengths
– Less susceptible to noise and outliers
l Limitations
– Biased towards globular clusters
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 27
Cluster Similarity: Ward’s Method
l Similarity of two clusters is based on the increase
in squared error when two clusters are merged
– Similar to group average if distance between points is
squared euclidian distance
l Less susceptible to noise and outliers
l Biased towards globular clusters
l Hierarchical analogue of K-means
– Can be used to initialize K-means
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 28
Hierarchical Clustering: Comparison
Group Average Ward’s Method
1
2 3 4 5
6 1 2 5
3 4
MIN MAX
1
2 3 4 5
6 1 2
5
3 4
1
2 3 4 5
6 1
2 5
3 1 4
2 3 4 5
6 1 2
3
4 5
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 29
Hierarchical Clustering: Example
5.9
4.8
5
2.0
1.9
4
5.7
5.2
3
2.1
1.7
2
6.2
5.0
1
x 2
x 1
0
6.8
0.6
6.9
0.5
5
0
7.0
0.3
7.3
4
0
7.1
0.7
3
0
7.4
2
0
1
5
4
3
2
1
Use Manhattan distance as distance measure.
For example: d(2,1) = |1.7 - 5.0| + |2.1 - 6.2| = 7.4
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 30
Hierarchical Clustering: Example
5.9
4.8
5
2.0
1.9
4
5.7
5.2
3
2.1
1.7
2
6.2
5.0
1
x 2
x 1
0
6.8
0.6
6.9
0.5
5
0
7.0
0.3
7.3
4
0
7.1
0.7
3
0
7.4
2
0
1
5
4
3
2
1
Look for smallest non-diagonal entry in matrix.
Merge the corresponding clusters.
D 1
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 31
Hierarchical Clustering: Example
l Objects 2 and 4 are most similar, since entry
(4,2) has the smallest value of the distance matrix
l Make a new cluster {4,2} and remove the single
point clusters {2} and {4}.
l Compute the distance between the newly formed
cluster and the remaining clusters {1}, {3} and {5}.
For example (single linkage):
d({1},{2,4}) = min{d(1,2),d(1,4)} = min{7.4,7.3} = 7.3
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 32
Hierarchical Clustering: Example
0
0.6
6.8
0.5
5
0
7.0
0.7
3
0
7.3
{2,4}
0
1
5
3
{2,4}
D 2 1
0
7.0
0.6
3
0
6.8
{2,4}
0
{1,5}
3
{2,4}
{1,5}
D 3
0
6.8
{2,4}
0
{1,5,3}
{2,4}
{1,5,3}
D 4
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 33
Example: data points
0 1 2 3 4 5 6
01234567
x1
x2
1
2
3
4
5
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 34
Example: Dendrogram
2 4 3 1 5
01234567
Cluster Dendrogram
hclust (*, "single") Single Linkage
Height
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 35
Hierarchical Clustering: Time and Space requirements
l O(N 2 ) space since it uses the proximity matrix.
– N is the number of points.
l O(N 3 ) time in many cases
– There are N steps and at each step the size, N 2 ,
proximity matrix must be updated and searched
– Complexity can be reduced to O(N 2 log(N) ) time for
some approaches
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 36
Hierarchical Clustering: Problems and Limitations
l Once a decision is made to combine two clusters,
it cannot be undone
l No objective function is directly minimized
l Different schemes have problems with one or
more of the following:
– Sensitivity to noise and outliers
– Difficulty handling different sized clusters and convex
shapes
– Breaking large clusters
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 37
DBSCAN
l DBSCAN is a density-based algorithm.
– Density = number of points within a specified radius (Eps)
– A point is a core point if it has at least a specified number of
points (MinPts) within Eps (including the point itself).
u
These are points that are at the interior of a cluster
– A border point has fewer than MinPts within Eps, but is in
the neighborhood of a core point
– A noise point is any point that is not a core point or a border
point.
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 38
DBSCAN: Core, Border, and Noise Points
5
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 39
DBSCAN Algorithm
l Label all points as core, border or noise.
l Eliminate noise points.
l Perform clustering on the remaining points
– Put an edge between all core points within Eps of
each other.
– Make each group of connected core points into a
separate cluster.
– Assign each border point to the cluster of one of its
associated core points.
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 40
DBSCAN: Core, Border and Noise Points
Original Points Point types: core,
border and noise
Eps = 10, MinPts = 4
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 41
When DBSCAN Works Well
Original Points Clusters
• Resistant to Noise
• Can handle clusters of different shapes and sizes
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 42
Potential Problem with DBSCAN
A B C D
noise noise
If we choose Minpts small enough that C and D
are found as separate clusters, than A+B+surrounding
noise will become a single cluster.
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 43
DBSCAN: Determining EPS and MinPts
l Idea is that for points in a cluster, their k th nearest
neighbors are at roughly the same distance
l Noise points have the k th nearest neighbor at farther
distance
l So, plot sorted distance of every point to its k th
nearest neighbor
Choose Eps = 10
because of sharp
increase in distance
to 4 th nearest
neighbour.
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 44
Cluster Validity
l For supervised classification we have a variety of
measures to evaluate how good our model is
– Accuracy, precision, recall
l For cluster analysis, the analogous question is how to
evaluate the “goodness” of the resulting clusters?
l But “clusters are in the eye of the beholder”!
l 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
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 45
Clusters found in Random Data
0 0. 2 0.4 0.6 0.8 1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
y
Random Points
0 0. 2 0.4 0.6 0.8 1
0 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 1
0 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 1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
y
Complete Link
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 46
1. 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
without reference to external information.
- Use only the data
4. Comparing two sets of clusters 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.
Different Aspects of Cluster Validation
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 47
l 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.
u
Entropy
– Internal Index: Used to measure the goodness of a
clustering structure without reference to external
information.
u
Sum of Squared Error (SSE)
– Relative Index: Used to compare two different
clusterings or clusters.
u
Often an external or internal index is used for this function, e.g., SSE
or entropy
Measures of Cluster Validity
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 48
l Two matrices
– Proximity Matrix
– “Incidence” Matrix
u
One row and one column for each data point
u
An entry is 1 if the associated pair of points belong to the same cluster
uAn entry is 0 if the associated pair of points belongs to different clusters
l 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.
l Strong correlation indicates that points that belong to the
same cluster are close to each other.
l Not a good measure for some density or contiguity based
clusters.
Measuring Cluster Validity Via Correlation
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 49
Measuring Cluster Validity Via Correlation
l Correlation of incidence and distance matrices for
the K-means clusterings of the following two data
sets.
0 0. 2 0.4 0.6 0.8 1
0 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 1
0 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.5810
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 50
Correlation Example
0
6.8
0.6
6.9
0.5
5
0
7.0
0.3
7.3
4
0
7.1
0.7
3
0
7.4
2
0
1
5
4
3
2
1
D
1
0
1
0
1
5
1
0
1
0
4
1
0
1
3
1
0
2
1
1
5
4
3
2
1
…
…
(4,1)
0
7.1
(3,2)
1
0.7
(3,1)
0
7.4
(2,1)
corr = -0.998
C 1 = {1,5,3}
C 2 = {2,4}
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 51
l Order the similarity matrix with respect to cluster
labels and inspect visually.
Using Similarity Matrix for Cluster Validation
0 0. 2 0.4 0.6 0.8 1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
y
Points
Points
20 40 60 80 100
10 20 30 40 50 60 70 80 90 100
Similarity0 0. 1 0. 2 0. 3 0. 4 0. 5 0. 6 0. 7 0. 8 0. 9 1
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 52
Using Similarity Matrix for Cluster Validation
l Clusters in random data are not so crisp
Points
Points
20 40 60 80 100
10 20 30 40 50 60 70 80 90 100
Similarity0 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 1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
y
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 53 Points
Points
20 40 60 80 100
10 20 30 40 50 60 70 80 90 100
Similarity0 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
l Clusters in random data are not so crisp
K-means
0 0. 2 0.4 0.6 0.8 1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
y
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 54
Using Similarity Matrix for Cluster Validation
l Clusters in random data are not so crisp
0 0. 2 0.4 0.6 0.8 1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
y
Points
Points
20 40 60 80 100
10 20 30 40 50 60 70 80 90 100
Similarity0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Complete Link
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 55
l Clusters in more complicated figures aren’t well separated
l
Internal Index: Used to measure the quality of a clustering
without respect to external information
– SSE
l SSE is good for comparing two clusterings or two clusters
(average SSE).
l Can also be used to estimate the number of clusters
Internal Measures: SSE
2 5 10 15 20 25 30
0 1 2 3 4 5 6 7 8 9 10
K
SSE
5 10 15
-6 -4 -2 0 2 4 6
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 56
Internal Measures: SSE
l SSE curve for a more complicated data set
1 2
3
5 6
4
7
SSE of clusters found using K-means
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 57
l Need a framework to interpret any measure.
– For example, if our measure of evaluation has the value, 10, is that
good, fair, or poor?
l 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.
u
If the value of the index is unlikely, then the cluster results are valid
– These approaches are more complicated and harder to understand.
l For comparing the results of two different sets of clusters,
a framework is less necessary.
– However, there is the question of whether the difference between two
index values is significant
Framework for Cluster Validity
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 58
l Example
– Compare SSE of 0.005 against three clusters in random data
– Histogram shows SSE of three clusters in 500 sets of random data
points of size 100 distributed over the range 0.2 – 0.8 for x and y
values
Statistical Framework for SSE
0.0160 0.0180.020.0220.0240.0260.0280.03 0.0320.034 5
10 15 20 25 30 35 40 45 50
SSE
Count
0 0. 2 0.4 0.6 0.8 1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
y
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 59
l Correlation of incidence and proximity matrices for the
K-means clusterings of the following two data sets.
Statistical Framework for Correlation
0 0.2 0.4 0.6 0.8 1
0 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 1
0 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.5810
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 60
l Cluster Cohesion: Measures how closely related
are objects in a cluster
– Example: SSE
l Cluster Separation: Measure how distinct or well-
separated a cluster is from other clusters
l 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 |C
i| is the size of cluster i and m is the overall mean
Internal Measures: Cohesion and Separation
∑ ∑
∈ −
=
i x C i
i
m
x
WSS ( ) 2
∑ −
=
i
i
i
m m
C
BSS ( )
2© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 61
Internal Measures: Cohesion and Separation
l Example: SSE
– BSS + WSS = constant
1 ×××× 2 ×××× 3 4 ×××× 5
m
1m
2m
10
9
1
9
)
3
5
.
4
(
2
)
5
.
1
3
(
2
1
)
5
.
4
5
(
)
5
.
4
4
(
)
5
.
1
2
(
)
5
.
1
1
(
2 2
2 2 2 2
=
+
=
=
−
×
+
−
×
=
=
−
+
−
+
−
+
−
=
Total
BSS
K=2 clusters: WSS
10
0
10
0
)
3
3
(
4
10
)
3
5
(
)
3
4
(
)
3
2
(
)
3
1
(
2
2 2 2 2
=
+
=
=
−
×
=
=
−
+
−
+
−
+
−
=
Total
BSS
K=1 cluster: WSS
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 62 l
A proximity graph based approach can also be used for
cohesion and separation.
– Cluster cohesion is the sum of the weight of all links within a cluster.
– Cluster separation is the sum of the weights between nodes in the cluster
and nodes outside the cluster.
Internal Measures: Cohesion and Separation
cohesion separation
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 63 l
Silhouette Coefficient combine ideas of both cohesion and separation,
but for individual points, as well as clusters and clusterings
l
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.
l
Can calculate the Average Silhouette width for a cluster or a
clustering: does not necessarily increase with k.
Internal Measures: Silhouette Coefficient
a b
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 64
External Measures of Cluster Validity: Entropy and Purity
© Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 65