我有一个2D数据集导入到了R中,其中包括(x,y)坐标。我想对这个数据集进行k-means聚类,但是我希望能够设置具体的坐标作为初始中心点。例如,我想从5个中心点开始,它们的值分别为(5,10),(3,8),(46,22),(87,66),(39,41)。
我看到了kmeans函数中的centers参数,但我不知道如何将我的值设置为中心点。
我看到了kmeans函数中的centers参数,但我不知道如何将我的值设置为中心点。
kmeans(data, centers = ...) # what to set here?
kmeans( data, centers=matrix(c(5, 10, 3, 8, 46, 22, 87, 66, 39, 41), ncol=2, byrow=TRUE))
。 - Mamoun Benghezal