简体   繁体   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

The above code displayed the visualization of LDA model in google colab but then after reopening the notebook it stopped displaying.上面的代码在google colab中显示了LDA model的可视化,但是在重新打开笔记本后它停止显示。 I even tried pyLDAvis.display(vis, template_type='notebook') still not working我什至尝试过pyLDAvis.display(vis, template_type='notebook')仍然无法正常工作

When I set当我设置

pyLDAvis.enable_notebook(local=True)

enter image description here it does display the result but not the labels.. Any help would be appreciated!!在此处输入图像描述它确实显示结果但不显示标签。任何帮助将不胜感激!

when you install LDAvis make sure to specify the version to be 2.1.2 with:当您安装 LDAvis 时,请确保将版本指定为 2.1.2:

!pip install pyLDAvis==2.1.2

the new versions don't seem to play well with colab.新版本似乎不能很好地与 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