K-tool with selected starting centers

I am trying to cluster k-means with selected initial centroids. He says here that indicate his initial centers:

init : {‘k-means++, ‘random or an ndarray} 

If ndarraytransmitted, it should have the form ( n_clusters, n_features) and give the initial centers.

My Python code is:

X = np.array([[-19.07480000,  -8.536],
              [22.010800000,-10.9737],
              [12.659700000,19.2601]], np.float64)
km = KMeans(n_clusters=3,init=X).fit(data)
# print km
centers = km.cluster_centers_
print centers

It returns an error:

RuntimeWarning: Explicit initial center position passed: performing only one init in k-means instead of n_init=10
  n_jobs=self.n_jobs)

and return the same initial centers. Any ideas how to form the initial centers so that they can be accepted?

+7
source share
2 answers

KMeans KMeans , , ( Forgy). n_init= (docs):

n_init: int, : 10

, k- . n_init .

init= , . RuntimeWarning - n_init=10 ( ).

, n_init=1 n_init=1 init= .

+12

. , 'kmeans' ?

0

All Articles