How to concatenate word vectors to form sentence vector

后端 未结 1 2003
滥情空心
滥情空心 2021-01-20 15:05

I have learned in some essays (Tomas Mikolov...) that a better way of forming the vector for a sentence is to concatenate the word-vector.

but due to my clumsy in m

1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-20 15:16

    There are at least three common ways to combine embedding vectors; (a) summing, (b) summing & averaging or (c) concatenating. So in your case, with concatenating, that would give you a 1 x m*a vector, where a is the number of sentences. In the other cases, the vector length stays the same. See gensim.models.doc2vec.Doc2Vec, dm_concat and dm_mean - it allows you to use any of those three options [1,2].

    [1] http://radimrehurek.com/gensim/models/doc2vec.html#gensim.models.doc2vec.LabeledLineSentence

    [2] https://github.com/piskvorky/gensim/blob/develop/gensim/models/doc2vec.py

    0 讨论(0)
提交回复
热议问题