Chapter8-Basic Cluster Analysis2016
Chapter8-Basic Cluster Analysis2016
Chapters 8 & 9
Cluster Analysis
What Is Cluster Analysis
2
What is Cluster Analysis?
Inter-cluster
Intra-cluster distances are
distances are maximized
minimized
3
Applications of Cluster Analysis
Understanding
Classes, or conceptually
meaningful groups of objects
that share common
characteristics, play an
important role in how people
analyze and describe the
world.
Group related documents for
browsing, group genes and
proteins that have similar
functionality, or group stocks
with similar price fluctuations
Summarization
Reduce the size of large data
Clustering precipitation
sets in Australia
4
What is not Cluster Analysis?
Supervised classification
Have class label information
Simple segmentation
Dividing students into different registration groups
alphabetically, by last name
Results of a query
Groupings are a result of an external specification
Graph partitioning
If the purpose is to divide a graph into some sub-graphs
5
Notion of a Cluster can be Ambiguous
6
Types of Clusterings (1/2)
7
Partitional Clustering
8
Hierarchical Clustering
9
A hierarchical clustering can be viewed as a
sequence of partitional clusterings and a
partitional clustering can be obtained by taking
any member of that sequence; i.e., by cutting the
hierarchical tree at a particular level.
10
Types of Clusterings (2/2)
Well-separated clusters
Density-based clusters
Shared-Property or Conceptual
Well-Separated Clusters:
A cluster is a set of points such that any point in a cluster is
closer (or more similar) to every other point in the cluster than
to any point not in the cluster.
Sometimes a threshold is used to specify that all the objects in
a cluster must be sufficiently close to one another.
3 well-separated clusters
13
Types of Clusters: Center-Based (Prototype)
Center-based
A cluster is a set of objects such that an object in a cluster is
closer (more similar) to the center of a cluster, than to the
center of any other cluster Continuous data
4 center-based clusters
14
Types of Clusters: Contiguity-Based (Graph)
8 contiguous clusters
15
Types of Clusters: Density-Based
Density-based
A cluster is a dense region of points, which is separated by
low-density regions, from other regions of high density.
Used when the clusters are irregular or intertwined, and when
noise and outliers are present.
6 density-based clusters
16
Types of Clusters: Conceptual Clusters
(Shared Property)
2 Overlapping Circles
17
Types of Clusters: Objective Function
21
SOM Neural Network
22
Network Structure
5X5 topology
Node (j, k)
Node i
23
Network Structure
24
Basic Concept (1/8)
25
Basic Concept (2/8)
a
Topology coordinate
b a : (1,3)
Xt b : (3,1)
26
Basic Concept (3/8)
(n+2)th iteration
27
Basic Concept (4/8)
28
Basic Concept (5/8)
where
X j , Y j = The coordinate values for jth output node.
C x , C y = The coordinate values of the neighborhood center.
30
Basic Concept (7/8)
R
R
Rn=R_rate x Rn-1
32
Algorithm-Training (1/5)
33
Algorithm Training (2/5)
34
Algorithm-Training (3/5)
35
Algorithm-Training (4/5)
where
R = Neighborhood radius
neighborhood[ j ][ k ]=exp(-r[ j ][ k ] / R)
r[ j ][ k ]=[(X_Node[ j ][ k ] - X_Node[ j* ][ k* ])2
+(Y_Node[ j ][ k ] - Y_Node[ j* ][ k* ])2]1/2
36
Algorithm-Training (5/5)
38
An Example of Output Topology
Frequency
Output- Y axis
Output- X axis
39
Error Measure
Total distance=
where
P: Training sample
The average of total
distances can be used as
the termination criterion.
40
Homework 2 (1/2)
41
Homework 2 (2/2)
Appendix 1
Error
Training iteration
Appendix 2
Frequency Topology k
Topology j
42
K-Means
43
K-means Clustering
44
K-Means Example
Training samples
x4
x2
x6
x7 x8
x1 x3 x5
46
K-Means Example
47
K-Means Example
X4
Z2 X2
X6
X7 X8
X1
X3 X5 Z3
Z1
48
K-Means Example
49
K-Means Example
Z1 Z2 Z3
X1 1.000 7.616 7.071
X2 8.944 1.000 8.544
X3 1.000 8.246 6.000
X4 10.296 2.236 9.220
X5 6.000 8.544 1.000
X6 7.211 2.236 6.708
X7 2.828 6.083 5.385
X8 7.280 7.211 2.000
50
K-Means Example
Z1 X Y
cluster coordinate coordinate
X1 -1 1
X3 0 0
X7 1 2
52
K-Means Example
Z2 X Y
cluster coordinate coordinate
X2 3 8
X4 4 9
X6 3 6
Z3 X Y
cluster coordinate coordinate
X5 5 0
X8 6 2
53
K-Means Example
Z1new 0 1
Z3new 5.5 1
54
K-Means Example
X4
X2
Z2NEW
X6
X7 X8
X1 Z3NEW
Z1NEW X5
X3
55
K-Means Example
56
K-Means Example
Z1new 0 1
Z3new 5.5 1
57
K-Means Example
X4
X2
Z2NEW
X6
X7 X8
X1 Z3NEW
Z1NEW X5
X3
58
K-means Clustering Details
60
Centroids and Objective Functions
61
Assigning Points to the Closest Centroid
62
Evaluating K-means Clusters
63
Two different K-means Clusterings
Original Points
65
Importance of Choosing Initial Centroids
66
Importance of Choosing Initial Centroids
67
Importance of Choosing Initial Centroids
68
Problems with Selecting Initial Points
69
10 Clusters Example
Starting with two initial centroids in one cluster of each pair of clusters
70
10 Clusters Example
Starting with two initial centroids in one cluster of each pair of clusters
71
10 Clusters Example
Starting with some pairs of clusters having three initial centroids, while other have only one.
72
10 Clusters Example
Starting with some pairs of clusters having three initial centroids, while other have only one.
73
Solutions to Initial Centroids Problem
Multiple runs
Helps, but probability is not on your side
Take a sample of points and cluster them using a
hierarchical clustering tech to determine initial
centroids
Select more than k initial centroids and then
select among these initial centroids
Select most widely separated
Limitations
The sample is relatively small
K is relatively small compared to the sample size
74
Select the first point at random and then select
the next point which is farthest from any of the
initial centroids already selected. (well separated)
But, outliers may be selected.
Expensive to compute the farthest point from the
current set of initial centroids.
Post-processing (in page 78)
Bisecting K-means
Not as susceptible to initialization issues
75
Handling Empty Clusters
76
Outliers
77
Reducing the SSE with Pre-processing
and Post-processing
Pre-processing
Normalize the data
Eliminate outliers
Post-processing
Eliminate small clusters that may represent outliers
Split loose clusters, i.e., clusters with relatively high
SSE
Merge clusters that are close and that have relatively
low SSE
78
Two strategies that decrease the total SSE
Split a cluster: The cluster with the largest SSE is
usually chosen, but we could also split the cluster with
the largest standard deviation for one particular
attribute.
Introduce a new cluster centroid: Often the point that
is farthest from any cluster is chosen. Random
selection is another approach.
Two strategies that decrease the number of
clusters
Disperse a cluster: Remove the centroid that
corresponds to the cluster and reassigning the points
to other clusters.
Merge two clusters: The clusters with the closest
79
centroids are typically chosen.
Updating Centers Incrementally
80
Bisecting K-means
81
Limitations of K-means
82
Limitations of K-means: Differing Sizes
83
Limitations of K-means: Differing Density
84
Limitations of K-means: Non-globular Shapes
85
Overcoming K-means Limitations
87
Overcoming K-means Limitations
88
Hierarchical Clustering
89
Hierarchical Clustering
90
Strengths of Hierarchical Clustering
91
Hierarchical Clustering
Divisive:
Start with one, all-inclusive cluster
At each step, split a cluster until each cluster contains a point (or
there are k clusters)
93
Starting Situation
p2
p3
p4
p5
.
.
. Proximity Matrix
94
Intermediate Situation
C2
C3
C3
C4
C4
C5
Proximity Matrix
C1
C2 C5
95
Intermediate Situation
We want to merge the two closest clusters (C2 and C5) and
update the proximity matrix. C1 C2 C3 C4 C5
C1
C2
C3
C3
C4
C4
C5
Proximity Matrix
C1
C2 C5
96
After Merging
C1 ?
C2 U C5 ? ? ? ?
C3
C3 ?
C4
C4 ?
Proximity Matrix
C1
C2 U C5
97
How to Define Inter-Cluster Similarity
p1 p2 p3 p4 p5 ...
p1
Similarity?
p2
p3
p4
p5
MIN
.
MAX
.
Group Average .
Proximity Matrix
Distance Between Centroids
Other methods driven by an objective
function
Wards Method uses squared error
98
How to Define Inter-Cluster Similarity
p1 p2 p3 p4 p5 ...
p1
p2
p3
p4
The proximity between the closest two
p5
MIN points that are in different clusters
.
MAX
.
Group Average .
Proximity Matrix
Distance Between Centroids
Other methods driven by an objective
function
Wards Method uses squared error
99
How to Define Inter-Cluster Similarity
p1 p2 p3 p4 p5 ...
p1
p2
p3
p4
p5
MIN Proximity between the farthest two
points in different clusters
.
MAX
.
Group Average .
Proximity Matrix
Distance Between Centroids
Other methods driven by an objective
function
Wards Method uses squared error
100
How to Define Inter-Cluster Similarity
p1 p2 p3 p4 p5 ...
p1
p2
p3
p4
The average pairwise
p5
MIN proximities of all pairs of
points from different
.
MAX clusters
.
Group Average .
Proximity Matrix
Distance Between Centroids
Other methods driven by an objective
function
Wards Method uses squared error
101
How to Define Inter-Cluster Similarity
p1 p2 p3 p4 p5 ...
p1
p2
p3
p4
MIN p5
MAX .
Group Average .
.
Distance Between Centroids Proximity Matrix
Other methods driven by an objective function
Wards Method uses squared error
Like distance between centroids, but it measures
the proximity between two clusters in term of the
increase in the SSE that results from merging the
102
two clusters.
103
Cluster Similarity: MIN or Single Link
104
Hierarchical Clustering: MIN
105
Strength of MIN
106
Limitations of MIN
107
Cluster Similarity: MAX or Complete Linkage
108
Hierarchical Clustering: MAX
109
Strength of MAX
110
Limitations of MAX
111
Cluster Similarity: Group Average
112
Hierarchical Clustering: Group Average
113
Hierarchical Clustering: Group Average
Strengths
Less susceptible to noise and outliers
114
Cluster Similarity: Wards Method
115
116
Hierarchical Clustering: Time and Space requirements
117
Hierarchical Clustering: Problems and Limitations
118
Cluster Validity
119
Cluster Validity
120
Clusters found in Random Data
Random DBSCAN
Points
K-means Complete
Link
121
Different Aspects of Cluster Validation
122
Some Challenges for Numerical Measure
123
Measures of Cluster Validity
Example: SSE
BSS + WSS = constant
m
1 m1 2 3 4 m2 5
K=1 cluster:
K=2 clusters:
126
Internal Measures: SSE
Clusters in more complicated figures arent well separated
Internal Index: Used to measure the goodness of a clustering
structure without respect to external information
SSE
SSE is good for comparing two clusterings or two clusters
(average SSE).
Can also be used to estimate the number of clusters
127
Internal Measures: SSE
128
Unsupervised Cluster Evaluation Using
Cohesion and Separation
129
Graph-Based View of Cohesion and
Separation
The cohesion of a cluster can be defined as the
sum of the weights of the links in the proximity
graph that connect points within the cluster.
The separation between two clusters can be
measured by the sum of the weights of the links
from points in one cluster to points in the other
cluster.
130
cohesion separation
131
Prototype-Based View of Cohesion and
Separation
The cohesion of a cluster can be defined as the sum of the
proximities with respect to the prototype (centroid or
medoid).
The separation between two clusters can be measured by
the proximity of the two cluster prototypes.
132
Both the cluster cohesion measure and
separation measure can be combined together
using the following equation:
Can calculate the Average Silhouette width for all the points in a
cluster.
134
Determining the Correct Number of
Clusters
It is necessary to use some measures to
determine the number of clusters
135
Wilks Lambdan value is the other choice for
determining the number of clusters.
ART2 ART2
Wilks Wilks
parameters Number of parameter Number of
Lambda Difference Lambda Difference
vigilance clusters vigilance clusters
Value Value
value value
0.96 80 0.49511 0.0486 0.9491 59 0.5899 0.0160
137
Supervised Measures of Cluster Validity
Classification-orientated measure
Similarity-orientated measure
(See next page)
138
Classification-Oriented Measure of
Cluster Validity
Measure the degree to which predicted class
labels correspond to actual class labels.
Entropy
Purity
Precision
Recall
F-measure (Combination of Precision and Recall)
139
External Measures of Cluster Validity: Entropy and Purity
140
Similarity-Oriented Measure of Cluster
Validity
Compare two matrices:
The ideal cluster similarity matrix which has a 1 in the
ijth entry if two objects, i and j, are in the same cluster
and 0, otherwise.
The ideal class similarity matrix which has a 1 in the
ijth entry if two objects, i and j, belong to the same
class, a 0 otherwise.
Point
Point
p1 p2 p3 p4 p5 p1 p2 p3 p4 p5
P1 1 1 1 0 0 P1 1 1 0 0 0
Correlation
P2 1 1 1 0 0 P2 1 1 0 0 0
=0.359
P3 1 1 1 0 0 P3 0 0 1 1 1
P4 0 0 0 1 1 P4 0 0 1 1 1
p5 0 0 0 1 1 p5 0 0 1 1 1
Clustered results 141
Actual results
Final Comment on Cluster Validity
142
THE END!
143