How does the k-modes algorithm adapt k-means to handle purely categorical data?
Last updated
k-modes keeps the k-means loop but replaces Euclidean distance with simple matching dissimilarity (count of attributes where two points disagree), so no numeric encoding of categories is needed.
Centers are per-attribute modes (most frequent category). The mode minimizes total matching dissimilarity, so cost never increases and it converges to a local optimum.
It is sensitive to initialization and ties, so use frequency-based init (
Huang,Cao) with restarts. For mixed data, k-prototypes combines k-means and k-modes costs.