I have a yelp-review dataset. I have done a word2vector embedding on the text column of the yelp-review. I am using unsupervised leaning K-means and PCA & TSNE to visualise the data. I have got 6 clusters which are well separated. Now I want to create a "Word-Cloud" with respect to each of the cluster labels. Can one one give an idea how to do that. Thank you.
1 Answer
To answer your question correctly, it is necessary to understand the meaning of PCA axis.
The Principal Components are built according to linear correlations found in the multi dimentional vectors. It is difficult to give them a proper meaning, they are just correlated in a statistical point of view, but if you see their labels, you can see if they share a common field (for instance "guitar" and "piano" could be close to a principal component defining "sounds").
On the other hand, the more the cluster is concentrated, the more there is correlation between points, but you have to consider their distance from principal component axis.
For instance, if there is a concentrated cluster very close to PC2 axis positively or negatively,but far from PC1, it means that they are higly correlated together towards PC2, but no correlation with PC1.
Then, if 2 clusters are opposite with respect to 0, they are both anti correlated.
If 2 clusters make a 90° angle with respect to 0, they have no correlation.
-
$\begingroup$ Actually, I want to see the which "words" belongs to cluster 0 and so on. PCA, I have two components so the visualisation is pretty easy. $\endgroup$– GabSCommented Jun 24, 2021 at 18:39
-
1$\begingroup$ Therefore, you need to add the words' labels to your plots. For example, in this simulator, you can see a word2vec pca using labelled words. projector.tensorflow.org $\endgroup$ Commented Jun 24, 2021 at 19:41
-
$\begingroup$ If I want to plot a word cloud with respect to cluster label, how it can be done. $\endgroup$– GabSCommented Jun 25, 2021 at 19:10
-
$\begingroup$ You look for the hypernym of each cluster. There are publications for this topic. Otherwise, a simple solution is to look for the most representative word at the center of each cluster, but it is not as good as the hypernym. $\endgroup$ Commented Jun 26, 2021 at 5:58
-
$\begingroup$ Here is a function to get hypernyms with wordnet: nltk.org/howto/wordnet_lch.html $\endgroup$ Commented Jun 26, 2021 at 10:18