Doc2vecC 预测未见文档的向量

Doc2vecC predicting vectors for unseen documents

我已经使用 Doc2vecc 训练了一组文档。

https://github.com/mchen24/iclr2017

我正在尝试为看不见的东西生成嵌入向量 documents.I 已经训练了 go.sh 中提到的文档。

"""
time ./doc2vecc -train ./aclImdb/alldata-shuf.txt -word 
wordvectors.txt -output docvectors.txt -cbow 1 -size 100 -window 10 - 
negative 5 -hs 0 -sample 0 -threads 4 -binary 0 -iter 20 -min-count 10 
-test ./aclImdb/alldata.txt -sentence-sample 0.1 -save-vocab 
alldata.vocab
"""

我得到了训练集的 docvectors.txt 和 wordvectors.txt。现在,我如何在不重新训练的情况下使用相同的模型为看不见的测试生成向量。

据我所知,作者 (https://github.com/mchen24) of that doc2vecc.c code (and paper) just made minimal changes to some example 'paragraph vector' code that was itself a minimal change to the original Google/Mikolov word2vec.c (https://github.com/tmikolov/word2vec/blob/master/word2vec.c)。

'paragraph vector' 更改和随后的 doc2vecc 更改似乎都没有包含任何为新文档推断向量的功能。

因为这些是无监督算法,出于某些目的,在相同的组合批量训练中为训练和测试文本的某些下游分类任务计算文档向量可能是合适的。 (你的最终目标实际上可能有未标记的例子来帮助学习文档矢量化,即使你的分类器应该在已知标签文本的某些子集上进行训练和评估。)

Doc2VecC 专门用于创建文档向量作为每个文档中 word-vectors 的平均值。这与 Doc2Vec 不同,在 Doc2Vec 中,文档嵌入是与词嵌入一起训练的,因此无法处理看不见的文档。 Doc2Vec 中训练向量的数量也是巨大的。

要为未见过的文档构建向量,只需计算其中词汇表中的所有单词并计算 word-vectors 的平均值。