4

I am doing topic modelling using Mallet and everything works fine except that I am unable to get the probability distribution of the words in any particular topic.

However, I am using the below code to print the topic proportions for any particular document (represented by the docID variable below) - Is there any similar code to get the word distribution for any particular topic in Mallet?

for (int topic = 0; topic < numTopics; topic++) {
            Iterator<IDSorter> iterator = topicSortedWords.get(topic).iterator();
            out = new Formatter(new StringBuilder(), Locale.US);
            out.format("%d\t%.3f\t", topic, model.getTopicProbabilities(docID)[topic]);
            System.out.println(out);
        }

        System.out.println("\n");
London guy
  • 27,522
  • 44
  • 121
  • 179

0 Answers0