python - 是否可以解决 BrokenPipeError: [Errno 32] Broken pipe in LDA 模型?
问题描述
当我使用 CoherenceModel 时,BrokenPipeError: [Errno 32] Broken pipe 错误发生。特别是在 coherence='c_v' 中,会发生此错误。当我选择参数为“u_mass”时,不会发生这种情况是否可以解决 BrokenPipeError: [Errno 32] Broken pipe in LDA model?
model = LdaModel(corpus=corpus, id2word=dictionary, num_topics=num_topics)
model_list.append(model)
coherencemodel = CoherenceModel(model=model, texts=texts, dictionary=dictionary, coherence='c_v')
coherence_values.append(coherencemodel.get_coherence())
BrokenPipeError Traceback (most recent call last)
<ipython-input-8-33bbdf4a0b18> in <module>
57 logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
58 # optimize
---> 59 find_optimal_number_of_topics(dictionary, corpus, processed_data)
60
<ipython-input-8-33bbdf4a0b18> in find_optimal_number_of_topics(dictionary, corpus, processed_data)
37 step = 6;
38
---> 39 model_list, coherence_values = compute_coherence_values(dictionary=dictionary, corpus=corpus, texts=processed_data, start=start, limit=limit, step=step)
40 x = range(start, limit, step)
41 plt.plot(x, coherence_values)
<ipython-input-8-33bbdf4a0b18> in compute_coherence_values(dictionary, corpus, texts, limit, start, step)
29 model_list.append(model)
30 coherencemodel = CoherenceModel(model=model, texts=texts, dictionary=dictionary, coherence='c_v')
---> 31 coherence_values.append(coherencemodel.get_coherence())
32 return model_list, coherence_values
33
.........
D:\choi\lib\multiprocessing\context.py in _Popen(process_obj)
320 def _Popen(process_obj):
321 from .popen_spawn_win32 import Popen
--> 322 return Popen(process_obj)
323
324 class SpawnContext(BaseContext):
D:\choi\lib\multiprocessing\popen_spawn_win32.py in __init__(self, process_obj)
87 try:
88 reduction.dump(prep_data, to_child)
---> 89 reduction.dump(process_obj, to_child)
90 finally:
91 set_spawning_popen(None)
D:\choi\lib\multiprocessing\reduction.py in dump(obj, file, protocol)
58 def dump(obj, file, protocol=None):
59 '''Replacement for pickle.dump() using ForkingPickler.'''
---> 60 ForkingPickler(file, protocol).dump(obj)
61
62 #
BrokenPipeError: [Errno 32] Broken pipe
解决方案
推荐阅读
- javascript - 设置新单元格值时保留格式(Google 电子表格)
- python-3.x - 编辑 Python Matplotlib Sankey(删除值,对齐文本..)
- php - 参数 1 使用 Axios Vue 和 Laravel 7 传递给 Symfony\Component\HttpFoundation\Response::setContent()
- r - 在 jupyter notebook 中使用“以下单元格的来源已更改,但不应更改!”进行验证
- typescript - 从函数返回完全相同长度的元组
- amazon-web-services - 如何在 AWS API Gateway 中传递查询字符串参数?
- flutter - 如何更改 FlutterLogo 颜色?
- c# - 如何修复升序和降序排序?
- git - git fetch 获取有关所有远程分支的信息并且 git pull 执行 git fetch 然后仅合并当前分支是否正确?
- python - 为列是否包含空列表分配二进制值