【发布时间】:2019-11-14 09:16:21
【问题描述】:
我有一个二进制 word2vec 文件,我正在使用 gensim 来加载它。
虽然 gensim 中有两个词之间的similarity 函数,但没有计算和返回差向量的函数。
如何使用两个向量并获得差异向量?
而且我也在尝试将这些差异向量用作文档分类中的特征。计算每个单词和每个类之间的差异向量。这是正确的方法吗?
例如,如果类是 sport 和 politics
sport = [0.4,0.456,45,...] #wordvector of class
politics = [0.23,0.56...] #wordvector of class
我的话是football
football = [0.2,0.6,0.45,...] #wordvector of football
我要计算差异向量
(sport - football) = [some vector] # this as a feature for classification
【问题讨论】:
标签: python gensim word2vec calculation document-classification