Fitting the final K-Means model with K=5 and analysing cluster assignments.
Place K centroids randomly (k-means++ places them smart — far apart) to seed the algorithm.
Each customer is assigned to the nearest centroid using Euclidean distance.
Recompute each centroid as the mean of all customers in that cluster.
Steps 2–3 are repeated until centroids stop moving (convergence) or max_iter is reached.
The final WCSS and Silhouette Score confirm cluster quality.
| Cluster | Income (z) | Spending (z) |
|---|---|---|
| C0 | -0.201 | -0.026 |
| C1 | 0.992 | 1.240 |
| C2 | -1.330 | 1.132 |
| C3 | 1.055 | -1.284 |
| C4 | -1.308 | -1.137 |
Silhouette Score measures cluster separation and compactness on a scale from -1 to +1. Higher values indicate better-defined segments.
| k | Silhouette Score | Quality |
|---|---|---|
| 2 | 0.3213 | Good |
| 3 | 0.4666 | Excellent |
| 4 | 0.4939 | Excellent |
| 5 | 0.5547 | Excellent |
| 6 | 0.5399 | Excellent |
| 7 | 0.5281 | Excellent |
| 8 | 0.4552 | Excellent |
| 9 | 0.4571 | Excellent |
| 10 | 0.4432 | Excellent |
| Cluster | Customers | Share % | Avg Age | Avg Income (k$) | Avg Spending | Males | Females |
|---|---|---|---|---|---|---|---|
| Cluster 0 | 81 |
40.5%
|
42.7 | 55.3 | 49.5 | 33 | 48 |
| Cluster 1 | 39 |
19.5%
|
32.7 | 86.5 | 82.1 | 18 | 21 |
| Cluster 2 | 22 |
11.0%
|
25.3 | 25.7 | 79.4 | 9 | 13 |
| Cluster 3 | 35 |
17.5%
|
41.1 | 88.2 | 17.1 | 19 | 16 |
| Cluster 4 | 23 |
11.5%
|
45.2 | 26.3 | 20.9 | 9 | 14 |