Need advice for Visualization of LdaMallet model

144 views Asked by At

I used a tutorial for analyzing a bigger corpus of academic articles, and ended up with LdaMallet model.

ldamallet = gensim.models.wrappers.LdaMallet(mallet_path, corpus=corpus, num_topics=10, id2word=id2word)

I visualized it with pyLDAvis, which provided very nice results in HTML form.

from gensim.models.ldamodel import LdaModel
def convertldaMalletToldaGen(mallet_model):
    model_gensim = LdaModel(
        id2word=mallet_model.id2word, num_topics=mallet_model.num_topics,
        alpha=mallet_model.alpha) # original function has 'eta=0' argument
    model_gensim.state.sstats[...] = mallet_model.wordtopics
    model_gensim.sync_state()
    return model_gensim

ldagensim = convertldaMalletToldaGen(ldamallet)
import pyLDAvis.gensim as gensimvis
vis_data = gensimvis.prepare(ldagensim, corpus, id2word, sort_topics=False)
pyLDAvis.display(vis_data)

My problem now is that I cannot use HTML in my academic article. So, can someone suggest to me a way how to visualize LdaMallet model into a "static" plot?

0

There are 0 answers