how to calculate confidence from weka API?

非 Y 不嫁゛ 提交于 2019-12-01 08:32:04

问题


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:


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



来源:https://stackoverflow.com/questions/21902473/how-to-calculate-confidence-from-weka-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!