📜  scikit learn k mean - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:37.787000             🧑  作者: Mango

代码示例1
from sklearn.cluster import KMeans
df = np.array([[1,4],[2,2],[2,5],[3,3],[3,4],[4,7],[5,6],[6,4],[6,7],[7,6],[7,9],[8,7],[8,9],[9,4],[9,8]])
kmeans = KMeans(n_clusters=3, init='k-means++', max_iter=300, n_init=10)
y_pred = kmeans.fit_predict(df)