Visualize Gensim's Phrases' vectors in 2D

234 Views Asked by At

I'm using the Phrases class and want to visualize the vectors in a 2D space. In order to do this with Word2Vec I've used T-SNE and it worked perfectly. When I'm trying to do the same with Phrases it doesn't make any sense (words appear next to irrelevant words).

Any suggestions on how to visualize the Phrases output?

1

There are 1 best solutions below

0
gojomo On

As suggested/reported on the gensim mailing list, the key problem was that merely wrapping a corpus in Phrases results in an iterator that offers only one pass over the data. The Word2Vec model needs a corpus over which it can make multiple passes to do its vocabulary-discovery then multiple-passes of training. (If closely watching INFO-level logging, there should be indications that 'training' ended almost instantly in such a situation.)