Skip to content
doubtly

1 answer

With initial means 2 and 4, K-Means gives K1 = {2, 3, 4, 10, 11, 12} (mean 7) and K2 = {20, 23, 25, 30, 56} (mean 30.8).

K-Means algorithm

  1. Choose the number of clusters \(k\) and initial means (here the first two values, 2 and 4).
  2. Assign each item to the cluster whose mean is nearest (\(|x - m|\)).
  3. Recalculate each mean from its members.
  4. Repeat until the clusters (means) do not change.

Solution for {2, 4, 10, 12, 3, 20, 30, 11, 25, 56, 23}, \(k = 2\):

Iter.MeansK1K2New means
12, 4{2, 3}{4, 10, 11, 12, 20, 23, 25, 30, 56}2.5, 21.22
22.5, 21.22{2, 3, 4, 10, 11}{12, 20, 23, 25, 30, 56}6, 27.67
36, 27.67{2, 3, 4, 10, 11, 12}{20, 23, 25, 30, 56}7, 30.8
47, 30.8{2, 3, 4, 10, 11, 12}{20, 23, 25, 30, 56}no change

Working of the means: iteration 1, K2 sum \(= 191\), so mean \(= 191/9 = 21.22\); iteration 2, K1 \(= 30/5 = 6\), K2 \(= 166/6 = 27.67\); iteration 3, K1 \(= 42/6 = 7\), K2 \(= 154/5 = 30.8\).

Close cases: in iteration 1, item 3 is equally far from 2 and 4 and is placed in K1; in iteration 2, item 12 is 9.5 from 2.5 and 9.22 from 21.22, so it is in K2, but in iteration 3 it is 6 from 6 and 15.67 from 27.67, so it moves to K1.

Final clusters: K1 = {2, 3, 4, 10, 11, 12}, mean 7; K2 = {20, 23, 25, 30, 56}, mean 30.8. (A different choice of initial means can give a different final result, which is a known limitation of K-Means.)

Doubtly AI · 24 Oct 2026 AI-verified · Oct 2026 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.