title: Print actual and predicted class labels using Random Forest in Java
body: <p>I have a large datasets with 10000 records such that 5000 belong to class 1 and remaining 5000 to class -1. I used Random Forest and obtained a good accuracy over 90%.</p>
  
  <p>Now if I have an arff file</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>@relation cds_orf
  @attribute start numeric
  @attribute end numeric
  @attribute score numeric
  @attribute orf_coverage numeric
  @attribute class {1,-1}
  @data
  (suppose this contains 5 records)</code></pre>
  </div>
  </div>
  </p>
  
  <p>my output should be something like this</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> No   Actual_class   Predicted class
   1     1                   1
   2     1                   1   
   3    -1                  -1  
   4     1                   -1
   5     1                    1</code></pre>
  </div>
  </div>
  </p>
  
  <p>I want the Java code to print this output. Thanks.
  (Note: I have used classifier.classifyInstance() but it gives NullPointerException)</p>