WEKA + Java: get probability class

Given the following binary classifier:

LibSVM classifier = new LibSVM();
classifier.setCost(cost);
classifier.setGamma(gamma);

      

performing the following operation returns a label for the instance:

double classId = classifier.classifyInstance(instance);

      

However, I would like to get the confidence level for this classification (i.e. the probability that the instance is in a positive class + the probability that the instance is in a negative class).

How can I get this information? Is it possible?

Thank.

+3


source to share


1 answer


Have you considered using SetProbabilityEstimates () , which sets a flag to generate probability estimates?



There is also another option, -B, in SetOptions () , which can help you generate these probability estimates.

+4


source







All Articles