Graph only partially displaying in Jupyter Notebook output

感情迁移 提交于 2020-01-03 15:36:37

问题


I am trying to get a PyLDAvis graph that looks like the 2 shown in this link, that you can see right away (Intertopic Distance Map and Top 30 Most Salient Terms):

http://nbviewer.jupyter.org/github/bmabey/hacker_news_topic_modelling/blob/master/HN%20Topic%20Model%20Talk.ipynb

My code does display it but only partially, I can only see 1 cluster on the left and like 5-6 terms on the right, the rest gets cut off (there should be many clusters and 30 words shown). This is the code I have:

import warnings
warnings.filterwarnings('ignore')

import os 
%matplotlib inline
import pyLDAvis.gensim
import gensim
pyLDAvis.enable_notebook()

d = gensim.corpora.Dictionary.load('dictionary.dict')
c = gensim.corpora.MmCorpus('corpus.mm')


pd.options.display.max_colwidth = 5000
pd.options.display.show_dimensions
data = pyLDAvis.gensim.prepare(ldamodel, c, d, mds='tsne')

Any ideas as to why its only showing me part of the graph?

EDIT update:

It seems the very similar code below worked:

import warnings
warnings.filterwarnings('ignore')

ldamodel.save('topic.model')
import os 
%matplotlib inline
import pyLDAvis.gensim
import gensim
pyLDAvis.enable_notebook()

d = gensim.corpora.Dictionary.load('dictionary.dict')
c = gensim.corpora.MmCorpus('corpus.mm')
lda = gensim.models.LdaModel.load('topic.model')

pd.options.display.max_colwidth = 5000
data = pyLDAvis.gensim.prepare(lda, c, d, mds='tsne')
pyLDAvis.display(data)

来源:https://stackoverflow.com/questions/47996444/graph-only-partially-displaying-in-jupyter-notebook-output

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!