kmeans initialization
DESCRIPTION
TRANSCRIPT
K-Means Clustering Problem
Ahmad Sabiq
Febri Maspiyanti
Indah Kuntum Khairina
Wiwin Farhania
Yonatan
What is k-means?
• To partition n objects into k clusters, based on
attributes.
– Objects of the same cluster are close � their
attributes are related to each other.
– Objects of different clusters are far apart � their
attributes are very dissimilar.
Algorithm
• Input: n objects, k (integer k ≤ n)
• Output: k clusters
• Steps: 1. Select k initial centroids.
2. Calculate the distance between each object and each centroid.
3. Assign each object to the cluster with the nearest centroid.
4. Recalculate each centroid.
5. If the centroids don’t change, stop (convergence).
Otherwise, back to step 2.
• Complexity: O(k.n.d.total_iteration)
Initialization
• Why is it important? What does it affect?
– Clustering result � local optimum!
– Total iteration / complexity
Good Initialization
3 clusters with 2 iterations…
Bad Initialization
3 clusters with 4 iterations…
Initialization Methods
1. Random
2. Forgy
3. Macqueen
4. Kaufman
Random
• Algorithm:
1. Assigns each object to a random cluster.
2. Computes the initial centroid of each cluster.
Random
Random
Random
0
1
2
3
4
5
6
7
8
9
0 5 10 15 20 25 30 35
Forgy
• Algorithm:
1. Chooses k objects at random and uses them as the initial
centroids.
Forgy
0
1
2
3
4
5
6
7
8
9
0 5 10 15 20 25 30 35
MacQueen
• Algorithm:
1. Chooses k objects at random and uses them as the initial
centroids.
2. Assign each object to the cluster with the nearest
centroid.
3. After each assignment, recalculate the centroid.
MacQueen
0
1
2
3
4
5
6
7
8
9
0 5 10 15 20 25 30 35
MacQueen
MacQueen
MacQueen
MacQueen
MacQueen
MacQueen
MacQueen
MacQueen
MacQueen
Kaufman
Kaufman
Kaufman
Kaufman
Kaufman
Kaufman
Kaufman
Kaufman
Kaufman
d = 24,33
D = 15,52
C = 0
Kaufman
C = 0
C = 0
C = 0
C = 0
C = 0
Kaufman
C = 0
C = 0
C = 0
C = 0
C = 0
∑C1 = 2,74
Kaufman
∑C1 = 2,74
∑C2 = 12,,21
∑C3 = 12,36
∑C3 = 8,38
∑C5 = 52,55
∑C6 = 55,88
∑C7 = 53,77
∑C8 = 51,16
∑C9 = 42,69
Kaufman
∑C1 = 2,74
∑C2 = 12,,21
∑C3 = 12,36
∑C3 = 8,38
∑C5 = 52,55
∑C6 = 55,88
∑C7 = 53,77
∑C8 = 51,16
∑C9 = 42,69
Reference
1. J.M. Peña, J.A. Lozano, and P. Larrañaga. An Empirical Comparison of Four Initialization Methods for the K-Means Algorithm. Pattern Recognition Letters, vol. 20, pp. 1027–1040. 1999.
2. J.R. Cano, O. Cordón, F. Herrera, and L. Sánchez. A Greedy Randomized Adaptive Search Procedure Applied to the Clustering Problem as an Initialization Process Using K-Means as a Local Search Procedure. Journal of Intelligent and Fuzzy Systems, vol. 12, pp. 235 – 242. 2002.
3. L. Kaufman and P.J. Rousseeuw. Finding Groups in Data: An Introduction to Cluster Analysis. Wiley. 1990.
Questions
1. Kenapa inisialisasi penting pada k-means?
2. Metode inisialisasi apa yang memiliki greedy
choice property?
3. Jelaskan kompleksitas O(nkd) pada metode
Random.