doc2vec logging not happening

702 views
Skip to first unread message

Stuart Blair Wagner

unread,
Jul 26, 2018, 2:38:20 PM7/26/18
to gensim
Hello - 

I've used Doc2Vec before but it looks like there have been some changes. Previously, I'd get logging information however I don't seem to get it with this latest version. Running on Windows. Code I"m using it below. Docs in this example is a list holding a class called Document, and I am grabbing the preprocessed text from it to produce tagged_docs. 

How do I enable logging for training? I saw the documentation note they need the total_examples to do that, and I provide it. Any suggestions? 

tagged_docs = [TaggedDocument(doc.preprocess, [doc.idx]) for doc in docs]
model = gensim.models.doc2vec.Doc2Vec(vector_size=400, workers=12, epochs=100, min_count=1, window=10)
model.build_vocab(tagged_docs)
print("Training model")
print(model.corpus_count, len(tagged_docs))
model.train(tagged_docs, total_examples=model.corpus_count, epochs=model.epochs, report_delay=10)

Gordon Mohr

unread,
Jul 26, 2018, 3:21:16 PM7/26/18
to gensim
Python's logging framework needs to be configured before running other code to get optional logging output. There's lots of ways to do that, but there's also an example of one way cell [1] of the gensim intro word2vec notebook:


(Supplying an accurate `total_examples` ensures that the learning-rate decay happens correctly, and that any logged progress-estimates are calculated properly.)

- Gordon
Reply all
Reply to author
Forward
0 new messages