Confusion Matrix and Performance Evaluation Metrics
Confusion Matrix and Performance Evaluation Metrics
There are four quadrants in the confusion matrix, which are symbolized as
below.
True Positive (TP: f++) : The number of instances that were positive (+) and
correctly classified as positive (+).
False Negative (FN: f+-): The number of instances that were positive (+) and
incorrectly classified as negative (-).
False Positive (FP: f-+): The number of instances that were negative (-) and
incorrectly classified as (+).
True Negative (TN: f--): The number of instances that were negative (-)
and correctly classified as (-).
Confusion Matrix
3
Note:
Np = TP (f++) + FN (f+-)
= is the total number of positive instances.
Nn = FP(f-+) + Tn(f--)
= is the total number of negative instances.
N = Np + Nn
= is the total number of instances.
For example,
Class + -
+ 52 (TP) 18 (FN)
- 21 (FP) 123 (TN)
In our discussion, we shall make the assumptions that there are only two
classes: + (positive) and – (negative)
Note
F1 represents the harmonic mean between recall and precision
When every instance is correctly classified, it is called the perfect classifier. In this case,
TP = P, TN = N and CM is
Predicted Class
TPR = TP/(TP+FN)= =1 + -
+ P 0
FPR = =0
Actual
class
Precision = = 1 - 0 N
F1 Score = = 1
Accuracy = = 1
Analysis with Performance Measurement Metrics
11
Case 2: Worst Classifier
When every instance is wrongly classified, it is called the worst classifier. In this
case, TP = 0, TN = 0 and the CM is
Predicted Class
+ -
TPR = =0
+ 0 P
Actual
FPR = = 1
class
- N 0
Precision = = 0
F1 Score = Not applicable
as Recall + Precision = 0
Accuracy = =0
Analysis with Performance Measurement Metrics
12
Case 3: Ultra-Liberal Classifier
The classifier always predicts the + class correctly. Here, the False Negative
(FN) and True Negative (TN) are zero. The CM is
Predicted Class
+ -
TPR = = 1
+ P 0
Actual
FPR = = 1
class
- N 0
Precision =
F1 Score =
Accuracy = =0
Analysis with Performance Measurement Metrics
13
Case 4: Ultra-Conservative Classifier
This classifier always predicts the - class correctly. Here, the False Negative
(FN) and True Negative (TN) are zero. The CM is
Predicted Class
+ -
TPR = = 0
+ 0 p
Actual
FPR = = 0
class
- 0 N
Precision =
(as TP + FP = 0)
F1 Score =
Accuracy = =0