Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WEKA: how to get the score from classifyInstance?

Tags:

weka

I'm using a FilteredClassifier.classifyInstance() to classify my instances in weka.

I have 2 classes (true and false) and I have many positives, so I actually need to know the score of each isntance to get the best positive.

You know how I could get the score from my weka classifier ?

thanks

Update: I've also tried to use distributionForInstance, but for each instance I always get an array with [1.0, 0.0].

I actually need to compare several instances to see which one is the most reliable, which one has more changes to have been classified correctly.

like image 830
user680406 Avatar asked Apr 06 '11 08:04

user680406


3 Answers

distributionForInstance(Instance anInstance) is the method you need. It gives you a Double array showing the confidence for each of your classes. I am using Weka 3.6. and it works well for me. If you always get the same values, your classifier is not trained well and not discriminative at all. In that case, you should always get the same class predicted. Did you balance your training set?

like image 131
Kerstin Avatar answered Nov 05 '22 09:11

Kerstin


distributionForInstance(Instance anInstance) seems right.

Maybe it is not working for you because the classifier doesn't know you'd need the confidence values? For example for LibSVM on Weka Java, you need to set setProbabilityEstimates to true, in order to use the scores.

like image 27
chet Avatar answered Nov 05 '22 09:11

chet


After you have run the classifier on your data, you can visualize the data by right clicking on the test in the " Result list " There are lots of other funcitons on this right click menu that will allow you to gain scores from weka classifiers.

like image 2
Tom Avatar answered Nov 05 '22 11:11

Tom