Precision tells us how many, out of all instances that were predicted to belong to class , actually belonged to class . The precision for class is calculated as:
= the number of true positives for class .
= the number of false positives for class .
Recall expresses how many instances of class were predicted correctly. The recall is calculated as:
= the number of true positives for class .
= the number of false negatives for class .
Suppose that we have the following confusion matrix:
Binary classification problems often focus on the positive class; therefore, precision and recall are calculated for the positive class.
Precision
The precision is equal to:
This shows that of the records that were classified as positive were actually positive.
Recall
The recall is equal to:
This shows that of the positive instances were classified as positive.