Tuck Yew
Tuck Yew

Reputation: 29

Plotting words in text clustering using python

I've got the result shown in below figure for my clustering.

enter image description here

Are there any libraries which are similar to fvid_clusters which could produce the plots as shown below ? (USING PYTHON)

enter image description here

Upvotes: 1

Views: 2864

Answers (2)

Frias
Frias

Reputation: 11281

Plots are not exactly like you show, but there two tools that I like to use in order to explore the result of text clustering (both have binds for Python).

Termite: http://vis.stanford.edu/papers/termite

Termite

UMAP: https://umap-learn.readthedocs.io/en/latest/

Here is the result of a topic modeling performed with NMF (from my thesis) using the BBC Sports dataset.

BBC Sports

Upvotes: 1

mujjiga
mujjiga

Reputation: 16856

  • Step 1: Vectorize the words into vectors (each of size n)
  • Step 2: Use kmean to cluster them into k clusters
  • Step 3: Run PCA on vectors produced in step 1 and reduce them to 2 dimensions (say x,y)
  • Step 4: Plot the words at the location (x, y) where (x,y) are the dimensions reduced by the PCA from its full size vector of size n. Color the word corresponding to which cluster it falls identified in step 2 (use one color per cluster).

Upvotes: 0

Related Questions