Python Visualize K-clustering

I have follow this tutorial http://ai.intelligentonlinetools.com/ml/k-means-clustering-example-word2vec/ for the K-clustering using NLTK package part.

The code for NLTK K-clustering is like this :
X = model[model.wv.vocab]
Cluster = 2
Kcluster = KMeansClusterer(Cluster,distance = nltk.cluster.util.cosine_distance,repeats = 25 )
ApplyCluster = Kcluster.cluster(model[abc.vocab], assign_clusters=True)

So for this i want to visualize our result, but i have no idea. I have try plot.scatter() but i have some problems to define which parameter to take.

Upvotes: 0

Views: 1013

Answers (1)

mr_mo
mr_mo

Reputation: 1528

My suggestions:

  1. Try various combinations of 2 dimensions.
  2. Use PCA to transform the data, and pick the first 2 principal components.
  3. t-sne is a great dimension reduction technique for visualizations.

EDIT: You may look here for plotting ideas (technical, not mathematical)
EDIT 2: As mentioned by @Dan, t-sne is a great dimension reduction technique for visualizations, based on similarity matrices and the modified algorithm (hence t-sne) does that very good.

Good luck!

Upvotes: 1

Related Questions