1

如果我们将 K-means 和顺序 K-means 方法应用到具有相同初始设置的相同数据集,我们会获得相同的结果吗?解释你的理由。

我个人认为答案是否定的。顺序 K-means 得到的结果取决于数据点的呈现顺序。而且结束的条件也不一样。

这里附上两种聚类算法的伪代码。

K-均值

Make initial guesses for the means m1, m2, ..., mk
Until there is no change in any mean
    Assign each data point to the cluster whose mean is the nearest.
    Calculate the mean of each cluster.
    For i from 1 to k
        Replace mi with the mean of all examples for cluster i.
    end_for
end_until

顺序 K 均值

Make initial guesses for the means m1, m2, ..., mk
Set the counts n1, n2, ..., nk to zero
Until interrupted
    Acquire the next example, x
    If mi is closest to x
        Increment ni
        Replace mi by mi + (1/ni)*(x - mi)
    end_if
end_until
4

1 回答 1

6

没错,结果可能不同。

点数:x1 = (0,0), x2 = (1,1), x3 = (0.75,0), x4 = (0.25,1);m1 = (0,0.5), m2 = (1,0.5)。K-means 将 x1 和 x4 分配给 m1-cluster,将 x2 和 x3 分配给 m2-cluster。新的均值是 m1' = (0.125,0.5) 和 m2' = (0.875,0.5),不会发生重新分配。使用顺序 K-means,在分配 x1 后,m1 移动到 (0,0),x2 移动 m2 到 (1,1)。那么 m1 是最接近 x3 的均值,所以 m1 移动到 (0.375,0)。最后,m2 最接近 x4,因此 m2 移动到 (0.625,1)。这又是一个稳定的配置。

于 2011-12-02T03:33:10.340 回答