gensim word2vec accessing in/out vectors

后端 未结 4 666
一个人的身影
一个人的身影 2021-02-07 09:02

In the word2vec model, there are two linear transforms that take a word in vocab space to a hidden layer (the \"in\" vector), and then back to the vocab space (the \"out\" vecto

4条回答
  •  旧巷少年郎
    2021-02-07 09:10

    In the word2vec.py file you need to make this change In the following function it currently returns the "in" vector. As you want the "out" vector. The "in" is saved in syn0 object and "out" is saved in syn1neg object variable.

    def save_word2vec_format(self, fname, fvocab=None, binary=False):
      ....
      ....
      row = self.syn1neg[vocab.index]
    

提交回复
热议问题