1
$\begingroup$

I understand how the clustering algorithm k-means works and I can map any new point to any of the lusters using the predict function.

What I want to understand is: how can I describe the clusters?

For example, if I have three variables, x, y, and z, I would like to be able that, say, people in cluster 1 are those for which x is in between these values, unless y is that and then x is in between these other values, etc.

I understand that, if you have hundreds of variables, this becomes very difficult, is there some kind of "decision tree"-type of description I can use?

Alternatively, is there a way to output what the function kmeans derived by the algorithm, which I will use to predict any new point, looks like?

$\endgroup$
1
$\begingroup$

One thing you can use is the cluster_centers_ (it's an attribute from your trained KMeans).

It'll give you a numpy ndarray with the position, according to each variable, of the centroid of each cluster. You can compare it to your mean value for each variable (or, if normalized, to zero), so you have an idea.

For example, if you have a variable Age, with a mean of 40, and one of your clusters have a centroïd at Age=75, you can label it to "old people" cluster. That's only an example, it can of course be automated.

$\endgroup$

Your Answer

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

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