title: Python weka wrapper: classify instances from another file
body: <p>I'm using <code>Ubuntu 15.10</code>, <code>Python 2.7</code>, and have the current install of the <code>python weka-wrapper</code> package.</p>
  
  <p>I'm doing the following: <strong>(1)</strong> Training a classifier based on data I load from a <code>.csv</code> file. <strong>(2)</strong> Loading a second set of data from another <code>.csv</code> file -- this data has the same header that designates features as was used to train the original classifier. <strong>(3)</strong> I'm attempting to use the trained classifier to  classify the data loaded from this second file -- what I really want, actually, is the probability of each instance conforming to a certain class (but that is an aside I will point out shortly)</p>
  
  <p>Here is my code that takes the trained classifier and (second) file name as input:</p>
  
  <pre><code> def classifyData(classifier,datFile):
  
      loader = Loader(classname="weka.core.converters.CSVLoader")
      data = loader.load_file(datFile)
      data.class_is_last()
  
      preds = []
      dists = []
  
      iCount = 0
      for inst in data:
             iCount+=1
             pred = classifier.classify_instance(inst)
             dist = classifier.distribution_for_instance(inst)
             preds.append(pred)
             dists.append(dists)
  
      return preds,dists
  </code></pre>
  
  <p><strong>Note:</strong> I should also note that the class variable (the last feature in the second data file) is designated with "?", representing data for which I do not have a label.</p>
  
  <p><strong>Quick aside question:</strong> Does the <code>dist</code> variable contain the probability of the class?  If not, how would I get this information?</p>
  
  <p>Running this function produces the following error:</p>
  
  <pre><code> Exception in thread "Thread-0" java.lang.ArrayIndexOutOfBoundsException: 1
  at weka.classifiers.meta.Bagging.distributionForInstance(Bagging.java:816)
  at weka.classifiers.AbstractClassifier.classifyInstance(AbstractClassifier.java:173)
   Traceback (most recent call last):
   File "parsFunc.py", line 33, in main
  initProb = classifyData(classifTrain,ttDir+"temp.csv")
   File "parsFunc.py", line 136, in classifyData
  pred = classifier.classify_instance(inst)
   File "/usr/local/lib/python2.7/dist-packages/weka/classifiers.py", line 105, in classify_instance
  return self.__classify(inst.jobject)
   File "/usr/local/lib/python2.7/dist-packages/javabridge/jutil.py", line 852, in fn
  raise JavaException(x)
   javabridge.jutil.JavaException: 1
  </code></pre>
  
  <p>Not exactly what's going wrong here. I know there are the same number of instances in the second file as was used to train the model and that the header is the same.  Any help would be appreciated!</p>