What Confusion Matrix Meaning, Applications & Example
Table showing correct and incorrect predictions for classification tasks.
What is a Confusion Matrix?
A Confusion Matrix is a table used to evaluate the performance of a classification model . It compares the predicted labels with the actual labels, showing how well the model is performing by detailing the true positives, false positives, true negatives, and false negatives.
Components of a Confusion Matrix
- True Positives (TP): Correctly predicted positive instances.
- False Positives (FP): Incorrectly predicted as positive.
- True Negatives (TN): Correctly predicted negative instances.
- False Negatives (FN): Incorrectly predicted as negative.
Applications of a Confusion Matrix
- Model Evaluation : Helps to understand the types of errors a model makes, guiding improvements.
- Classification Metrics: From the confusion matrix, metrics like accuracy, precision , recall , and F1 score can be derived.
- Medical Diagnosis: Assesses how well a model predicts diseases by comparing predicted vs. actual outcomes.
Example of a Confusion Matrix
In email spam detection, the confusion matrix shows how well the model identifies spam emails:
- TP: Correctly identifies spam.
- FP: Marks a non-spam email as spam.
- TN: Correctly identifies non-spam.
- FN: Marks a spam email as non-spam.