我正在尝试在gensim中复制Mallet包装器的教程。 http://radimrehurek.com/2014/03/tutorial-on-mallet-in-python/
当我使用
拟合模型时model = models.LdaMallet(mallet_path, corpus, num_topics=10, id2word=corpus.dictionary)
我收到错误消息:
C:\Anaconda\lib\site-packages\gensim\models\ldamallet.py:234: RuntimeWarning: invalid value encountered in divide topic = topic / topic.sum() # normalize to probability dist
当我使用模型推断示例的主题分布时,分布是统一的:
doc = "Don't sell coffee, wheat nor sugar; trade gold, oil and gas instead."
bow = corpus.dictionary.doc2bow(utils.simple_preprocess(doc))
print model[bow]
我的输出:
[(0, 0.10000000000000002), (1, 0.10000000000000002), (2, 0.10000000000000002), (3, 0.10000000000000002), (4, 0.10000000000000002), (5, 0.10000000000000002), (6, 0.10000000000000002), (7, 0.10000000000000002), (8, 0.10000000000000002), (9, 0.10000000000000002)]
这是包装纸或木槌功能的问题吗?我已经设法在这里复制了槌程教程:http://programminghistorian.org/lessons/topic-modeling-and-mallet