- Year not given
K-means on 1-D data, K=2 and K=3
Short answer
For K=2 with initial centroids 2 and 24: Cluster 1 = {1,2,5,6,7,9,11,13} centroid 6.75; Cluster 2 = {21,24,26,26,32,35,36,41,43,44,46,48} centroid 35.17. For K=3 with initial centroids 2,24,46: Cluster 1 = {1,2,5,6,7,9,11,13} centroid 6.75; Cluster 2 = {21,24,26,26,32,35} centroid 27.33; Cluster 3 = {36,41,43,44,46,48} centroid 43.0.
Identify the cluster of the following instances using K-Means clustering algorithm (Take K=2 and K=3). X = {2, 24, 21, 5, 6, 41, 35, 36, 9, 26, 44, 7, 46, 26, 11, 1, 32, 43, 48, 13}
Data (sorted): 1, 2, 5, 6, 7, 9, 11, 13, 21, 24, 26, 26, 32, 35, 36, 41, 43, 44, 46, 48 (n = 20). For one attribute the distance is d = |x − c|.
Assumptions: the initial centroids are chosen from the data: for K = 2: 2 and 24; for K = 3: 2, 24 and 46. A tie goes to the lower-numbered cluster.
K = 2
Iteration 1 (C1 = 2, C2 = 24)
| Value | d to C1 | d to C2 | Cluster | Value | d to C1 | d to C2 | Cluster |
|---|---|---|---|---|---|---|---|
| 1 | 1 | 23 | C1 | 26 | 24 | 2 | C2 |
| 2 | 0 | 22 | C1 | 26 | 24 | 2 | C2 |
| 5 | 3 | 19 | C1 | 32 | 30 | 8 | C2 |
| 6 | 4 | 18 | C1 | 35 | 33 | 11 | C2 |
| 7 | 5 | 17 | C1 | 36 | 34 | 12 | C2 |
| 9 | 7 | 15 | C1 | 41 | 39 | 17 | C2 |
| 11 | 9 | 13 | C1 | 43 | 41 | 19 | C2 |
| 13 | 11 | 11 | C1 (tie) | 44 | 42 | 20 | C2 |
| 21 | 19 | 3 | C2 | 46 | 44 | 22 | C2 |
| 24 | 22 | 0 | C2 | 48 | 46 | 24 | C2 |
C1 = {1, 2, 5, 6, 7, 9, 11, 13}, new centroid = 54/8 = 6.75. C2 = {21, 24, 26, 26, 32, 35, 36, 41, 43, 44, 46, 48}, new centroid = 422/12 = 35.17.
Iteration 2 (C1 = 6.75, C2 = 35.17): the points 1 to 13 are nearer to 6.75 (e.g. 13: 6.25 vs 22.17); 21 is 14.25 from C1 and 14.17 from C2, so it stays in C2; all others are nearer to C2. No object changes cluster, so the algorithm stops.
Answer (K = 2): Cluster 1 = {1, 2, 5, 6, 7, 9, 11, 13}, centroid 6.75; Cluster 2 = {21, 24, 26, 26, 32, 35, 36, 41, 43, 44, 46, 48}, centroid 35.17.
K = 3
Iteration 1 (C1 = 2, C2 = 24, C3 = 46): each value goes to the nearest centroid:
- C1 = {1, 2, 5, 6, 7, 9, 11, 13} (13 is 11 from both 2 and 24; tie to C1)
- C2 = {21, 24, 26, 26, 32, 35} (35 is 11 from 24 and 11 from 46; tie to C2)
- C3 = {36, 41, 43, 44, 46, 48}
New centroids: C1 = 54/8 = 6.75, C2 = 164/6 = 27.33, C3 = 258/6 = 43.0.
Iteration 2 (6.75, 27.33, 43.0)
| Border values | d to C1 | d to C2 | d to C3 | Cluster |
|---|---|---|---|---|
| 13 | 6.25 | 14.33 | 30.0 | C1 |
| 21 | 14.25 | 6.33 | 22.0 | C2 |
| 35 | 28.25 | 7.67 | 8.0 | C2 |
| 36 | 29.25 | 8.67 | 7.0 | C3 |
No change in assignment, so the algorithm has converged.
Answer (K = 3): Cluster 1 = {1, 2, 5, 6, 7, 9, 11, 13}, centroid 6.75; Cluster 2 = {21, 24, 26, 26, 32, 35}, centroid 27.33; Cluster 3 = {36, 41, 43, 44, 46, 48}, centroid 43.0.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- K-means on six 2-D instances (K=2) · Data Mining, chapter 5
- Need of clustering; hierarchical vs partitioning; K-means · Data Mining, chapter 5
- Cluster analysis; K-means on height/width · Data Mining, chapter 5
- K-means on six 2-D instances (B65) · Data Mining, chapter 5
- Cluster analysis applications; K-means · Data Mining, chapter 5
- Short note: K-means clustering · Data Mining, chapter 5
- K-means on eight points into 3 clusters · Data Mining, chapter 5
- Two groups: best, consistent, SE of difference · Probability and Statistics, chapter 1
- Gumbel design flood, 43 years data, 85% reliability · Engineering Hydrology, chapter 6 · asked 2×
- B-tree from 78, 21, 14, 11, 97, 85, 74, 63 · Data Structure and Algorithm, chapter 6 · asked 2×
- 22 pairs: means, consistency, correlation · Probability and Statistics, chapter 5