如何从K-Means聚类中解释剪影系数?

时间:2017-06-18 03:03:10

标签: python scikit-learn k-means coefficients silhouette

我正在使用sklearn包练习K-Means聚类。 我正在使用样本购物数据集,其中包括每个客户在每个项目类别中花费的金额(即食品,时装,数字等)。

有42个功能,这意味着我用来输入K-Means的42个项目类别。当我检查k的轮廓系数在2-50之间时,结果如下所示:

结果

For n_clusters=2, The Silhouette Coefficient is 0.296883351294 
For n_clusters=3, The Silhouette Coefficient is 0.429716008727
For n_clusters=4, The Silhouette Coefficient is 0.5379833453
For n_clusters=5, The Silhouette Coefficient is 0.640200087198
For n_clusters=6, The Silhouette Coefficient is 0.720988889121
For n_clusters=7, The Silhouette Coefficient is 0.754509135746
For n_clusters=8, The Silhouette Coefficient is 0.824498184042
For n_clusters=9, The Silhouette Coefficient is 0.859505132529
For n_clusters=10, The Silhouette Coefficient is 0.886719390512
For n_clusters=11, The Silhouette Coefficient is 0.909094073152
For n_clusters=12, The Silhouette Coefficient is 0.924484657787
For n_clusters=13, The Silhouette Coefficient is 0.935920328988
For n_clusters=14, The Silhouette Coefficient is 0.941202266924
For n_clusters=15, The Silhouette Coefficient is 0.944696312832
For n_clusters=16, The Silhouette Coefficient is 0.94973283735
For n_clusters=17, The Silhouette Coefficient is 0.953130541493
For n_clusters=18, The Silhouette Coefficient is 0.956455183621
For n_clusters=19, The Silhouette Coefficient is 0.959253033224
For n_clusters=20, The Silhouette Coefficient is 0.962360042108
For n_clusters=21, The Silhouette Coefficient is 0.964250208432
For n_clusters=22, The Silhouette Coefficient is 0.967326417612
For n_clusters=23, The Silhouette Coefficient is 0.969331109452
For n_clusters=24, The Silhouette Coefficient is 0.971127562002
For n_clusters=25, The Silhouette Coefficient is 0.972261973972
For n_clusters=26, The Silhouette Coefficient is 0.9734445716
For n_clusters=27, The Silhouette Coefficient is 0.974238560202
For n_clusters=28, The Silhouette Coefficient is 0.97488260729
For n_clusters=29, The Silhouette Coefficient is 0.97531193231
For n_clusters=30, The Silhouette Coefficient is 0.974524792419
For n_clusters=31, The Silhouette Coefficient is 0.975612314038
For n_clusters=32, The Silhouette Coefficient is 0.975737449165
For n_clusters=33, The Silhouette Coefficient is 0.976396323376
For n_clusters=34, The Silhouette Coefficient is 0.977655049988
For n_clusters=35, The Silhouette Coefficient is 0.977653124893
For n_clusters=36, The Silhouette Coefficient is 0.977692656935
For n_clusters=37, The Silhouette Coefficient is 0.977631627533
For n_clusters=38, The Silhouette Coefficient is 0.978547753839
For n_clusters=39, The Silhouette Coefficient is 0.978886776953
For n_clusters=40, The Silhouette Coefficient is 0.979381767137
For n_clusters=41, The Silhouette Coefficient is 0.9796349521
For n_clusters=42, The Silhouette Coefficient is 0.979461929477
For n_clusters=43, The Silhouette Coefficient is 0.980920963377
For n_clusters=44, The Silhouette Coefficient is 0.980129624336
For n_clusters=45, The Silhouette Coefficient is 0.981374785468
For n_clusters=46, The Silhouette Coefficient is 0.980656482976
For n_clusters=47, The Silhouette Coefficient is 0.982323770297
For n_clusters=48, The Silhouette Coefficient is 0.982538183341
For n_clusters=49, The Silhouette Coefficient is 0.982842003856

我不知道如何利用这个结果。在我看来,随着我向前迈进,s越来越大。我这样做了吗?或者我应该尝试不同的集群评估方法?

1 个答案:

答案 0 :(得分:3)

点的轮廓测量点与其簇相对于下一个最接近的簇的相似程度。这是到集群中心的距离的比率,归一化为" 1"与其集群完美匹配," -1"一个完美的不匹配。

(注意:聚类中心的使用可能特别适用于k均值聚类。)

群集的轮廓是其所有成员的平均轮廓。这意味着实践是一个更大的数字意味着群集被分离"来自其他集群。

我认为剪影是测量沿着集群边界的点的密度。当轮廓很高时,边界的点很少。这就是你想要的 - 分离良好的集群。

当使用k-means,small" outlier"群集通常会有很大的轮廓。通常较大的群集具有密集的边界。看看尺寸和轮廓会很有趣。