Machine learning 我试图用LDA模型在我的语料库中获得最佳数量的主题,但返回给我一个运行时错误,我如何修复它?

Machine learning 我试图用LDA模型在我的语料库中获得最佳数量的主题,但返回给我一个运行时错误,我如何修复它?,machine-learning,nlp,python,model,Machine Learning,Nlp,Python,Model,我有一个运行时错误: RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase. This probably means that you are not using fork to start your child processes

我有一个运行时错误:

RuntimeError: 
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
  0%|          | 0/29 [00:48<?, ?it/s]

我想要的是获得我的语料库中的最佳主题数量,然后获得主题并解释主题模型结果。我是生物学家,所以我不知道如何修复它。谢谢你的帮助

嗨。在这里,我们通常不修复bug。请查看以了解更多详细信息。我将把这个问题转移到堆栈溢出。您需要澄清1。你从哪里得到这个代码,2。你是如何执行代码的,等等。我学习的是一本自然语言书,用于研究论文之间的关系,用于执行我使用Pycharm的代码。另外,请提供一个示例,以便我们可以运行你的代码,并检查我们是否也遇到同样的问题。你使用的操作系统是什么?Python的版本是什么?嗨。在这里,我们通常不修复bug。请查看以了解更多详细信息。我将把这个问题转移到堆栈溢出。您需要澄清1。你从哪里得到这个代码,2。你是如何执行代码的,等等。我学习的是一本自然语言书,用于研究论文之间的关系,用于执行我使用Pycharm的代码。另外,请提供一个示例,以便我们可以运行你的代码,并检查我们是否也遇到同样的问题。你使用的操作系统是什么?Python的版本是什么?
def topic_model_coherence_generator (corpus, texts, dictionary, start_topic_count=2, end_topic_count=10, step=1, cpus=1):
    models=[]
    coherence_scores = []
    for topic_nums in tqdm(range(start_topic_count, end_topic_count+1, step)):
        lda_model = gensim.models.LdaModel(corpus=bow_corpus, id2word=dictionary, chunksize=1740, alpha='auto', eta='auto',
                                   random_state=42, iterations=500, num_topics=topic_nums, passes=20, eval_every=None)

        cv_coherence_model_lda = gensim.models.CoherenceModel(model=lda_model, corpus=bow_corpus,
                                                      texts=norm_corpus_bigrams, dictionary=dictionary,
                                                      coherence='c_v')

        coherence_score= cv_coherence_model_lda.get_coherence()
        coherence_scores.append(coherence_score)
        models.append(lda_model)
    return models, coherence_scores

lda_models, coherence_scores = topic_model_coherence_generator(corpus=bow_corpus,
                                                               texts=norm_corpus_bigrams,
                                                               dictionary= dictionary,
                                                               start_topic_count=2,
                                                               end_topic_count=30,
                                                               step=1, cpus=16)