K均值聚类的一个例子
作者:互联网
来自微信读书:
https://weread.qq.com/web/reader/adb3241071d7c7c6adb07e4
import matplotlib.pyplot as plt from sklearn.datasets import make_blobs blobs=make_blobs(n_samples=200,random_state=1,centers=4) X_blobs=blobs[0] plt.scatter(X_blobs[:,0],X_blobs[:,1]) plt.show from sklearn.cluster import KMeans kmeans=KMeans(n_clusters=4) kmeans.fit(X_blobs)
画图程序
标签:plt,blobs,make,均值,KMeans,kmeans,例子,聚类,import 来源: https://www.cnblogs.com/redufa/p/13712488.html