Skip to main content

K-means on eight points into 3 clusters

Short answer

K-means with Euclidean distance, initial centroids A1(2,10), A4(5,8), A7(1,2). After 4 iterations: Cluster 1 = {A1,A4,A8} centroid (3.67,9); Cluster 2 = {A3,A5,A6} centroid (7,4.33); Cluster 3 = {A2,A7} centroid (1.5,3.5). Algorithm converged with no further assignment changes.

Use K-means algorithm and Euclidean distance to cluster the following 8 examples into 3 clusters: A1=(2, 10), A2=(2, 5), A3=(8, 4), A4=(5, 8), A5=(7, 5), A6=(6, 4), A7=(1, 2), A8=(4, 9)

K-means with Euclidean distance d = √[(x₂ − x₁)² + (y₂ − y₁)²], k = 3.

Assumption: the initial centroids are A1 = (2, 10), A4 = (5, 8) and A7 = (1, 2) (the choice is not given in the question).

Iteration 1 (C1 = (2, 10), C2 = (5, 8), C3 = (1, 2))

Pointd to C1d to C2d to C3Cluster
A1 (2, 10)0.003.618.06C1
A2 (2, 5)5.004.243.16C3
A3 (8, 4)8.495.007.28C2
A4 (5, 8)3.610.007.21C2
A5 (7, 5)7.073.616.71C2
A6 (6, 4)7.214.125.39C2
A7 (1, 2)8.067.210.00C3
A8 (4, 9)2.241.417.62C2

C1 = {A1}, C2 = {A3, A4, A5, A6, A8}, C3 = {A2, A7}. New centroids: C1 = (2, 10); C2 = ((8 + 5 + 7 + 6 + 4)/5, (4 + 8 + 5 + 4 + 9)/5) = (6, 6); C3 = ((2 + 1)/2, (5 + 2)/2) = (1.5, 3.5).

Iteration 2 (C1 = (2, 10), C2 = (6, 6), C3 = (1.5, 3.5))

Pointd to C1d to C2d to C3Cluster
A10.005.666.52C1
A25.004.121.58C3
A38.492.836.52C2
A43.612.245.70C2
A57.071.415.70C2
A67.212.004.53C2
A78.066.401.58C3
A82.243.616.04C1

C1 = {A1, A8}, C2 = {A3, A4, A5, A6}, C3 = {A2, A7}. New centroids: C1 = (3, 9.5); C2 = (6.5, 5.25); C3 = (1.5, 3.5).

Iteration 3 (C1 = (3, 9.5), C2 = (6.5, 5.25), C3 = (1.5, 3.5))

Pointd to C1d to C2d to C3Cluster
A11.126.546.52C1
A24.614.511.58C3
A37.431.956.52C2
A42.503.135.70C1
A56.020.565.70C2
A66.261.354.53C2
A77.766.391.58C3
A81.124.516.04C1

C1 = {A1, A4, A8}, C2 = {A3, A5, A6}, C3 = {A2, A7}. New centroids: C1 = (3.67, 9); C2 = (7, 4.33); C3 = (1.5, 3.5).

Iteration 4: with these centroids every point stays in the same cluster (e.g. A4: 1.67 to C1, 4.18 to C2; A2: 1.58 to C3), so the algorithm has converged.

Answer: Cluster 1 = {A1, A4, A8}, centroid (3.67, 9); Cluster 2 = {A3, A5, A6}, centroid (7, 4.33); Cluster 3 = {A2, A7}, centroid (1.5, 3.5).

✓ Answer checked by Claude Opus 5.5 (high effort)

All Data Mining chapter 5 questions →