Situation:
I have a numpy term-document matrix example: [[0,1,0,0....],....[......0,0,0,0]].
I have plugged in the above matrix to the ldamodel method of the gensim. And it is working fine with the lad method lda = LdaModel(corpus, num_topics=10)
.
corpus
is my term-document matrix mentioned above.
I needed two intermediate matrices( topic-word array & document-topic array) for research purpose.
1) per document-topic probability matrix (p_d_t)
2) per topic-word probability matrix (p_w_t)
Question:
How to get those array from the gensim LdaModel()
function.? Kindly help me with getting those matrices.
1.Per-document topic probability matrix:
Apply a transformation to your corpus.
docTopicProbMat = lda[corpus]
K = lda.num_topics
topicWordProbMat = lda.print_topics(K)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With