Why is Euclidean distance over one-hot encoded categories problematic for k-means?
Last updated
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.