1
$\begingroup$

How to construct the document-topic matrix using the word-topic and topic-word matrix calculated using Latent Dirichlet Allocation? I can not seem to find it anywhere, even not from the author of LDA, M.Blei.

Gensim and sklearn just work, but I want to know how to use the two matrices to construct the document topic-matrix (Spark MLLIB LDA only gives me the 2 matrices and not the document-topic matrix).

$\endgroup$
2
  • $\begingroup$ stackoverflow.com/questions/33072449/… $\endgroup$
    – Emre
    Jul 15 '16 at 20:25
  • $\begingroup$ Thank you. Yes, I found that and implemented that. But I want to learn the theory and implement it for my Python friends. $\endgroup$
    – blpasd
    Jul 16 '16 at 10:53
0
$\begingroup$

using the word-topic and topic-word matrix

This would be the same, wouldn't it? The model generates a words x topics and a topics x documents matrix, there is not much left to calculate, the model practically spits it out.

Using the Gibbs method gives you the counts Ntw[1..T][1..W] and Ndt[1..D][1..T], where for example Ndt[1][5] is the amount of words assigned to topic number 5 in document number 1.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.