It is well established that k-means works best, and is designed for, continuous variables. I am considering a clustering problem where I have data like this:

total spend / $ number of items in basket hour of purchase (out of 24 hours: 8 = 8am; 20 = 8pm)
20.00 6 13
23.34 7 7

This data is all mathematically discrete and I am considering two approaches to enable me to include this in my data along with the rest of my continuous data :

(a) Just pretend the data is continuous (is it actually a problem if the centroid of a cluster sits at 6.23 items in a basket and the hour of purchase is 13.6?)

(b) Categorise them (like the example below) and use k-modes clustering:

number of items in basket - normal number of items in basket - categorised
2 small
9 medium
19 large

My concern with approach (b) is that I loose the ordinality of the data - k-modes won't differentiate the greater size difference between small and large vs small and medium vs approach (a), where the difference between 3 and 20 vs 7 and 9 is clear for k-means.

Based on this data (total spend, hour of purchase etc.) is one of these approaches more likely to work better for k-means than the other? I know there is never one right answer here and it's very situational however any guidance and thoughts about the approach to take here would be appreciated.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.