I have a dataset grouped by customer level, and the rows are sum_mexico, sum_uk, ... etc to indicate if the customer has spent money at stores in those countries..similarily counts for these as well. I end up with 200 columns.

I would like to cluster this data to observe the spending habits and see if i can group them by these features. I'm unsure what clustering method would be best but i would like to provide meaningful results to business.

I've read about using PCA then k-means. E.G. you can carry out K-means on your Principcal componenets. What i don't understand is how i can then interpret the results. e.g. say i have the below situation from https://365datascience.com/tutorials/python-tutorials/pca-k-means/:

enter image description here

i can visually see 4 clusters, but how can i get the characteristics of each cluster.. What can i say about cluster 1 for example, are they charactertized by high spend in mexico ? (assuming i got these results myself using my own data and steps from link!) My end goal is to understand what charcterizes each cluster e.g. it may be that certain customer IDS have high spends in spain and wine etc.


1 Answer 1


PCA removes the connection with the original features,so the interpretation of the visualisations in the principle component space is therefore not very meaningful.

E.g. cluster A has higher values of PC1, where cluster B has higher values of PC2.

If you can clearly see that PC1 is only representative of Feature X, then fine, but this isn't often the case.

Instead use PCA to discover which features best represent the data, and use this to remove unnecessary (unrepresentative) features so that you can visualise the original data using its most important original features. And therefore describe the clusters with meaningful differences.

You might want to experiment with a scatter matrix, to explore which features spaces have the cleanest distinction between clusters.

  • $\begingroup$ how would i see if PC1 is representative of feature X? How can i use PCA to see what features best represent the data when it combines them all .. could you point me to a resource where they do this? I have not used PCA in this context. I am using python $\endgroup$
    – Maths12
    Commented Apr 15, 2021 at 17:10
  • $\begingroup$ you can use this to get the feature by component matrix pd.DataFrame(pca.components_, columns=list(df.columns)) $\endgroup$
    – WBM
    Commented Apr 15, 2021 at 17:16
  • $\begingroup$ And some further reading here towardsdatascience.com/… $\endgroup$
    – WBM
    Commented Apr 15, 2021 at 17:18
  • $\begingroup$ are there any others ways to see what features i should use for clustering? $\endgroup$
    – Maths12
    Commented Apr 15, 2021 at 20:36
  • $\begingroup$ You should start a different question for this $\endgroup$
    – WBM
    Commented Apr 16, 2021 at 10:08

Your Answer

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

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