Classification-Evaluation Measures
π Classification Performance Measures
π§ Problem Setup
Let:
- → Testing dataset containing data points
- Each point lies in a -dimensional space
- → Set of class labels
- → Classification model (classifier)
π For each data point
- → True class label
- → Predicted class label
π― Classification Accuracy and Its Limitations
✅ Classification Accuracy
πΉ Definition
Classification accuracy is the ratio of correctly predicted instances to the total number of instances.
π Formula
π Percentage Form
⚠️ Misclassification Rate (Error Rate)
Accuracy can be converted into error rate by taking its complement.
π Formula
π Interpretation
- High accuracy → Model makes more correct predictions
- Low error rate → Model makes fewer mistakes
π Key Insight
π― Summary
| Measure | Meaning |
|---|---|
| Accuracy | Proportion of correct predictions |
| Error Rate | Proportion of incorrect predictions |
π§ Why Evaluation Measures Matter
In classification, accuracy alone is often misleading, especially when:
- Classes are imbalanced
- Costs of errors differ
- We care about specific types of mistakes
π Evaluation measures help us understand how well a model performs in different aspects.
π Limitations of Classification Accuracy
Classification accuracy is a good starting point for evaluating a model, but it often fails in practical scenarios.
⚠️ Main Problem
The key issue with accuracy is that:
It hides important details needed to properly understand model performance.
π Situations Where Accuracy Fails
1. Multi-Class Classification Problem
When your dataset has more than two classes:
- You might get an accuracy of 80%
-
But this does not tell you:
- Whether all classes are predicted equally well
- Or if the model is ignoring some classes
π Example issue:
- Model performs well on 2 classes
- Performs poorly on 1 class
- Overall accuracy still looks high
2. Imbalanced Dataset Problem
When class distribution is uneven:
-
Example:
- 90% of data belongs to one class
- 10% belongs to another
πΉ What happens?
- Model predicts only the majority class
- Achieves 90% accuracy
π But:
- Model is useless for detecting the minority class
π― Key Insight
High accuracy does not necessarily mean a good model.
π§ Why Accuracy is Misleading
- Does not show class-wise performance
- Does not distinguish between types of errors
- Ignores data imbalance
π Solution: Confusion Matrix
To overcome these limitations, we use:
Confusion Matrix
✅ What it provides:
-
Detailed breakdown of predictions:
- True Positives (TP)
- False Positives (FP)
- False Negatives (FN)
- True Negatives (TN)
π― Benefit
-
Helps analyze:
- Which classes are misclassified
- Type of errors made by the model
- Performance per class
πConfusion Matrix (Foundation)
For binary classification, everything starts with the confusion matrix:
| Predicted Negative | Predicted Positive | |
|---|---|---|
| Actual Negative | TN (True Negative) | FP (False Positive) |
| Actual Positives | FN (False Negative) | TP (True Positive) |
π Meaning
- TP → correctly predicted positives
- TN → correctly predicted negatives
- FP → false alarms
- FN → missed positives
π― Accuracy
π Formula
✅ Interpretation
- Overall correctness of the model
⚠️ Limitation
- Misleading for imbalanced datasets
π Example:
- 95% negative data → predicting all negative gives 95% accuracy
πError Rate
πΉ Definition
Error rate is the proportion of incorrect predictions made by a classification model.
It measures how often the model is wrong.
π Formula
Using confusion matrix:
π Relation to Accuracy
π Therefore:
π Precision
π Formula
✅ Interpretation
Of all predicted positives, how many are actually correct?
π― Use When:
- False positives are costly
- Example: spam detection
π Recall (Sensitivity / True Positive Rate)
π Formula
✅ Interpretation
Of all actual positives, how many did we detect?
π― Use When:
- Missing positives is costly
- Example: disease detection
⚖️Precision vs Recall Tradeoff
- Increasing precision → may reduce recall
- Increasing recall → may reduce precision
π Controlled via decision threshold
π―F1 Score
π Formula
✅ Interpretation
- Harmonic mean of precision and recall
- Balances both metrics
π― Use When:
- Need balance between precision and recall
- Imbalanced datasets
π Specificity (True Negative Rate)
π Formula
✅ Interpretation
Ability to correctly identify negatives
πIntuitive Examples
Medical Diagnosis
-
Focus: Recall
π Missing a disease is dangerous
Spam Detection
-
Focus: Precision
π Avoid marking real emails as spam
π Significance in Machine Learning
Evaluation metrics help:
- Compare models objectively
- Tune hyperparameters
- Detect overfitting
- Align model with real-world goals
π― Key Takeaways
- No single metric is sufficient
- Choice depends on problem context
- Confusion matrix is fundamental
- Precision–Recall tradeoff is critical
- Use multiple metrics for robust evaluation
Comments
Post a Comment