How to get the probability distribution of words for a particular topic?

I do thematic modeling using Mallet, and everything works fine, except that I cannot get the probability distribution of words in any particular topic.

However, I use the code below to print the proportions of topics for any particular document (represented by the docID variable below). Is there any similar code for 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");
+4
source share

All Articles