我正在尝试使用选定的初始质心进行k均值聚类.
它说
here
指定您的初始中心:
init : {‘k-means++’, ‘random’ or an ndarray}
如果传递了ndarray,它应该是形状(n_clusters,n_features)并给出初始中心.
我在Python中的代码:
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
返回错误:
RuntimeWarning: Explicit initial center position passed: performing only one init in k-means instead of n_init=10
n_jobs=self.n_jobs)
并返回相同的初始中心.知道如何形成初始中心以便可以接受吗?