Skip to content
JW
Machine learningSupporting evidence2025

Student Performance Prediction

机器学习课程设计

An end-to-end machine-learning project that analyses student attributes and predicts academic progression outcomes.

Student Performance Prediction project diagram

26p

course report

~1.3

labelled MAE

06

base model families

01 / Overview

What this package actually contains.

The machine-learning coursework predicts a student’s final grade from demographic, family, study-habit and prior-term variables while controlling for leakage. The strongest saved model is labelled with an MAE of approximately 1.3.

Objectives

  • 01Explore which student and family features correlate with final performance.
  • 02Compare linear, tree-based, boosting and stacking regressors.
  • 03Build a reusable preprocessing and model-evaluation pipeline.

ML workflow

Data, features, model, evaluation.

The page focuses on leakage control, feature engineering and model comparison.

01

Student data

Academic, demographic, family and lifestyle attributes.

02

Feature engineering

Prior-grade means, differences, alcohol total and parental education.

03

Models

Ridge, Random Forest, ExtraTrees, XGBoost, LightGBM and CatBoost.

04

Stacking

Ridge meta-learner combining base regressors.

05

Evaluation

MAE, RMSE, R² and saved best model.

02 / Package highlights

What this work demonstrates.

  • Covers data preparation, exploratory analysis, model comparison and evaluation.
  • Translates tabular education data into a complete predictive workflow.
  • Adds a clean supervised-learning example to the broader modelling portfolio.

03 / Model design

What shaped the predictive performance.

01

Feature engineering and leakage

The project creates interaction and context features such as prior-grade averages, grade change, combined alcohol consumption and parental education. The original notebook explicitly notes the importance of removing G1 and G2 from the feature set in some experiments to avoid target leakage into the final-grade prediction.

02

Why stacking

The target is tabular and moderately sized. A stack of linear, bagged-tree, extremely randomised tree and gradient-boosting models captures different error patterns. A Ridge meta-learner keeps the combination stable and passes the original features through to the second stage.

03

Evaluation

The workflow compares MAE, RMSE and R² across models and saves the best-performing estimator. The resulting artifact is labelled “Ultimate_Student_Model_MAE_1.3”, indicating the project’s approximate mean absolute error target.

04 / Key code

Feature and model implementation.

Only verified source excerpts and pseudocode taken from the project papers are shown.

Verified project codePython

Domain feature engineering

Original Python excerpt for feature construction and leakage control.

student['G1_G2_mean'] = (student['G1'] + student['G2']) / 2
student['G1_G2_diff'] = student['G2'] - student['G1']
student['total_alcohol'] = student['Dalc'] + student['Walc']
student['parents_edu'] = student['Medu'] + student['Fedu']
student['want_higher'] = (student['higher'] == 'yes').astype(int)

student = pd.get_dummies(student, drop_first=True)
labels = student['G3']

# Remove the raw prior grades when testing leakage-safe models
features = student.drop(['G3', 'G1', 'G2'], axis=1)

X_train, X_test, y_train, y_test = train_test_split(
    features, labels, test_size=0.25, random_state=42
)
Verified project codePython

Stacked regression model

Original Python excerpt showing the model stack and Ridge meta-learner.

base_models = [
    ('lr', LinearRegression()),
    ('rf', RandomForestRegressor(n_estimators=300, random_state=42)),
    ('et', ExtraTreesRegressor(n_estimators=300, random_state=42)),
    ('xgb', XGBRegressor(
        n_estimators=800, learning_rate=0.02,
        max_depth=5, random_state=42
    )),
    ('lgb', LGBMRegressor(
        n_estimators=800, learning_rate=0.02,
        num_leaves=31, random_state=42, verbose=-1
    )),
    ('cat', CatBoostRegressor(
        iterations=800, learning_rate=0.02,
        depth=6, random_seed=42, verbose=False
    )),
]

final_model = StackingRegressor(
    estimators=base_models,
    final_estimator=Ridge(alpha=1.0),
    passthrough=True,
    cv=10,
    n_jobs=-1,
)

Evaluation notes

  • The pipeline mixes Spark-based loading with scikit-learn modelling.
  • Multiple boosting libraries are compared under one evaluation framework.
  • The best model is persisted for later reuse.

Limitations / next steps

  • The dataset is small and observational, so predictive performance should not be interpreted causally.
  • A production education model would require fairness analysis, privacy controls and drift monitoring.

05 / Downloads

Files in this folder.

Open the original report, presentation or source archive. PDF cover pages with private details were removed.

PDF

Machine-learning report

中文 · 26 pages · 3.7 MB

Sanitized 26-page report without the student cover page.

Open file
ZIP

Source archive

Mixed · 2.5 MB

Course project source code and supporting files.

Download ZIP