i want to make a single test for single instance
i use j48 in FilteredClassifier like this:
Remove rm = new Remove();
rm.setAttributeIndices("1"); // remove 1st attribute
// classifier
J48 j48 = new J48();
j48.setUnpruned(true); // using an unpruned J48
// meta-classifier
FilteredClassifier fc_J48 = new FilteredClassifier();
fc_J48.setFilter(rm);
fc_J48.setClassifier(j48);
tdta.dataSet.setClassIndex(tdta.dataSet.numAttributes() - 1);
fc_J48.buildClassifier(tdta.dataSet);
now, i try those options:
j48.classifyInstance(dataSet.instance(1))
or
eval.evaluateModelOnce(j48, dataSet.instance(1))
i think it's will be the same result.
my question is: when i get the double number, how can i translate it to the class name ?
Try this:
Take a look at: http://weka.8497.n7.nabble.com/Predicting-in-java-td27363.html
}
test
istestInstances
, so if you have a single instance you can replacetest.instance(i)
with your instance.