Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 563
Hitomi Avatar asked Jan 19 '26 07:01

Hitomi


1 Answers

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

like image 183
kampta Avatar answered Jan 21 '26 00:01

kampta