Original article was published on Artificial Intelligence on Medium
Understanding the working of Confusion Matrix
Let us now understand how the confusion matrix helps us to evaluate the performance of a model on a 2X2 binary classification.
For example, Let’s say we want to predict whether a person is suffering from a Diabetes or Not which is clearly a binary classification(0/1 or Yes/No).
The rows represent the Predicted Values our model is predicting.
The columns represent the Actual Values that we know beforehand.
The primary diagonal, i.e, the cells (1, 1) and (2, 2) represents the values that are predicted correctly by our model.
While all the other cells represent values that are incorrectly predicted by our model.
Let’s have a more in-depth understanding about each cell we are dealt with.
The cell (1, 1) represents that our model is classifying a person to be diabetic and he/she is actually diabetic. This is also known as True Positive.
The cell (2, 2) represents that our model is classifying a person to be NOT diabetic and he/she is actually NOT diabetic. This is also known as True Negative.
The cell (1, 2) represents that our model is classifying a person to be diabetic and he/she is actually NOT diabetic. This is also known as False Positive.
The cell (2, 1) represents that our model is classifying a person to be NOT diabetic and he/she is actually diabetic. This is also known as False Negative.
False Positive is also known as Type 1 Error.
Similarly, False Negative is also known as Type II Error.
Ideally, in our Machine Learning model the number of Type I Error and Type II error should be as low as possible.
It becomes even more important based on certain situations and fields such as the Medicinal Field and problem statements such as Breast Cancer Detection. Just imagine the situation if we say someone does NOT have cancer when he/she actually has. 😲
From the above Confusion Matrix we could also calculate some advanced metrics to evaluate our model and understand our model even further. Some of these are enlisted below:
1. Specificity and Sensitivity
2. Precision and Recall
I may update this post and briefly explain the above metrics in the near future.