-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Topic model visualization #1932
Conversation
Feature reviewPreparationI'm using this script from gensim.corpora import Dictionary
from gensim.models import ldamodel
import gensim.downloader as api
import logging
logging.basicConfig(level=logging.INFO)
texts = [['bank','river','shore','water'],
['river','water','flow','fast','tree'],
['bank','water','fall','flow'],
['bank','bank','water','rain','river'],
['river','water','mud','tree'],
['money','transaction','bank','finance'],
['bank','borrow','money'],
['bank','finance'],
['finance','money','sell','bank'],
['borrow','sell'],
['bank','loan','sell']]
# texts = api.load("text8")
dictionary = Dictionary(texts)
corpus = [dictionary.doc2bow(text) for text in texts]
doc_texts = [' '.join(i) for i in texts]
model = ldamodel.LdaModel(corpus, id2word=dictionary, num_topics=30)
from gensim.viz.topic_viz.gensim_wrap import prepare
import gensim.viz.topic_viz as viz
print("LDA MODEL READY")
vis = prepare(model, corpus, dictionary, doc_texts)
viz.show(vis, local=True) I also start from Installation
Usage
|
The serious part of work done, now need to fix first #1932 (comment), this needs a good understanding of Python, JS and topic modeling on the basic level, we need contributors here (but a project isn't easy and need much time). Thanks for your work @parulsethi! I hope that you'll return to Gensim later 👍 |
This PR adds the visualization for interactive exploration of doc/topic/word entities in topic models (as discussed).