简体   繁体   中英

how to calculate confidence from weka API?

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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM