Student Performance Prediction · Project

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

  1. Predict the test set once with the fixed threshold.
  2. Build the confusion matrix.
  3. Calculate precision, recall and accuracy, and the baseline's figures.
  4. Write a plain-language paragraph for the school.
Worked calculation

Reading the final confusion matrix for 200 test students

Precision, recall and accuracy for the chosen model, compared with a model that flags nobody.

Test set of 200 synthetic students; 40 actually scored below 50% (illustrative figures)
ItemWorkingAmount
True positivesflagged and actually needed support30
False positivesflagged but did not need support20
False negativesneeded support but not flagged10
True negativesnot flagged and did not need support140
Precision30 ÷ (30 + 20)60%
Recall30 ÷ (30 + 10)75%
Accuracy (model / flag nobody)(30 + 140) ÷ 200 / 160 ÷ 20085% / 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

  1. What does recall mean in this project?

    Show answer

    The share of students who needed support that the model flagged.

  2. 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.