Adding Python ML examples of clustering data points.
[pingpong.git] / python_ml / dlink_clustering.py
1 from sklearn.cluster import KMeans
2 import numpy as np
3 X = np.array([[132, 192], [117, 960], [117, 962], [1343, 0], [117, 1109], [117, 1110], [117, 1111], [117, 1116], [117, 1117], [117, 1118], [117, 1119], [1015, 0], [117, 966]])
4 kmeans = KMeans(n_clusters=5, random_state=0).fit(X)
5 print(kmeans.labels_)
6 print(kmeans.labels_.tolist().count(3))