0
$\begingroup$

If I create clusters using the KMeans clustering algorithm in Python, is there any way I can find which attributes were used to group those instances in clusters?

Example: I have a dataset of cars with columns 1 - 10. I get 3 clusters, how can I know which attributes were used to make them? Is it because all instances in cluster 1 have the same value in columns 2 and 3?

$\endgroup$

1 Answer 1

0
$\begingroup$

First things first - You got back 3 clusters from K-Means because you asked it to find the 3 best clusters (and not the other way around). Google up the "elbow-method" to help you determine the best number of clusters for your dataset.

Clustering would make use of the all 10 columns in your dataset.

In order to figure out which fields matter to a cluster - Find the mean and standard deviation of every field within the context of a cluster. The fields with the lowest standard deviation probably tell you why these instances were grouped together in a single cluster.

Another thing you could try out is - use CLusters as Labels - and run your dataset by a classification model such as Random Forests or xgboost. Random Forests for instance gives you a Feature Importance - which will provide you insights on the most impactful features in your dataset.

$\endgroup$

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.