title: Getting the word-topic-matrix from LDA-model in Mallet
body: <p>I'm calculating the model-estimation of <strong>LDA</strong> with <strong>Mallet</strong> in Java and am looking for the <strong>term-topic-matrix</strong>.</p>
  
  <p>Calculating the model and getting the topic-document-matrix goes well:</p>
  
  <pre><code>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 &lt; numTopics; i++) {
          tmDist[i] = model.getTopicProbabilities(i);
  }
  </code></pre>
  
  <p>And now I'm only able to get the top <em>n</em> words:</p>
  
  <pre><code>Object[][] topWords = model.getTopWords(5);
  for(int i = 0; i &lt; topWords.length; i++){
      for(int j = 0; j &lt; topWords[i].length; j++){
          System.out.print(topWords[i][j] + " ");
      }
      System.out.println();
  }
  </code></pre>
  
  <p><em>The only answers regarding that problem I only found questions/answers for this problem are regarding the command line version of Mallet.</em></p>