0% found this document useful (0 votes)
11 views8 pages

Understanding 2x2 Confusion Matrix

A confusion matrix is a tool for evaluating classification model performance by comparing predicted and actual labels. It consists of a 2x2 table for binary classification, detailing true positives, true negatives, false positives, and false negatives, and allows for the calculation of key metrics like accuracy, precision, recall, specificity, and F1-score. For multiclass problems, the confusion matrix expands to accommodate multiple classes, with rows for actual classes and columns for predicted classes.

Uploaded by

tiya Abid
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views8 pages

Understanding 2x2 Confusion Matrix

A confusion matrix is a tool for evaluating classification model performance by comparing predicted and actual labels. It consists of a 2x2 table for binary classification, detailing true positives, true negatives, false positives, and false negatives, and allows for the calculation of key metrics like accuracy, precision, recall, specificity, and F1-score. For multiclass problems, the confusion matrix expands to accommodate multiple classes, with rows for actual classes and columns for predicted classes.

Uploaded by

tiya Abid
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Confusion Matrix

Introduction to 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


to provide insight into the model's classification
performance.
Structure of a
Confusion Matrix
• For a binary classification problem, the
confusion matrix is a 2X2 table:

• True Positive (TP): The model correctly Actual/ Predicted Predicted


predicted a positive class. Predicted Positive Negative
False
• True Negative (TN): The model correctly Actual True Positive
Negative
predicted a negative class. Positive (TP)
(FN)
• False Positive (FP): The model True
Actual False Positive
incorrectly predicted positive (a "false Negative (FP)
Negative
alarm"). (TN)

• False Negative (FN): The model


incorrectly predicted negative (a
"miss")
Example Confusion
Matrix
• Consider a binary
classification problem where
Predicte Predicte
a model is tasked with Actual/
d d
Predicted
predicting whether a patient Positive Negative
has a disease. Actual
50 (TP) 10 (FN)
Positive
Actual
05 (FP) 35 (TN)
• TP = 50 Negative

• FN = 10
• FP = 05
• TN = 35
Key Metrics Derived from the Confusion
Matrix
• Accuracy: Measures the proportion of correct predictions out of the total
predictions.

• Precision (Positive Predictive Value): Measures the proportion of correctly


predicted positive cases out of all predicted positive cases.

• Recall (Sensitivity, True Positive Rate): Measures the proportion of actual


positives correctly identified.

• Specificity (True Negative Rate): Measures the proportion of actual negatives


correctly identified.

• F1-Score: Harmonic mean of precision and recall, useful for imbalanced datasets.
Comparison Table
Metric Use Case / Benefits Key Differences
Accuracy Measures overall correctness. Can be misleading for imbalanced
Useful when both classes are datasets (e.g., if one class
equally important. dominates).
Precision Useful when false positives are Focuses only on positive predictions,
costly (e.g., spam email detection). ignoring negatives. High precision
Focuses on positive predictions. may miss true positives.
Recall Useful when false negatives are Focuses only on actual positives,
costly (e.g., medical diagnoses). ignoring false positives. High recall
Focuses on actual positives. may result in more false positives.
Provides a balance between Does not consider true negatives,
precision and recall. Useful for unlike accuracy. Best used when
F1-Score
imbalanced datasets. precision and recall are equally
important.
Specificity Focuses on identifying true Does not consider positive
negatives. Useful when negatives predictions or false negatives.
are the majority class. Complements recall.
Key Points
[Link] to Use Accuracy:
1. Use when classes are balanced and misclassifications of either type (false positives or
false negatives) have similar costs.
[Link] to Use Precision:
1. Use when false positives are costly (e.g., predicting spam emails incorrectly,
classifying a non-cancerous patient as cancerous).
[Link] to Use Recall:
1. Use when false negatives are costly (e.g., missing actual cancer cases in medical
diagnoses).
[Link] to Use F1-Score:
1. Use for imbalanced datasets or when you need a trade-off between precision and
recall.
[Link] to Use Specificity:
1. Use when identifying true negatives is critical (e.g., screening out fraud in credit card
transactions).
Multiclass Confusion Matrix
• For multiclass classification problems, the confusion
matrix is extended to where is the number of classes.

• Each row represents the actual class, and each column


represents the predicted class.

You might also like