训练Doc2Vec模型之后,想要索取文档向量,却出现意外报错:
for idx, docvec in enumerate(model.docvecs): if idx < 17600: x_train.append(docvec) else: x_test.append(docvec)
错误情况:
KeyError: "tag '23943' not seen in training corpus/invalid"
解决方法:
① model.docvecs.doctag_syn0 (即将弃用) Or ② model.docvecs.vectors_docs