You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Xander Johnson edited this page Dec 10, 2015
·
1 revision
Welcome to the pyLDAvis wiki!
Using Gensim Models
Have you ever looked around for a good example of using a model from gensim with pyLDAvis ? Just make sure you read this tutorial - then as long as you have the corpus, dictionary, and model, you can use pyLDAvis.gensim.prepare. An example from here is listed below:
def gensim_output(modelfile, corpusfile, dictionaryfile):
"""Displaying gensim topic models"""
## Load files from "gensim_modeling"
corpus = corpora.MmCorpus(corpusfile)
dictionary = corpora.Dictionary.load(dictionaryfile) # for pyLDAvis
myldamodel = models.ldamodel.LdaModel.load(modelfile)
## Interactive visualisation
import pyLDAvis.gensim
vis = pyLDAvis.gensim.prepare(myldamodel, corpus, dictionary)
pyLDAvis.display(vis)