我正在使用 gensim Doc2Vec模型来生成我的特征向量。这是我正在使用的代码(我已经解释了代码中的问题):
cores = multiprocessing.cpu_count()
# creating a list of tagged documents
training_docs = []
# all_docs: a list of 53 strings which are my documents and are very long (not just a couple of sentences)
for index, doc in enumerate(all_docs):
# 'doc' is in unicode format and I have already preprocessed it
training_docs.append(TaggedDocument(doc.split(), str(index+1)))
# at this point, I have 53 strings in my 'training_docs' list
model = Doc2Vec(training_docs, size=400, window=8, min_count=1, workers=cores)
# now that I print the vectors, I only have 10 vectors while I should have 53 vectors for the 53 documents that I have in my training_docs list.
print(len(model.docvecs))
# output: 10
我只是想知道我是否做错了,或者是否应该设置任何其他参数?
更新:我正在使用TaggedDocument中的tags参数,当我将其更改为文本和数字的混合时,例如:Doc1、Doc2、...我看到生成向量的计数不同,但我仍然没有具有与预期相同数量的特征向量。