title: Weka java library: how to get string representation of classified instance?
body: <p>Currently I'm working on a project of classifying search queries into the following eight types: {athlete, actor, artist, politician, geo, facility, QA, definition}. After a bit of work I managed to score 78% correctly classified instances for my set of 300 sample queries using a Multilayer Perceptron classifier when I evaluate the classifier with a stratified 10-fold cross validation, which is reasonably good I think.</p>
  
  <p>Using the weka java library I implemented the whole thing into java code, so I can write a program that dynamically feeds a query to the classifier and retrieves it's query type. I managed to implement the whole classifier training part successfully. The next step would be to use either the classifyInstance() or distributionForInstance() to determine the class to which the query is classified. </p>
  
  <p>classifyInstance() however does only return a double value for which I do not know to get the actual query-type out of it. The <a href="http://weka.wikispaces.com/Use+WEKA+in+your+Java+code#Classification-Classifying%20instances" rel="nofollow">weka wikispaces</a> tell me I can use </p>
  
  <pre><code>unlabeled.classAttribute().value((int) clsLabel);
  </code></pre>
  
  <p>After calling classifyInstance() to get the String representation of the class, this however seems to always return the empty string in my case.</p>
  
  <p>Using distributionForInstance() I'm able to successfully retrieve an array with eight double values between 0 and 1 (which is good, as I classify into eight query types). However, what is the order of this array? Is the first element in the result array the first class that occurs in my training file? Or is there some other predefined element order in this result array (e.g. alphabetically)? The <a href="http://weka.sourceforge.net/doc/weka/classifiers/Classifier.html#distributionForInstance%28weka.core.Instance%29" rel="nofollow">weka documentation</a> does not give any information on this.</p>
  
  <p>I hope someone will be able to help me out!</p>