Why is k-medoids (PAM) more robust to outliers than k-means, and what does it cost you?
Unsupervised learning, k-medoids
Level L1 Beginner. Length Short. Nature Th Theoretical.
What's being asked
Whether you see that the mean is pulled by extreme values, while a medoid must be an actual data point, and that this robustness has a computational price.
Key idea
k-means centres are means, which minimise squared distance and move towards outliers. k-medoids centres are medoids (actual data points) chosen to minimise the sum of dissimilarities , which is not squared, so one far point cannot drag a centre away.
Steps
- State what each method uses as a centre: k-means uses the mean of the cluster, k-medoids uses the cluster member with the smallest total dissimilarity to the others.
- Show the outlier effect with a tiny example: for the mean is , which lies in no dense region, while the medoid is .
- Explain why. The mean minimises squared error, so a point at distance contributes . The medoid minimises the sum of distances, so the same point contributes only .
- Add the side benefits: k-medoids needs only a dissimilarity matrix, so it works with any distance (even for non-numeric data), and the centres are interpretable real examples.
- State the cost. One PAM swap pass tries every (medoid, non-medoid) pair and recomputes the cost, which is about per iteration, against for one k-means iteration. It does not scale to large without sampling (CLARA, CLARANS).
Common mistakes
- Saying k-medoids is "the same as k-means but with the median". The medoid is a data point chosen under a general distance, and in 2-D it is not the coordinate-wise median.
- Claiming k-medoids is always better. With clean, roughly spherical data, k-means is faster and as accurate.
- Forgetting that the cost is the sum of distances (not squared distances).
How long your answer should be
4–6 sentences with the example.
Last checked on 4 December 2026.
Read this
Previous in Unsupervised learning: How do you choose the number of clusters for k-means, and why can't you just pick the that minimises the k-means objective?
Next in Unsupervised learning: What is the difference between AGNES and DIANA in hierarchical clustering, and which is cheaper to run?