kmeansmodel = KMeans(n_clusters= 4, init='k-means++') # 选择4作为聚类个数 y_kmeans= kmeansmodel.fit_predict(X) # 进行聚类的拟合和分类