[英]How to get list of words for each topic in pyLDAvis
I am new to using pyLDAvis. 我是使用pyLDAvis的新手。 I have been looking through the documentation but cannot seem to find a way to get the set of words for each topic of my model.
我一直在浏览文档,但似乎无法找到一种方法来获取模型中每个主题的词汇。 I have 20 topics and I would like to get the top 20 or so words for each topic.
我有20个主题,并且每个主题我都希望获得前20个左右的词。 Does anyone have a way of getting this data?
有人有办法获取这些数据吗?
The pyldavis.prepare()
method produces a PreparedData
object with attributes like .topic_info
that returns a DataFrame with the words, logprob
etc (see docs ) pyldavis.prepare()
方法生成具有诸如.topic_info
属性的PreparedData
对象,该对象返回带有单词, logprob
等的logprob
(请参阅docs )
from pyLDAvis.gensim import prepare
vis = prepare(lda_model, corpus, dictionary, mds='tsne')
vis.topic_info
Category Freq Term Total loglift logprob
term
2299 Default 2,068,609.00 order 2,068,609.00 30.00 30.00
1037 Default 816,951.00 drink 816,951.00 29.00 29.00
2778 Default 565,075.00 review 565,075.00 28.00 28.00
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.