I've built a RandomSubSpace classifier in weka exploer and am now attemping to use it with the weka Java API, however, when I run distibutionForInstance() I am getting an array with 1.0 as the first value and 0.0 as all the rest. I am trying to get the numerical prediction not the class. Is there a different function I should be using or a different option on distributionForInstance? Code Snippet below:
Classifier cls = (Classifier) weka.core.SerializationHelper.read("2015-09-6 Random Subspace Model.model");
Instances originalTrain = new DataSource("Instances.arff").getDataSet();
int cIdx=originalTrain.numAttributes()-1;
originalTrain.setClassIndex(cIdx);
int s1=1;
double value=cls.classifyInstance(originalTrain.instance(s1));
double[] percentage=cls.distributionForInstance(originalTrain.instance(s1));
System.out.println("The predicted value of instance "+Integer.toString(s1) +"Value: " + percentage[1]);
System.out.println(Arrays.toString(percentage));
This gives me output that looks like this: The predicted value of instance 1Value: 0.0 [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
Does anyone know how to get the numerical output like I get in weka explorer?
Thanks in advance.