CSC420 · 2081 · 5 marks
Using k-means++ algorithm and Euclidean distance, find the initial 3 cluster centroids from A1 = (3, 11), A2 = (3, 6), A3 = (9, 5), A4 = (6, 9), A6 = (7, 5), A7 = (2, 3), A8 = (5, 10). Choose (3, 11) as one of the initial centroids.
Using k-means++ algorithm and Euclidean distance, find the initial 3 cluster centroids from A1 = (3, 11), A2 = (3, 6), A3 = (9, 5), A4 = (6, 9), A6 = (7, 5), A7 = (2, 3), A8 = (5, 10). Choose (3, 11) as one of the initial centroids. [5]
K-Means++ Initial Centroid Selection
Given
Data points:
| Point | Coordinates |
|---|---|
| A1 | (3, 11) |
| A2 | (3, 6) |
| A3 | (9, 5) |
| A4 | (6, 9) |
| A6 | (7, 5) |
| A7 | (2, 3) |
| A8 | (5, 10) |
Number of clusters: $k = 3$ First centroid (given): $C_1 = (3, 11)$
Solution
K-Means++ Rule
- First centroid is fixed as $C_1 = (3,11)$.
- For each point compute $D^2$ = squared Euclidean distance to the nearest chosen centroid.
- Choose the point with the largest $D^2$ (highest selection probability) as the next centroid.
Selecting $C_2$: distances to $C_1 = (3,11)$
$$D^2 = (x-3)^2 + (y-11)^2$$
| Point | Calculation | $D^2$ |
|---|---|---|
| A2 (3,6) | $0 + 25$ | 25 |
| A3 (9,5) | $36 + 36$ | 72 |
| A4 (6,9) | $9 + 4$ | 13 |
| A6 (7,5) | $16 + 36$ | 52 |
| A7 (2,3) | $1 + 64$ | 65 |
| A8 (5,10) | $4 + 1$ | 5 |
Total $= 25+72+13+52+65+5 = 232$
Probability $= D^2 / 232$:
| Point | P |
|---|---|
| A2 | 0.108 |
| A3 | 0.310 |
| A6 | 0.224 |
| A7 | 0.280 |
| A4 | 0.056 |
| A8 | 0.022 |
Largest $D^2$ is A3 (72).
$$\boxed{C_2 = (9, 5)}$$
Selecting $C_3$: nearest distance to ${C_1, C_2}$
$D^2(C_2)$ with $C_2 = (9,5)$:
| Point | $D^2(C_1)$ | $D^2(C_2)$ | $\min$ |
|---|---|---|---|
| A2 (3,6) | 25 | $36+1=37$ | 25 |
| A4 (6,9) | 13 | $9+16=25$ | 13 |
| A6 (7,5) | 52 | $4+0=4$ | 4 |
| A7 (2,3) | 65 | $49+4=53$ | 53 |
| A8 (5,10) | 5 | $16+25=41$ | 5 |
Total $= 25+13+4+53+5 = 100$
Probability $= \min D^2 / 100$:
| Point | P |
|---|---|
| A2 | 0.25 |
| A4 | 0.13 |
| A6 | 0.04 |
| A7 | 0.53 |
| A8 | 0.05 |
Largest $\min D^2$ is A7 (53).
$$\boxed{C_3 = (2, 3)}$$
Final Result
The 3 initial centroids chosen by K-Means++ are:
| Centroid | Coordinates |
|---|---|
| $C_1$ | (3, 11) |
| $C_2$ | (9, 5) |
| $C_3$ | (2, 3) |
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.