簡體   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