AI & Machine Learningbeginner

Predict Student Exam Scores

The capstone for Intro to Machine Learning. Use the full machine learning loop to predict student exam scores, validate your model honestly, and write a short report on what you found.

Dataset

Title
Student Exam Performance (sample)
Country
Sample data
Source
RiseAfrica (synthetic teaching sample)
License
CC0 (Public Domain)
Ethics note
This is synthetic teaching data, not real students, so there are no privacy concerns. Use it to practise the machine learning loop; do not present results as real findings about any school or community.

Instructions

Goal

Predict a student's final exam score from things known before the exam. You will run the full machine learning loop from the course: explore the data, build and validate a model, improve it, and report what you found.

The data

Copy this dataset into Google Colab or the code editor to start. Each row is one student.

import pandas as pd

students = pd.DataFrame({
    "study_hours":    [2, 5, 1, 6, 3, 8, 4, 7, 1, 6, 5, 3, 2, 7, 4, 8, 2, 5, 6, 1, 4, 3, 7, 5],
    "attendance_pct": [60, 85, 50, 95, 70, 98, 75, 90, 45, 88, 80, 65, 55, 92, 78, 99, 58, 83, 90, 48, 72, 68, 94, 82],
    "prev_score":     [50, 72, 40, 85, 58, 92, 65, 88, 35, 80, 75, 55, 48, 84, 62, 95, 45, 70, 82, 38, 60, 57, 86, 73],
    "sleep_hours":    [6, 7, 5, 7, 6, 8, 6, 7, 5, 7, 6, 6, 5, 8, 7, 8, 6, 7, 6, 5, 7, 6, 8, 7],
    "extra_classes":  [0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1],
    "exam_score":     [52, 78, 41, 90, 61, 96, 70, 89, 37, 82, 77, 59, 50, 88, 66, 98, 49, 76, 85, 40, 68, 60, 87, 79],
})

print(students.describe())

Notice there are now five possible features: study_hours, attendance_pct, prev_score, sleep_hours, extra_classes. Part of your job is deciding which ones actually help.

Your tasks

  1. Explore. Load the data and run describe(). Write one or two things you notice.
  2. Choose your target and features. The target is exam_score. Pick the features you think matter.
  3. Build and validate. Train a DecisionTreeRegressor, split the data with train_test_split, and report the validation MAE.
  4. Improve. Tune max_leaf_nodes to lower the validation MAE, then train a RandomForestRegressor and compare.
  5. Report. In a short paragraph: which model was best, its validation MAE, which features you kept, and one idea to improve further.

What to submit

  • Your code (a Colab link, or pasted code)
  • Your best validation MAE
  • Your short written report

Tips

  • Lower MAE is better, and the validation MAE is the one that counts, not the training one.
  • Try adding or removing a feature and watch what happens to the MAE. That is real machine learning.
  • There is no single "correct" answer. A clear process and an honest result is what matters.

Rubric

  • Data exploration20 pts
  • Features and model20 pts
  • Validation with MAE20 pts
  • Improving the model20 pts
  • Report and reflection20 pts
  • Total100 pts