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 ∑id(xi,mc(i)), which is not squared, so one far point cannot drag a centre away.

Steps

  1. 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.
  2. Show the outlier effect with a tiny example: for {10,11,25} the mean is 15.33, which lies in no dense region, while the medoid is 11.
  3. Explain why. The mean minimises squared error, so a point at distance r contributes r2. The medoid minimises the sum of distances, so the same point contributes only r.
  4. 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.
  5. State the cost. One PAM swap pass tries every (medoid, non-medoid) pair and recomputes the cost, which is about O(k(n−k)2) per iteration, against O(nkd) for one k-means iteration. It does not scale to large n without sampling (CLARA, CLARANS).

Common mistakes

How long your answer should be

4–6 sentences with the {10,11,25} example.

Last checked on 4 December 2026.

Read this

Previous in Unsupervised learning: How do you choose the number of clusters k for k-means, and why can't you just pick the k 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?