2
votes

I am using the weka java API, I can get the predicted class label after training on the training set.

double pred = fc.classifyInstance(test.instance(i));

But I want to know the confidence probability of the class label, what function should I use ? In the GUI I can select the output prediction to a txt file and can get the probability easily, but I want to know how to get through the code. I am using J48() classifier.

1

1 Answers

0
votes

weka.classifiers.Classifier.distributionForInstance(Instance)

Predicts the class memberships for a given instance. If an instance is unclassified, the returned array elements must be all zero. If the class is numeric, the array must consist of only one element, which contains the predicted value. Note that a classifier MUST implement either this or classifyInstance().

(source: JavaDoc).