Data mining Practical Connection Assignment
Dr. Oner Celepcikay
ITS 632
ITS 632
Data Mining
Data Mining Tools II – Clustering Part II
Header – dark yellow 24 points Arial Bold
Body text – white 20 points Arial Bold, dark yellow highlights
Bullets – dark yellow
Copyright – white 12 points Arial
Size:
Height: 7.52"
Width: 10.02"
Scale: 70%
Position on slide:
Horizontal - 0"
Vertical - 0"
Hierarchical Clustering
- Two main types of hierarchical clustering
- Agglomerative:
- Start with the points as individual clusters
- At each step, merge the closest pair of clusters until only one cluster (or k clusters) left
- Divisive:
- Start with one, all-inclusive cluster
- At each step, split a cluster until each cluster contains a point (or there are k clusters)
- Traditional hierarchical algorithms use a similarity or distance matrix
- Merge or split one cluster at a time
Agglomerative Clustering Algorithm
- More popular hierarchical clustering technique
- Basic algorithm is straightforward
Compute the proximity matrix
Let each data point be a cluster
Repeat
Merge the two closest clusters
Update the proximity matrix
Until only a single cluster remains
- Key operation is the computation of the proximity of two clusters
- Different approaches to defining the distance between clusters distinguish the different algorithms
Starting Situation
- Start with clusters of individual points and a proximity matrix
Proximity Matrix
p1
p3
p5
p4
p2
p1
p2
p3
p4
p5
. . .
.
.
.
...�
p1�
p2�
p3�
p4�
p9�
p10�
p11�
p12�
Intermediate Situation
- After some merging steps, we have some clusters
C1
C4
C2
C5
C3
Proximity Matrix
C2
C1
C1
C3
C5
C4
C2
C3
C4
C5
...�
p1�
p2�
p3�
p4�
p9�
p10�
p11�
p12�
Intermediate Situation
- We want to merge the two closest clusters (C2 and C5) and update the proximity matrix.
C1
C4
C2
C5
C3
Proximity Matrix
C2
C1
C1
C3
C5
C4
C2
C3
C4
C5
...�
p1�
p2�
p3�
p4�
p9�
p10�
p11�
p12�
After Merging
- 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
...�
p1�
p2�
p3�
p4�
p9�
p10�
p11�
p12�
How to Define Inter-Cluster Similarity
Similarity?
- MIN
- MAX
- Group Average
- Distance Between Centroids
- Other methods driven by an objective function
- Ward’s Method uses squared error
Proximity Matrix
p1
p3
p5
p4
p2
p1
p2
p3
p4
p5
. . .
.
.
.
How to Define Inter-Cluster Similarity
Proximity Matrix
- MIN
- MAX
- Group Average
- Distance Between Centroids
- Other methods driven by an objective function
- Ward’s Method uses squared error
p1
p3
p5
p4
p2
p1
p2
p3
p4
p5
. . .
.
.
.
How to Define Inter-Cluster Similarity
Proximity Matrix
- MIN
- MAX
- Group Average
- Distance Between Centroids
- Other methods driven by an objective function
- Ward’s Method uses squared error
p1
p3
p5
p4
p2
p1
p2
p3
p4
p5
. . .
.
.
.
How to Define Inter-Cluster Similarity
Proximity Matrix
- MIN
- MAX
- Group Average
- Distance Between Centroids
- Other methods driven by an objective function
- Ward’s Method uses squared error
p1
p3
p5
p4
p2
p1
p2
p3
p4
p5
. . .
.
.
.
How to Define Inter-Cluster Similarity
Proximity Matrix
- MIN
- MAX
- Group Average
- Distance Between Centroids
- Other methods driven by an objective function
- Ward’s Method uses squared error
p1
p3
p5
p4
p2
p1
p2
p3
p4
p5
. . .
.
.
.
Cluster Similarity: MIN or Single Link
- Similarity of two clusters is based on the two most similar (closest) points in the different clusters
- Determined by one pair of points, i.e., by one link in the proximity graph.
1
2
3
4
5
Sheet1
| 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 |
Sheet2
Sheet3
Hierarchical Clustering: MIN
Nested Clusters
Dendrogram
1
2
3
4
5
6
1
2
3
4
5
Cluster Similarity: MAX or Complete Linkage
- Similarity of two clusters is based on the two least similar (most distant) points in the different clusters
- Determined by all pairs of points in the two clusters
1
2
3
4
5
Sheet1
| 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 |
Sheet2
Sheet3
Hierarchical Clustering: MAX
Nested Clusters
Dendrogram
1
2
3
4
5
6
1
2
5
3
4
Hierarchical Clustering: Comparison
Group Average
Ward’s Method
MIN
MAX
1
2
3
4
5
6
1
2
5
3
4
1
2
3
4
5
6
1
2
5
3
4
1
2
3
4
5
6
1
2
5
3
4
1
2
3
4
5
6
1
2
3
4
5
Hierarchical Clustering: Problems and Limitations
- Once a decision is made to combine two clusters, it cannot be undone
- No objective function is directly minimized
- 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
Cluster Validity
- For supervised classification we have a variety of measures to evaluate how good our model is
- Accuracy, precision, recall
- For cluster analysis, the analogous 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
- 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.
- Entropy
- 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.
Measures of Cluster Validity
- 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
- 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
Internal Measures: Silhouette Coefficient
“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
Final Comment on Cluster Validity
...
p1p2p3p4p9p10p11p12
...
p1p2p3p4p9p10p11p12
...
p1p2p3p4p9p10p11p12
...
p1p2p3p4p9p10p11p12
I1I2I3I4I5
I11.000.900.100.650.20
I20.901.000.700.600.50
I30.100.701.000.400.30
I40.650.600.401.000.80
I50.200.500.300.801.00
3
6
2
5
4
1
0
0.05
0.1
0.15
0.2
I1I2I3I4I5
I11.000.900.100.650.20
I20.901.000.700.600.50
I30.100.701.000.400.30
I40.650.600.401.000.80
I50.200.500.300.801.00
3
6
4
1
2
5
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
a
b