2
$\begingroup$

I have a survey where each question is related to a different 'shopper' type (there are 5 types so 5 questions). Each question is either binary (True/False) or scale based.

IE:

1. Do you like to shop at our physical location store ? (True/False)

2. Do our discounts entice you to shop more? a. no b. maybe c. yes

For each response I convert the answer choice to a numerical value. So True becomes 1, answer choice 2C becomes 3 etc.

At this point, I am clueless as too what clustering algorithm to use so I can create clusters for each of the 'shopper' types and measures each individual survey response submitted to determine a single cluster closet to the responses given and label the response as that cluster.

IE. This individual that submitted the survey response is 'location conscience shopper type'

Open to any new method of analysis not just clustering

$\endgroup$

2 Answers 2

3
$\begingroup$

Since they are categorical variables, I would cluster them using the k-medoids clustering method. Before applying this method, one-hot encode all the predictors.

See a tutorial here: https://towardsdatascience.com/k-medoids-clustering-on-iris-data-set-1931bf781e05

Sklearn has an implementation: https://scikit-learn-extra.readthedocs.io/en/latest/generated/sklearn_extra.cluster.KMedoids.html

$\endgroup$
1
  • $\begingroup$ thank you for the response, this is exactly what I was looking for. Can you please tell me why we need to one-hot encode all predictors? And can you give me a small example of one-hot encoding with the survey example to make sure I am understanding correctly $\endgroup$ Jan 6, 2020 at 20:00
1
$\begingroup$

you can have a look at these suggestions Clustering categorical data

i havent tried clustering on pure categorical dataset yet however have tried on text data where at the end you end up creating a sparse matrix and have had success there with hierarchical clustering using Wards' method

https://towardsdatascience.com/understanding-the-concept-of-hierarchical-clustering-technique-c6e8243758ec

Although I havent used this one before - but try k-mediods where mediods are identified instead of centroids using means https://www.geeksforgeeks.org/ml-k-medoids-clustering-with-example/

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.