melisgl / mgl

Common Lisp machine learning library.
MIT License
585 stars 39 forks source link

Confusion matrix accuracy, precision, and recall are wrong #7

Closed bmansurov closed 4 years ago

bmansurov commented 4 years ago

When the test function of a confusion matrix is 'equal, calculation of precision, recall, and accuracy falls apart.

A simple test case below:

(mgl:measure-confusion
 '("a" "b" "c" "a" "b" "a")
 '("a" "b" "c" "a" "b" "a")
 :test 'equal)

And the output is:

=> #<MGL-CORE:CONFUSION-MATRIX 
         |  a|  b|  c|Recall
        a|  3|  0|  0| 0.00%
        b|  0|  2|  0| 0.00%
        c|  0|  0|  1| 0.00%
Precision|NIL|NIL|NIL|      
Accuracy: 0.00%>

Expected: Everything (accuracy, precision, and recall) should be 100% in the above matrix.

melisgl commented 4 years ago

Thank you. Fixed in 7c44fe86e82d28889f9d8e57cdd6e06dd5767ff3.