在定义簇数的图中应该考虑膝盖还是肘部?

is it the knee or the elbow that should be considered in the plot for defining the number of clusters?

我正在使用 elbow 方法、silhouette 并尝试从数据中找到 k m 个簇的最佳数量。现在对于大多数软件包,如果我考虑 wss(在相似性分数内)或轮廓,它会给出 3 个 PAM、Kmeans、clara。通过 Hubert 分析,我得到了理想的 2 个集群。唯一奇怪的是下面的命令给了我一个让我有点困惑的情节。我应该将其视为 3 个集群还是 4 个集群。如果有人可以在这里给我一些反馈。

使用代码

    wss <- (nrow(scale(df))-1)*sum(apply(scale(df),2,var))
    for (i in 2:10) wss[i] <- sum(kmeans(scale(df),
                                                                                centers=i)$withinss) 
fviz_nbclust(scale(df), kmeans, method = "wss")

我也在尝试放置图像,以便可以告诉我这里的簇号是 3 还是 4。理想情况下,我认为它应该是 4,因为 WSS 的重点是 select SSE 或多或少平坦的 k。

基本思想是低 "Within Sum of Squared" 是一个好模型的信号(就误差而言)。但是,簇越多,误差平方和 (SSE) 的值越低。

简单来说:"when you see that the rate at which the SSE is decreasing (with a higher number of clusters) is slowing down, that would a good point to freeze the number of clusters".

因此,它是 肘部,在您的情况下,编号为 4,因为上证指数在 4 之后下降速度正在放缓。

另请参阅:here and here on SO

在维基百科上有关于如何确定聚类数量的精彩概述:here