Why is Euclidean distance over one-hot encoded categories problematic for k-means?

Last updated 11 November 2026

  • One-hot encoding puts every pair of distinct categories at the same distance (√2), so there is no graded similarity and distances collapse into ties.

  • k-means centroids become fractional proportions (e.g. [0.4, 0.6, 0]) with no categorical meaning, and binary columns get arbitrary weight versus numeric ones.

  • Better options: k-modes for categorical data, k-prototypes for mixed data, Gower distance with k-medoids or hierarchical clustering, or learned embeddings.

  • https://medium.com/@tariq.tq/one-hot-encoding-and-the-impact-of-increased-dimensionality-daf1bba543e2
  • https://github.com/scikit-learn/scikit-learn/issues/32115
  • https://metricgate.com/blogs/common-mistakes-in-cluster-analysis/
All Clustering interview questions