I'm calculating the model-estimation of LDA with Mallet in Java and am looking for the term-topic-matrix.
Calculating the model and getting the topic-document-matrix goes well:
ParallelTopicModel model = ...; //... estimating the model
int numTopics = model.getNumTopics();
int numDocs = model.getData().size();
// Getting the topic-probabilities
double[][] tmDist = new double[numDocs][];
for (int i = 0; i < numTopics; i++) {
tmDist[i] = model.getTopicProbabilities(i);
}
And now I'm only able to get the top n words:
Object[][] topWords = model.getTopWords(5);
for(int i = 0; i < topWords.length; i++){
for(int j = 0; j < topWords[i].length; j++){
System.out.print(topWords[i][j] + " ");
}
System.out.println();
}
The only answers regarding that problem I only found questions/answers for this problem are regarding the command line version of Mallet.