Unsupervised Learning
Dr. Dinesh Kumar Vishwakarma
Professor,
Department of Information Technological University, Delhi-110042
Outline
Dinesh K. Vishwakarma
2
Supervised vs. unsupervised learning
Dinesh K. Vishwakarma
3
Clustering
Dinesh K. Vishwakarma
4
What is Clusters?
Dinesh K. Vishwakarma
5
What is clustering for?
Dinesh K. Vishwakarma
6
What is clustering for? (cont…)
Dinesh K. Vishwakarma
7
What is clustering for? (cont…)
Dinesh K. Vishwakarma
8
What do we need for Clustering?
Dinesh K. Vishwakarma
9
Large d, & small s
small d, & large s
Good
Bad
Distance Measurement
Dinesh K. Vishwakarma
10
Clustering E.g.
Dinesh K. Vishwakarma
11
C3 {X2, X4, X9}
C1 {X7,X8}
C2 { X1, X3, X5, X6}
Aspects of Clustering
Dinesh K. Vishwakarma
12
Hierarchical vs Partitional Clustering
Dinesh K. Vishwakarma
13
K-means clustering
Dinesh K. Vishwakarma
14
K-means algorithm
Dinesh K. Vishwakarma
15
K-means algorithm – (cont …)
Dinesh K. Vishwakarma
16
Stopping/convergence criterion
Dinesh K. Vishwakarma
17
(1)
An example
Dinesh K. Vishwakarma
18
(A) Random selection of k centres
Iteration 1 (B) Cluster assignment
(C) Re-compute centroids
Iteration 2 (D) Cluster assignment
(E) Re-compute centroids
Iteration 3 (F) Cluster assignment
Example
Dinesh K. Vishwakarma
19
Example…
Dinesh K. Vishwakarma
20
Example…
Dinesh K. Vishwakarma
21
Example of K-Mean Clustering
Dinesh K. Vishwakarma
22
Height (X) | Weight (Y) |
185 | 72 |
170 | 56 |
168 | 60 |
179 | 68 |
182 | 72 |
188 | 77 |
180 | 71 |
180 | 70 |
183 | 84 |
180 | 88 |
180 | 67 |
177 | 76 |
K1={185, 72}
K2={170, 56}
Hence, data point 3 belongs to K2
Strengths of k-means
where n is the number of data points,
k is the number of clusters, and
t is the number of iterations.
Dinesh K. Vishwakarma
23
Weaknesses of k-means
Dinesh K. Vishwakarma
24
Weaknesses of k-means…
Dinesh K. Vishwakarma
25
(A) Undesirable cluster
(B) Ideal cluster
Outlier
Outlier
Weaknesses of k-means...
Dinesh K. Vishwakarma
26
Weaknesses of k-means (cont …)
Dinesh K. Vishwakarma
27
Weaknesses of k-means (cont …)
Dinesh K. Vishwakarma
28
Two natural clusters
K-mean clusters
K-means summary
Dinesh K. Vishwakarma
29
Outlines
Dinesh K. Vishwakarma
30
Common ways to represent clusters
Dinesh K. Vishwakarma
31
Using classification model
Dinesh K. Vishwakarma
32
Use frequent values to represent cluster
Dinesh K. Vishwakarma
33
Clusters of arbitrary shapes
Dinesh K. Vishwakarma
34
Outlines
Dinesh K. Vishwakarma
35
Hierarchical Clustering
Dinesh K. Vishwakarma
36
Hierarchical Clustering
Why Hierarchical Clustering?
Dinesh K. Vishwakarma
37
Why Hierarchical Clustering? E.g.
Dinesh K. Vishwakarma
38
Types of hierarchical clustering
Dinesh K. Vishwakarma
39
Agglomerative approach
Dinesh K. Vishwakarma
40
b
d
c
e
a
a b
d e
c d e
a b c d e
Step 0
Step 1
Step 2
Step 3
Step 4
bottom-up
Initialization:
Each object is a cluster
Iteration:
Merge two clusters which are
most similar to each other;
Until all objects are merged
into a single cluster
Divisive Approaches
Dinesh K. Vishwakarma
41
41
b
d
c
e
a
a b
d e
c d e
a b c d e
Step 4
Step 3
Step 2
Step 1
Step 0
Top-down
Initialization:
All objects stay in one cluster
Iteration:
Select a cluster and split it into
two sub clusters
Until each leaf cluster contains
only one object
Dendrogram
Dinesh K. Vishwakarma
42
9
6
4
3
2
No. of clusters
Agglomerative Algorithms
Dinesh K. Vishwakarma
43
How to Merge Clusters?
Dinesh K. Vishwakarma
44
Distance?
Hint: Distance between clusters is usually defined on the basis of distance between objects.
How to Define Inter-Cluster Distance
Dinesh K. Vishwakarma
45
The distance between two clusters is represented by the distance of the closest pair of data objects belonging to different clusters.
How to Define Inter-Cluster Distance
Dinesh K. Vishwakarma
46
The distance between two clusters is represented by the distance of the farthest pair of data objects belonging to different clusters.
How to Define Inter-Cluster Distance
Dinesh K. Vishwakarma
47
The distance between two clusters is represented by the average distance of all pairs of data objects belonging to different clusters.
How to Define Inter-Cluster Distance
Dinesh K. Vishwakarma
48
×
×
mi,mj are the means of Ci, Cj,
The distance between two clusters is represented by the distance between the means of the cluters.
E.g. Agglomerative Hierarchical Clustering
Dinesh K. Vishwakarma
49
1
2
3
4
5
6
1
3
4
5
2
6
1
2
3
4
5
6
1
3
2
4
5
6
Result of the Single-Link algorithm
Result of the complete-Link algorithm
Hierarchical Clustering: Comparison
Dinesh K. Vishwakarma
Average-link
Centroid distance
1
2
3
4
5
6
1
2
5
3
4
Single-link
Complete-link
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
Comparison of Dendrograms
Dinesh K. Vishwakarma
51
1 2 5 3 6 4
1 2 5 3 6 4
1 2 5 3 6 4
2 5 3 6 4 1
Average-link
Centroid distance
Single-link
Complete-link
E.G. of Clustering
Dinesh K. Vishwakarma
52
E.G. of Clustering using Single Link
Dinesh K. Vishwakarma
53
E.G. of Clustering using Single Link
Dinesh K. Vishwakarma
54
E.G. of Clustering using Single Link
Dinesh K. Vishwakarma
55
E.G. of Clustering using Single Link
Dinesh K. Vishwakarma
56
Agglomerative clustering
It is more popular then divisive methods.
Dinesh K. Vishwakarma
57
Agglomerative clustering algorithm
Dinesh K. Vishwakarma
58
The complexity
Dinesh K. Vishwakarma
59
Outlines
Dinesh K. Vishwakarma
60
How to choose a clustering algorithm
Dinesh K. Vishwakarma
61
Choose a clustering algorithm (cont …)
Dinesh K. Vishwakarma
62
Outlines
Dinesh K. Vishwakarma
63
Cluster Evaluation: hard problem
Dinesh K. Vishwakarma
64
Cluster evaluation: ground truth
Dinesh K. Vishwakarma
65
Evaluation measures: Entropy
Dinesh K. Vishwakarma
66
Evaluation measures: purity
Dinesh K. Vishwakarma
67
An example
Dinesh K. Vishwakarma
68
A remark about ground truth evaluation
Dinesh K. Vishwakarma
69
Evaluation based on internal information
Dinesh K. Vishwakarma
70
Indirect evaluation
Dinesh K. Vishwakarma
71
An example
Dinesh K. Vishwakarma
72
Summary
Dinesh K. Vishwakarma
73