EasyDeepLearn

You run k-means on customer data with age, income and number of purchases. What breaks?

easy

Answer

  • The scales.
  • Income in dollars ranges over tens of thousands while age spans a few decades, so squared Euclidean distance is essentially income distance and the other two variables contribute nothing.
  • Standardize or use robust scaling first, and understand that scaling is a modelling decision, because it declares each feature equally important.
  • Skew is the second problem: income is heavy-tailed, so a handful of high earners dominate the centroids, and a log transform usually helps.
  • If some variables are categorical, k-means is the wrong algorithm entirely, since a mean of a category is meaningless; use k-prototypes or a Gower distance with a method that accepts arbitrary distances.
Check yourself — multiple choice
  • Nothing, k-means is scale invariant
  • Unscaled Euclidean distance is dominated by income, skew lets outliers drive centroids, and categorical variables have no meaningful mean
  • Only k matters
  • It fails because of too few features

K-means needs comparable, roughly symmetric, numeric scales; scaling is a modelling choice.

#clustering#similarity

Practise Unsupervised Learning

214 interview questions in this topic.

Related questions