繁体   English   中英

来自gensim的pyLDAvis可视化未在google colab中显示结果

[英]pyLDAvis visualization from gensim not displaying the result in google colab

import pyLDAvis.gensim
# Visualize the topics
pyLDAvis.enable_notebook()
vis = pyLDAvis.gensim.prepare(lda_model, corpus, id2word)
vis

上面的代码在google colab中显示了LDA model的可视化,但是在重新打开笔记本后它停止显示。 我什至尝试过pyLDAvis.display(vis, template_type='notebook')仍然无法正常工作

当我设置

pyLDAvis.enable_notebook(local=True)

在此处输入图像描述它确实显示结果但不显示标签。任何帮助将不胜感激!

当您安装 LDAvis 时,请确保将版本指定为 2.1.2:

!pip install pyLDAvis==2.1.2

新版本似乎不能很好地与 colab 配合使用。

import pyLDAvis.gensim_models
vis = pyLDAvis.gensim_models.prepare(lda_model, corpus, id2word)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM