【问题标题】:Is it possible that there are clusters that do not have members in k-means clustering?是否有可能存在 k-means 聚类中没有成员的聚类?
【发布时间】:2020-02-28 23:25:11
【问题描述】:

我有一个使用 k-means 算法的文本聚类项目。我的数据集是 Facebook cmets 的政治情绪,因此每条评论都有正面、负面和中立的标签。

我在我的应用程序中做了如下:

1. Normalize text and delete stopwords.
2. Term weighting using tf-idf.
3. Constructing a matrix of vectors for each comment data.
4. Set the number of clusters to 3 (based on the number of labels).
5. Choose centroid randomly based on the label. So each label contributes 1 comment as a centroid.
6. Calculate the distance of each comment's vector with each centroid, assign to the closest centroid.
7. Calculate the vector's average of each cluster as a new centroid.
8. Repeat steps 6 and 7 until the centroid does not change.
9. The final cluster results.

在我得到的聚类结果中,有些聚类没有成员。比如我将集群的数量设置为 3,但结果是只有 2 个集群有成员,另外 1 个集群是空的。

这对 k-means 算法可行吗?如何解决这个问题?或者我的应用程序中可能有错误?

【问题讨论】:

    标签: cluster-analysis k-means


    【解决方案1】:

    显然,这是可能的。如果您要求三个集群但只有两个数据点,那么您将不会得到三个集群。

    实际上,这似乎非常可疑。 K-means 通常以现有数据点作为聚类中心。 k-means 的每次后续迭代都使用数据中一堆点的质心。要使该集群没有数据点,则需要存在一个数据点的质心,该质心不是与这些数据点中的至少一个最近的质心。

    也许可以构建一个发生这种情况的场景。但在现实世界的例子中,这似乎不太可能。是否有可能在集群上有一些其他过滤机制——例如最小大小——过滤掉集群? k-means 产生非常小的异常值集群并不罕见。事实上,我认为它最适合找到那些。

    【讨论】:

      【解决方案2】:

      是的,k-means 集群可以变成空的。

      这更可能发生在初始值错误和其他编程错误的情况下,所以如果你经常看到这种情况,我仍然会调试。

      您的方法中也存在一个重大概念错误:这里没有可以使类“积极”、“消极”或“中立”。这些是有监督的概念,聚类无法做到这一点。

      【讨论】:

        猜你喜欢
        • 2020-07-09
        • 2015-04-11
        • 2019-03-16
        • 2016-05-29
        • 2011-08-13
        • 2013-08-08
        • 2013-02-14
        • 2018-01-14
        • 2011-04-11
        相关资源
        最近更新 更多