scikit-learn: Finding the features that contribute to each KMeans cluster

后端 未结 5 544
生来不讨喜
生来不讨喜 2021-01-31 20:19

Say you have 10 features you are using to create 3 clusters. Is there a way to see the level of contribution each of the features have for each of the clusters?

What I w

5条回答
  •  失恋的感觉
    2021-01-31 20:29

    Try this,

    estimator=KMeans()
    estimator.fit(X)
    res=estimator.__dict__
    print res['cluster_centers_']
    

    You will get matrix of cluster and feature_weights, from that you can conclude, the feature having more weight takes major part to contribute cluster.

提交回复
热议问题