A confusion matrix describes the performance of the classification model. In other words, confusion matrix is a way to summarize classifier performance. The following figure shows a basic representation of a confusion matrix:
It’s based on the fact that we need to compare the class predicted by the classifier with the actual class for each observation.
True Negative: The predicted class is negative and coincides with the actual case, which is negative too. In the example, we predicted the class 0 and the actual class of that observation is 0! This is a correct prediction.
True Positives: The predicted class is the same as the actual class. In the example, the predicted value is 1 and coincides with the actual class of that particular observation.
False Negatives: the predicted class is negative but doesn’t coincide with the actual class, which is instead positive. In the example, the predicted value is 0, but the actual class of that observation is 1! So, the prediction is wrong.
False Positives: The predicted class is positive, but the actual class is negative. In the example, the predicted class is 1 and the actual class of that observation is 0. The prediction is again wrong!
If the predicted val and the actual value are the same, it is True, else FalseIf the predicted val is 1, it is Positive, else Negative
Confusion Matrix
A confusion matrix describes the performance of the classification model. In other words, confusion matrix is a way to summarize classifier performance. The following figure shows a basic representation of a confusion matrix:
It’s based on the fact that we need to compare the class predicted by the classifier with the actual class for each observation.
If the predicted val and the actual value are the same, it is
True
, elseFalse
If the predicted val is 1, it isPositive
, elseNegative