Student Performance Prediction · Phase 4 · Lesson 1 of 3
Final Test Evaluation and the Confusion Matrix
Run the chosen model once on the test set, read the confusion matrix, and explain precision, recall and accuracy in plain language for the school.
What you need
A computer with a web browser and a free Google account for Google Colab, or Python with Jupyter installed locally. Libraries: pandas, scikit-learn and matplotlib (all free).
In this lesson you will
- Interpret a confusion matrix
- Explain evaluation results in plain language
Key concepts
test setconfusion matrixtrue positiveprecisionrecallaccuracy
The lesson
The test set is used once, at the end. Running it repeatedly while making changes turns it into training data and overstates performance.
The confusion matrix counts true positives (flagged and needed support), false positives, false negatives and true negatives. Precision is the share of flagged students who needed support; recall is the share of students needing support who were flagged.
Accuracy can mislead: if 80% of students pass, a model that flags nobody is 80% accurate and useless. The worked example shows this.
Step by step
- Predict the test set once with the fixed threshold.
- Build the confusion matrix.
- Calculate precision, recall and accuracy, and the baseline's figures.
- Write a plain-language paragraph for the school.
Reading the final confusion matrix for 200 test students
Precision, recall and accuracy for the chosen model, compared with a model that flags nobody.
| Item | Working | Amount |
|---|---|---|
| True positives | flagged and actually needed support | 30 |
| False positives | flagged but did not need support | 20 |
| False negatives | needed support but not flagged | 10 |
| True negatives | not flagged and did not need support | 140 |
| Precision | 30 ÷ (30 + 20) | 60% |
| Recall | 30 ÷ (30 + 10) | 75% |
| Accuracy (model / flag nobody) | (30 + 140) ÷ 200 / 160 ÷ 200 | 85% / 80% |
Explanation
The model finds three out of four students who need support (recall 75%), and three in five of the students it flags really need help (precision 60%).
Flagging nobody is already 80% accurate because most students pass, so accuracy alone hides how useful the model is. The 10 missed students are the main concern for the school.
Check your understanding
30 + 20 + 10 + 140 = 200 students; 40 needed support (30 + 10).
Practice activity
Produce the final evaluation: confusion matrix, measures, comparison with the baseline and a plain-language summary.
Expected result: Honest final results and a summary a head teacher can understand.
Common mistakes
- Re-running the test after changes and reporting the best result
- Reporting accuracy alone
Check your understanding
-
What does recall mean in this project?
Show answer
The share of students who needed support that the model flagged.
-
Why can accuracy be misleading here?
Show answer
Because a model that flags nobody can still score high accuracy when most students pass.
Further learning
Projects are instructor-guided: an instructor sets milestones, checks your work and gives feedback, online or in person. Self-study of the public lessons does not lead to a certificate. Enrolment and fees follow the Academy's existing policies — contact the Academy.