-
Notifications
You must be signed in to change notification settings - Fork 363
Home
Xander Johnson edited this page Dec 10, 2015
·
1 revision
Welcome to the pyLDAvis wiki!
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)