import pyLDAvis.gensim
# Visualize the topics
pyLDAvis.enable_notebook()
vis = pyLDAvis.gensim.prepare(lda_model, corpus, id2word)
vis
上面的代码在 google colab 中显示了 LDA 模型的可视化,但在重新打开笔记本后它停止显示。我什至试过
pyLDAvis.display(vis, template_type='notebook')
还是行不通当我设置
pyLDAvis.enable_notebook(local=True)
enter image description here它确实显示结果但不显示标签.. 任何帮助将不胜感激!
最佳答案
安装 LDAvis 时,请确保将版本指定为 2.1.2:
!pip install pyLDAvis==2.1.2
新版本似乎不太适合 colab。
关于visualization - 来自gensim的pyLDAvis可视化未在google colab中显示结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66096149/