【问题标题】:gensim LdaMulticore is not running from Command Promptgensim LdaMulticore 未从命令提示符运行
【发布时间】:2017-08-18 13:45:36
【问题描述】:

我正在使用 gensim LdaMulticore 提取主题。它在 Jupyter/Ipython 笔记本上运行良好,但是当我从命令提示符运行时,循环无限期地运行。 一旦执行到达 LdaMulticore 函数,执行从 first 开始。 请帮助我,因为我是新手

if __name__ == '__main__': 
    model = models.LdaMulticore(corpus=corpus_train, id2word=dictionary, num_topics=20, chunksize=4000, passes=30, alpha=0.5, eta=0.05, decay=0.5, eval_every=10, workers=3, minimum_probability=0)

**RESULTS:-**
Moving to Topics Extraction Script---------------------------------
2017-08-18 18:59:36,448 : INFO : using serial LDA version on this node
2017-08-18 18:59:37,183 : INFO : running online LDA training, 20 topics, 1 passes over the supplied corpus of 400 documents, updating every 12000 documents, evaluating every ~400 documents, iterating 50x with a convergence threshold of 0.001000    
2017-08-18 18:59:37,183 : WARNING : too few updates, training might not converge; consider increasing the number of passes or iterations to improve accuracy
2017-08-18 18:59:37,183 : INFO : training LDA model using 3 processes
2017-08-18 18:59:37,214 : INFO : PROGRESS: pass 0, dispatched chunk #0 = documents up to #400/400, outstanding queue size 1
Importing required Packages

导入所需的包

【问题讨论】:

  • 我只是想说我有同样的问题,但反过来。我可以在终端上运行 Ldamulticore,但如果我在 Jupyter 笔记本上运行,循环会无限运行。

标签: python nlp multicore gensim lda


【解决方案1】:

LdaMulticore 使用所有 CPU 内核来并行化和加速处理。 并行化使用多处理概念;因此,您必须编写程序以支持多处理概念。

我遇到了同样的问题,所以我用 LdaModel 替换了 LdaMulticore,它工作正常。

`gensim.models.LdaModel(corpus, num_topics=4, id2word=dictionary)`

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-05-10
    • 1970-01-01
    • 2010-11-30
    • 2018-05-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多