0

I'm running jupyter notebook in vscode. I have build my LDA model using gensim but when I want to visualize it, it shows nothing.

my code is:

import pyLDAvis 
import pyLDAvis.gensim_models

pyLDAvis.enable_notebook(local=True)
vis = pyLDAvis.gensim_models.prepare(lda_model, corpus, id2word)

vis

I tried display method of pyLDAvis it didn't work neither

I'm expecting some plots and graphs like this address

Mhmmd
  • 3
  • 1

2 Answers2

0

I found some answer for it. It still wont work on jupyter extension of VScode but on jupyterlab on browser it works.

Mhmmd
  • 3
  • 1
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 26 '23 at 11:08
0

You need to apply a display method on the prepared data for the visualization to show up. Try this:

import pyLDAvis 
import pyLDAvis.gensim_models

pyLDAvis.enable_notebook(local=True)
vis = pyLDAvis.gensim_models.prepare(lda_model, corpus, id2word)

pyLDAvis.display(vis)
Ichta
  • 278
  • 4
  • 15