I have a set of 10 points and need to find the clustering given 2 distinct cluster centers (8,3)
& (8,-1)
As the starting point. If I do it manually I get the correct cluster centers (4,5)
& (4,-1)
.
If I use R kmeans I get the centers for the right and left clusters (10.4,2)
& (-2.4,3.2)
.
My R code is:
x = c(-6,4,-3,7,1,6,-4,0,0,-1,11,7,8,3,8,-1,13,3,12,-2)
xx = matrix(x,nrow=2) # 2 x 10 matrix
xx
mx = t(xx) # transpose to 10 x 2 matrix
mx
kcenters = matrix(c(8,8,3,-1),ncol=2)
kcenters
km = NULL
km <- kmeans(mx, centers=kcenters, iter.max=1)
km$centers
I found this answer R k-means algorithm custom centers but that doesn't seem to work for me either.
Any suggestions as to what I am doing wrong?
Thanks