how to get word-topic probability using mallet

后端 未结 2 513
独厮守ぢ
独厮守ぢ 2021-01-14 02:10

I\'ve made a parallel topic model using mallet.

And I want to get top-words for each document.

To do that, I\'m trying to get a word-topic probability matrix

相关标签:
2条回答
  • 2021-01-14 02:59

    Just to make one point regarding the answer of Praveen.

    Using the --word-topic-counts-file, MALLET will create a file which first few rows look something like this:

    0 elizabeth 19:1
    1 needham 19:2 17:1
    2 died 19:2
    3 mother 17:1 19:1 14:1

    where first line means that the word elizabeth has been present in the topic 19 once; second line means that the word needham is associated two times with the topic 19, and with the topic 17 once; and so on...
    Although, this file doesn't give you explicit probabilities, you can use it to calculate them.

    0 讨论(0)
  • 2021-01-14 03:00

    When you are building topics using MALLET, you have an option called --word-topic-counts-file. When you give this option and specify a file, MALLET writes ( topic, word, probability ) values per each line in the file. You can later read this file in C, Java or R (of course, any language) to create the matrix you want.

    0 讨论(0)
提交回复
热议问题