Learning Weka - Precision and Recall - Wiki example to .Arff file -


i'm new weka , advanced statistics, starting scratch understand weka measures. i've done @rushdi-shams examples, great resources.

on wikipedia http://en.wikipedia.org/wiki/precision_and_recall examples explains simple example video software recognition of 7 dogs detection in group of 9 real dogs , cats. understand example, , recall calculation. first step, let see in weka how reproduce data. how create such .arff file? file have wrong confusion matrix, , wrong accuracy class recall not 1, should 4/9 (0.4444)

@relation 'dogs , cat detection'  @attribute              'realanimal'      {dog,cat} @attribute              'detected'        {dog,cat} @attribute              'class'           {correct,wrong}  @data dog,dog,correct dog,dog,correct dog,dog,correct dog,dog,correct cat,dog,wrong cat,dog,wrong cat,dog,wrong dog,?,? dog,?,? dog,?,? dog,?,? dog,?,? cat,?,? cat,?,? 

output weka (without filters)

=== run information ===

scheme:weka.classifiers.rules.zeror  relation:     dogs , cat detection instances:    14 attributes:   3           realanimal           detected           class test mode:10-fold cross-validation  === classifier model (full training set) ===  zeror predicts class value: correct  time taken build model: 0 seconds  === stratified cross-validation === === summary ===  correctly classified instances           4               57.1429 % incorrectly classified instances         3               42.8571 % kappa statistic                          0      mean absolute error                      0.5    root mean squared error                  0.5044 relative absolute error                100      % root relative squared error            100      % total number of instances                7      ignored class unknown instances          7       === detailed accuracy class ===             tp rate   fp rate   precision   recall  f-measure   roc area  class              1         1          0.571     1         0.727      0.65     correct              0         0          0         0         0          0.136    wrong weighted avg.    0.571     0.571      0.327     0.571     0.416      0.43   === confusion matrix ===   b   <-- classified  4 0 | = correct  3 0 | b = wrong 

there must wrong false negative dogs, or arff approach totally wrong , need kind of attributes?

thanks

lets start basic definition of precision , recall.

precision = tp/(tp+fp) recall = tp/(tp+fn) 

where tp true positive, fp false positive, , fn false negative.

in above dog.arff file, weka took account first 7 tuples, ignored remaining 7. can seen above output has classified 7 tuples correct(4 correct tuples + 3 wrong tuples).

lets calculate precision correct , wrong class. first correct class:

prec = 4/(4+3) = 0.571428571 recall = 4/(4+0) = 1. 

for wrong class:

prec = 0/(0+0)= 0 recall =0/(0+3) = 0 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -