Hitomi
Hitomi

Reputation: 53

word2vec how to get words from vectors?

I use ANN to predict words from words. The input and output are all words vectors. I do not know how to get words from the output of ANN. By the way, it's gensim I am using

Upvotes: 3

Views: 1605

Answers (1)

kampta
kampta

Reputation: 4898

You can find cosine similarity of the vector with all other word-vectors to find the nearest neighbors of your vector.

The nearest neighbor search on an n-dimensional space, can be brute force, or you can use libraries like FLANN, Annoy, scikit-kdtree to do it more efficiently.

update

Sharing a gist demonstrating the same: https://gist.github.com/kampta/139f710ca91ed5fabaf9e6616d2c762b

Upvotes: 1

Related Questions