word2vec如何从向量中获取单词? [英] word2vec how to get words from vectors?

查看:158
本文介绍了word2vec如何从向量中获取单词?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ANN从单词中预测单词.输入和输出都是单词向量.我不知道如何从ANN的输出中获取单词.顺便说一句,我正在使用gensim

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

推荐答案

您可以找到向量与所有其他单词向量的余弦相似度,以找到向量的最近邻.

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

在n维空间上最近的邻居搜索可能是蛮力的,或者您可以使用FLANN,Annoy,scikit-kdtree之类的库来更有效地进行搜索.

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.

更新

分享同样要点的要点: https://gist.github.com/kampta/139f710ca91ed5fabaf9e6616d2c762b

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

这篇关于word2vec如何从向量中获取单词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆