1from sklearn.cluster import KMeans
2import numpy as np
3X = np.array([[1, 2], [1, 4], [1, 0],
4 [10, 2], [10, 4], [10, 0]])
5kmeans = KMeans(n_clusters=2, random_state=0).fit(X)
6kmeans.labels_
7
8kmeans.predict([[0, 0], [12, 3]])
9
10kmeans.cluster_centers_