I can't import pyLDAvis.
It is installed but for some reason, I can not import it.
I tried
conda update anaconda
pip install --upgrade pip
pip install --upgrade jupyter notebook
pip install pyLDAvis
Installing pyLDAvis returns the message 'requirement already satisfied'. So I tried uninstalling and reinstalled the package but still doesn't work. This never happened with any other packages.
How can I solve this problem?
The pyLDAvis gensim name changed. When I use gensim_models rather than gensim the interactive viz works.
The 'gensim_models' name is in the latest commit to bmabey's repo.
import pyLDAvis
import pyLDAvis.gensim_models as gensimvis
pyLDAvis.enable_notebook()
# feed the LDA model into the pyLDAvis instance
lda_viz = gensimvis.prepare(ldamodel, corpus, dictionary)
Following code worked for me and I'm using Google Colaboratory.
!pip install pyLDAvis
import pyLDAvis
import pyLDAvis.gensim_models
pyLDAvis.enable_notebook()
vis = pyLDAvis.gensim_models.prepare(ldamodel, doc_term_matrix, dictionary)
vis
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With