Confusion matrix also known as error matrix, is the technique for summarising the prediction results of a classification algorithm in machine learning. The matrix table presents the number of correct and incorrect prediction values which helps evaluate the performance of a classification model.
Mostly used for binary classification problems, this serves as an important tool in understanding algorithm/model’s performance in terms of accuracy.
A binary(Yes/No) outcome classification example
- Label e.g Pregnancy Test or Spam Email
- Prediction value — Yes/No
The four types of prediction mistakes or errors a Classifier model might make -
- True label is Positive, Prediction value is Positive = True Positive
- True label is Negative, Prediction value is Negative = True Negative
- True label is Positive, Prediction value is Negative = False Negative = or saying pregnant is non-pregnant
- True label is Negative, Prediction value is Positive = False Positive = or saying that non-pregnant is pregnant
Both false positives and false negatives can have different impacts — Food for thought kind of example from medical world -
e.g. False negative, there is a patient with a life-threatening disease but it didn’t get detected as the classifier predicted it as Negative so it could go untreated.
e.g. False Positive, the patient doesn’t have the disease. But the prediction classified it as positive and the patient can potentially get treated for the disease.