[英]how can I train my model using python gensim
I am trying to train my model and when I write these codes :我正在尝试训练我的模型,当我编写这些代码时:
for epoch in range(max_epochs):
model.train(tagged_data,
total_examples=model.corpus_count,
epochs=model.iter)
You're likely copying some outdated example code.您可能正在复制一些过时的示例代码。 For example:
例如:
.iter
property on the Doc2Vec
modelDoc2Vec
模型上没有.iter
属性train()
multiple times in your own epochs
loop - especially as a beginner just trying to get things workingepochs
循环中多次调用train()
几乎总是一个坏主意 - 特别是作为一个试图让事情正常工作的初学者So: don't copy whatever source you're copying.所以:不要复制你正在复制的任何来源。 It's not only out-of-date, it's suggesting something (the
train()
calls in a loop) that was never a great idea.它不仅过时了,而且暗示了一些从来都不是一个好主意的东西(
train()
在循环中调用)。
Instead, base your work on better examples, like the intro tutorial in the Gensim docs:相反,将您的工作基于更好的示例,例如 Gensim 文档中的介绍教程:
https://radimrehurek.com/gensim/auto_examples/tutorials/run_doc2vec_lee.html https://radimrehurek.com/gensim/auto_examples/tutorials/run_doc2vec_lee.html
将 model.iter 更改为 model.epochs 即 model.train(tagged_data, total_examples=model.corpus_count, epochs=model.epochs)
"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.