A machine learning model is outputting precision and recall for a two-class classification problem (0 and 1) like this:
Confusion matrix:
[[136 21]
41 6]]
Precision: [0.768 0.128]
Recall: [0.866 0.222]
Accuracy: 0.696
There are two measures for both precision and recall: The first measure for the 0 class and the second for 1 class. Is it okay to take the average of these? E.g. precision as a whole is 0.768+0.128 / 2 = 0.448
? And similarly with recall?
Best Answer
WARNING: Average of precision/recall is totally different concept from Average Precision(AP) link.
Based on the question, we will talk about the Average of precision and recall.
you are partially correct; if
Then precision for each class(row) is ( Mi,i / sigma(j) Mji), So for:
for recall, the same happens, but the denominator will be on rows, i.e. ( Mi,i / sigma(j) Mij)
Then you can average on each group to have overall precision/recall.
Check Table III of this paper (referred to as Precision_M and recall_M):
More precisely, you are doing macro-averaging.
in code, you can have :
Readmore