I am using kmeans clustering algorithm on mnist dataset and want to visualize the plots after clustering. So far I did this
from mnist import MNIST
mndata = MNIST('Datasets')
X_train, y_train = mndata.load_training()
#do the clustering
k_means = cluster.KMeans(n_clusters=len(np.unique(y_train)))
k_means.fit(X_train)
labels = k_means.labels_
So, I now have 10 clusters representing 0 to 9. How can I visualize these clusters?
You can visualise multi-dimensional clustering using pandas plotting tool parallel_coordinates.
predict = k_means.predict(data)
data['cluster'] = predict
pandas.tools.plotting.parallel_coordinates(data, 'cluster')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With