Numerical Problems- Classification Measures
Example:
Consider a Bayes classifier, which miss classifies 8 out of 30 test cases .Then find the accuracy and error rate.
๐ง Given
- Total test cases = 30
- Misclassified cases = 8
๐น Step 1: Correct Predictions
๐น Step 2: Compute Accuracy
๐ Accuracy = 0.733 (or 73.3%)
๐น Step 3: Compute Error Rate
๐ Error Rate = 0.267 (or 26.7%)
๐ฏ Final Answer
| Measure | Value |
|---|---|
| Accuracy | 0.733 (73.3%) |
| Error Rate | 0.267 (26.7%) |
๐ Key Insight
Example:
Imagine an application that is developed to recognize cats and dogs. This identifies eight dogs in a picture containing 12 dogs and some cats. Of the eight dogs identified, five actually are dogs while the rest are cats. Compute the True Positive, False Positive and False Negative values.
๐ Confusion Matrix
๐ง Recall from the problem:
- TP = 5 (dogs correctly identified)
- FP = 3 (cats identified as dogs)
- FN = 7 (dogs missed)
We are not given total number of cats, so TN cannot be determined.
๐ Matrix Representation
| Predicted Dog | Predicted Cat | |
|---|---|---|
| Actual Dog | TP = 5 | FN = 7 |
| Actual Cat | FP = 3 | TN = ? |
Example:
For a classifier, the confusion matrix is given.What is the precision, recall and accuracy of that classifier?
๐ Performance Metrics from Confusion Matrix
Given:
- TP = 9, FP = 1, FN = 9, TN = 5
-
Total samples
๐น 1. Precision (Positive Class)
๐ Precision (Positive) = 0.9
๐น 2. Precision (Negative Class)
๐ Precision (Negative) ≈ 0.357
๐น 3. Recall (Positive Class / Sensitivity / TPR)
๐ Recall (Positive) = 0.5
๐น 4. Recall (Negative Class / Specificity / TNR)
๐ Recall (Negative) ≈ 0.83
๐น 5. Accuracy
๐ Accuracy ≈ 0.583 (58.3%)
๐ Final Summary
| Metric | Value |
|---|---|
| Precision (Positive) | 0.90 |
| Precision (Negative) | 0.357 |
| Recall (Positive) | 0.50 |
| Recall (Negative) | 0.83 |
| Accuracy | 0.583 |
Example
๐ Confusion Matrix Interpretation
| Actual Spam | Actual Not Spam | |
|---|---|---|
| Predicted Spam | TP = 70 | FP = 30 |
| Predicted Not Spam | FN = 70 | TN = 330 |
๐ง 1. Precision (for Spam)
๐ Precision = 0.7 (70%)
๐ง 2. Recall (for Spam)
๐ Recall = 0.5 (50%)


Comments
Post a Comment