Orange Forum • View topic - What do those results mean?

What do those results mean?

A place to ask questions about methods in Orange and how they are used and other general support.

What do those results mean?

Postby re832003 » Tue May 21, 2013 7:12

Here is my code for SVM:

I'd like to know (1) whether my code is correct and (2) what the results I get mean: are they the precision, recall and F1 for a specific class or an average over all classes (btw: I only have two classes 0 & 1). I get completely different results with the widgets.

Code: Select all
import Orange
import Orange.evaluation.scoring
from Orange.classification import svm

learners = [svm.LinearSVMLearner(name="L_SVM")]

file_name = "mod_immediate.tab"
data = Orange.data.Table(file_name)     # calling data

res = Orange.evaluation.testing.cross_validation(learners, data, folds=10) # training procedure

for c in data.domain.class_var.values: # perl class evaluation results
    cm = Orange.evaluation.scoring.confusion_matrices(res,

data.domain.class_var.values.index(c))       #confusion matrix per class
    accuracy = Orange.evaluation.scoring.CA(cm)[0]
    precision = Orange.evaluation.scoring.Precision(cm)[0] # percision per class
    recall = Orange.evaluation.scoring.Recall(cm)[0]       # recall per class
    f1 = Orange.evaluation.scoring.F1(cm)[0]               # F1 per class
   
cm = Orange.evaluation.scoring.confusion_matrices(res)[0]       # cofusition matrix of the first learner

Accuracy = Orange.evaluation.scoring.CA(cm)
Precision = Orange.evaluation.scoring.Precision(cm)
Recall = Orange.evaluation.scoring.Recall(cm)
F_measure = Orange.evaluation.scoring.F1(cm)

print "--------------------------"
print "Results for", file_name
print "--------------------------"
print "Accuracy", '\t', Accuracy
print "Precision", '\t',Precision
print "Recall", '\t','\t',Recall
print "F_measure", '\t',F_measure


Re: What do those results mean?

Postby Ales » Thu May 23, 2013 10:36

re832003 wrote:I'd like to know (1) whether my code is correct

Seems correct (at least for binary classes)

re832003 wrote:what the results I get mean: are they the precision, recall and F1 for a specific class or an average over all classes

They are for a specific class.

re832003 wrote:I get completely different results with the widgets.

Can you provide some more information about how you tested this?

Note that the 'LinearSVMLearner' learner is not the same as the 'SVMLearner' with the linear kernel as produced by the 'SVM' widget.


Return to Questions & Support



cron