In CBSE Class 10 AI (Code 417) Part B, four formulas evaluate classification models from TP, TN, FP, and FN: Accuracy = (TP + TN) / Total, Precision = TP / (TP + FP), Recall = TP / (TP + FN), and F1 Score = 2 * Precision * Recall / (Precision + Recall). Accuracy tracks overall correctness, Precision checks reliability of positive predictions, Recall measures actual positives captured, and F1 balances both via their harmonic mean.
- 1. Exact Formulas for Accuracy, Precision, Recall, and F1
- 2. Step-by-Step Board Numerical: Flood Early-Warning Model
- 3. Writing Full-Mark Answers in CBSE Code 417 & 843
- 4. Calculate Accuracy, Precision, Recall, and F1 Score
- 5. Worked Numericals Using TP=30, TN=60, FP=10, FN=20 (Total=120)
- 6. Common Mistakes & Top Scorer Tips
- 7. Interactive Concept Check Quiz
- 8. Frequently Asked Questions
1. Exact Formulas for Accuracy, Precision, Recall, and F1
Every metric in CBSE Code 417 Unit 7 uses a ratio derived directly from the four confusion matrix counts. Accuracy divides all correct predictions (TP + TN) by the total sample size (TP + TN + FP + FN). However, Accuracy fails on imbalanced datasets—for instance, if 95 of 100 transactions are genuine, a dumb model predicting 'Genuine' every time achieves 95% Accuracy while catching zero frauds. That is why Precision and Recall are required. Precision uses predicted positives (TP + FP) as its denominator, answering: when the model says Yes, how often is it right? Recall uses actual positives (TP + FN) as its denominator, answering: out of all real Yes cases, how many did the model find? Finally, F1 Score computes the harmonic mean of Precision and Recall, staying high only when both metrics are strong.
- Accuracy denominator = TP + TN + FP + FN (all evaluated samples).
- Precision denominator = TP + FP (total positive predictions made).
- Recall denominator = TP + FN (total actual positive cases in reality).
- F1 Score = 2 * (P * R) / (P + R), always lying between min(P, R) and max(P, R).
2. Step-by-Step Board Numerical: Flood Early-Warning Model
Let us solve a full 4-mark Part B board numerical for an AI flood-warning system tested across 120 monsoon days, where TP = 30, FP = 10, FN = 20, and TN = 60. First, find the total days: 30 + 10 + 20 + 60 = 120. Next, compute Accuracy = (30 + 60) / 120 = 90 / 120 = 0.75 (or 75%). Now compute Precision = 30 / (30 + 10) = 30 / 40 = 0.75 (75%). Then compute Recall = 30 / (30 + 20) = 30 / 50 = 0.60 (60%). Finally, substitute Precision = 0.75 and Recall = 0.60 into F1 Score: 2 * 0.75 * 0.60 / (0.75 + 0.60) = 0.90 / 1.35 = 0.667 (66.7%). Notice that F1 (0.667) is lower than the simple average (0.675) because the harmonic mean penalizes uneven scores.
- Always convert Precision and Recall to decimals (0 to 1) before plugging into F1.
- If you use percentages (75 and 60), remember the F1 numerator gives 2*75*60 = 9000, divided by 135 = 66.67%.
- Round final answers to two or three decimal places unless the paper specifies otherwise.
3. Writing Full-Mark Answers in CBSE Code 417 & 843
Under the CBSE curriculum split—Part A (10 marks), Part B (40 marks), and Practical (50 marks)—numericals on Accuracy, Precision, Recall, and F1 carry deterministic marks in Part B if you show every formula before substituting numbers. A frequent error in student scripts is mixing decimal Precision with percentage Recall inside the F1 formula, or computing Recall with FP in the denominator. Another subtle edge case appears in Code 843 Python practicals when TP + FP = 0 or Precision + Recall = 0: dividing by zero raises a ZeroDivisionError unless guarded by an if check (scikit-learn's zero_division=0 handles this safely). Writing the fraction, simplified decimal, and percentage together makes your board sheet unambiguous for examiners.
- Write the symbolic formula first (1 mark), then substitute values, then state the final value.
- Keep both Precision and Recall on the same scale (either 0–1 decimals or 0–100%).
- Guard against division by zero in Python evaluation scripts for the 50-mark Practical.
4. Calculate Accuracy, Precision, Recall, and F1 Score
def evaluate_metrics(tp, tn, fp, fn):
total = tp + tn + fp + fn
accuracy = (tp + tn) / total if total else 0.0
precision = tp / (tp + fp) if (tp + fp) else 0.0
recall = tp / (tp + fn) if (tp + fn) else 0.0
f1 = (2 * precision * recall / (precision + recall)) if (precision + recall) else 0.0
return accuracy, precision, recall, f1
acc, prec, rec, f1 = evaluate_metrics(tp=30, tn=60, fp=10, fn=20)
print(f"Accuracy={acc:.3f}, Precision={prec:.3f}, Recall={rec:.3f}, F1={f1:.3f}")
Verified Console / Dry-Run Output:
Accuracy=0.750, Precision=0.750, Recall=0.600, F1=0.667
5. Worked Numericals Using TP=30, TN=60, FP=10, FN=20 (Total=120)
| Metric | Formula | Substitution | Result (Decimal & %) |
|---|---|---|---|
| Accuracy | (TP + TN) / (TP + TN + FP + FN) | (30 + 60) / 120 | 0.750 (75.0%) |
| Precision | TP / (TP + FP) | 30 / (30 + 10) | 0.750 (75.0%) |
| Recall (Sensitivity) | TP / (TP + FN) | 30 / (30 + 20) | 0.600 (60.0%) |
| F1 Score | 2 * P * R / (P + R) | 2 * 0.75 * 0.60 / (0.75 + 0.60) | 0.667 (66.7%) |
Crack CBSE 417 Evaluation Numericals
Work through timed Part B numericals and live Python scoring scripts with 4Achievers Junior in 1-on-1 or 1:4 Micro-Pods.
6. Common Mistakes & Top Scorer Tips
- Avoid Mistake: Using FP in the Recall denominator instead of FN (confusing Precision and Recall formulas).
- Avoid Mistake: Computing F1 as the arithmetic average (P + R) / 2 instead of the harmonic mean 2PR / (P + R).
- Avoid Mistake: Mixing a decimal (0.75) and a percentage (60) inside the same F1 calculation.
- Examiner / Mentor Tip: Remember 'P for Predicted': Precision's denominator (TP + FP) sums everything the model Predicted Positive.
- Examiner / Mentor Tip: Remember 'R for Reality': Recall's denominator (TP + FN) sums everything that is Positive in Reality.
- Examiner / Mentor Tip: If Precision equals Recall (both 0.80), F1 Score automatically equals that same value (0.80).
7. Interactive Concept Check Quiz
Question: A model has TP = 40, FP = 10, FN = 10, and TN = 40. What is its F1 Score?
8. Frequently Asked Questions
Why is F1 Score a harmonic mean instead of a simple arithmetic mean?
Can Accuracy be high while F1 Score is terrible?
In CBSE Class 10 Code 417, should F1 Score be reported as a decimal or percentage?
Explore Related Lessons & Free Interactive Tools
- All 60 Guides in CBSE AI (417 & 843) Guide Hub
- Why Precision vs Recall Matters: Medical Diagnosis vs Spam Filters
- Overfitting, Underfitting & Train-Test Split in CBSE AI
- Computer Vision Basics: Pixels, Resolution, Grayscale & RGB
- Interactive Tool: CBSE AI 417 Confusion Matrix & F1 Score Calculator
- Interactive Tool: CBSE Class 10 Best-of-5 Marks Replacement Calculator
