JohnTailor / tkm

17 stars 5 forks source link

visualization #12

Open un-lock-me opened 5 years ago

un-lock-me commented 5 years ago

Hi,

Is there any way to save the model to visualize the result something like the PyLDA is doing?

Thanks.

JohnTailor commented 5 years ago

Hi Saria,

TKM outputs the same as LDA,ie topic-doc distr and topic-word distr. With a bit of coding the PyLDAvis might be usable with TKM. I am not sure how much effort it is. It might be enough to just look at the example and use the prepare fct of the PyLDAvis,ie.

def prepare(topic_term_dists, doc_topic_dists, doc_lengths, vocab, term_frequency, R=30, lambda_step=0.01, mds=js_PCoA, n_jobs=-1, plot_opts={'xlab': 'PC1', 'ylab': 'PC2'}, sort_topics=True)

Best Jo.

un-lock-me commented 5 years ago

Hi John,

Thanks for replying back, Actually I need to save all these topic_term_dists, doc_topic_dists, doc_lengths, vocab, term_frequency in your code(I just wanted to visualize with the topic terms probability that I have which seems impossible(I have about 20 folders to run the code separately). can you please confirm this? topic_term_dists = out topics which I have p_d_t = doc_topic_dists doc_lengths = n_docs vocab = word2id term_frequency = nw

Are they correct?

Thanks for taking the time and helping out, while finished Ill share the code here:)

un-lock-me commented 5 years ago

pyLDAvis._prepare.ValidationError:

JohnTailor commented 5 years ago

Thanks for letting me know. You might just renormalize. It will take a bit until I can investigate the issue.