2. 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.
3. 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)
4. Initialization
• Why is it important? What does it affect?
– Clustering result local optimum!
– Total iteration / complexity
14. 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.
38. 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.
39. 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.