简体   繁体   中英

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. I even tried pyLDAvis.display(vis, template_type='notebook') still not working

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:

!pip install pyLDAvis==2.1.2

the new versions don't seem to play well with colab.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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