python - I don't understand the k-means scipy algorithm -
i'm trying use scipy kmeans algorithm.
so have simple example:
from numpy import array scipy.cluster.vq import vq, kmeans, whiten features = array([[3,4],[3,5],[4,2],[4,2]]) book = array((features[0],features[2])) final = kmeans(features,book)
and result is
final (array([[3, 4], [4, 2]]), 0.25)
what don't understand is, me centroids coordinate should barycentre of points belongings cluster, in exemple
[3,9/2] , [4,2]
can explain me result scipy algorithm giving?
it looks preserving data type giving (int). try:
features = array([[3., 4.], [3., 5.], [4., 2.], [4., 2.]])
Comments
Post a Comment