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)
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?
source
share