In [3]:
#PCA
d=np.load("dataMask2.npy")
pca = PCA(n_components=2)
pca.fit(d)
dpca=pca.transform(d)
plt.scatter(dpca[:,0], dpca[:,1], marker='o', color='b')
Out[3]:
In [4]:
#K-means
idx, ctrs = kmeans(dpca, 2)
plt.scatter(dpca[(idx==0),0], dpca[(idx==0),1], marker='o', color='r')
plt.scatter(dpca[(idx==1),0], dpca[(idx==1),1], marker='o', color='b')
plt.scatter(ctrs[:,0], ctrs[:,1], marker='o', color='k', linewidths=5)
Out[4]:
In [ ]:
#...work in pregress (Imane, do this next)