Home / Projects / Student retention

Predicting student dropout with a multi-model approach

Notebook, script and data on GitHub

Records
4,42436 features, one higher-education institution
Best model
XGBoost78.5% test accuracy (885 held-out students)
Dropout class
0.79 recall, 0.80 F1Enrolled class is weakest: 0.37 recall

In short. Which students are likely to drop out, and what separates them from those who graduate? Using 4,424 records, XGBoost finds about 79% of eventual dropouts among held-out students. The strongest signals are how many course units a student has passed and whether tuition is up to date. A model like this could help decide whom to contact early; this project did not test whether outreach would change outcomes.

01Question

Which factors are associated with student dropout, can students be grouped meaningfully for targeted retention programmes, and how well can dropout be predicted early enough to act on? The data is the public UCI "predict students' dropout and academic success" dataset, collected at a Portuguese higher-education institution; the three outcomes are Dropout, Enrolled and Graduate.

Bar chart of the number of students per outcome: Graduate about 2,200, Dropout about 1,400 and Enrolled about 800.
Outcomes. Graduates are the largest group, then dropouts, then students still enrolled.

02Method

  • Exploration and testing. Distribution and outlier checks, then chi-square tests for categorical variables and ANOVA for numeric ones, to find which variables relate to outcome rather than assuming it.
  • Segmentation. KMeans produced three student personas, and PCA produced an "academic intensity" feature, both added as model inputs.
  • Models. Logistic Regression as a baseline, Random Forest, and XGBoost (tree depth limited to 5 to restrain overfitting), compared with 10-fold cross-validation and then once on a held-out test set. The notebook also runs a paired t-test on the fold scores to compare the baseline with XGBoost.
Stacked bars of outcome proportions by tuition fee status. When fees are not up to date, about 86 percent of students dropped out; when fees are up to date, about a quarter did.
Tuition status. About 86% of students whose fees were not up to date (0) dropped out, against about a quarter of those who were up to date (1).

Segmenting the students

KMeans grouped students into three personas, and PCA produced an "academic intensity" feature; both were added to the models as inputs. The silhouette score, which measures how cleanly clusters separate, peaks at two and three clusters at about 0.33 and falls sharply from four, so three clusters were used.

Line chart of silhouette score against number of clusters from 2 to 10. The score is highest, about 0.33, at 2 and 3 clusters and drops sharply from 4.
Choosing k. Silhouette score is highest, about 0.33, at two and three clusters; three personas were used.

03Results

Cross-validation and hold-out accuracy
Model10-fold CV accuracyTest accuracyTest weighted F1
Logistic Regression (baseline)0.759 ± 0.0180.7740.758
Random Forest0.763 ± 0.0210.7740.753
XGBoost0.774 ± 0.0250.7850.771

XGBoost was best on every metric, but the margin over the linear baseline is about one percentage point of accuracy, and it is comparable to the fold-to-fold spread. On the hold-out set it finds 79% of eventual dropouts (F1 0.80) and 93% of graduates (F1 0.87). It struggles with students still enrolled (recall 0.37, F1 0.45), who sit between the other two groups.

Box plots of 10-fold cross-validated accuracy for Logistic Regression, Random Forest and XGBoost; the three distributions overlap, with XGBoost slightly higher.
Cross-validation. The three models' accuracy distributions overlap; XGBoost sits slightly higher.
Confusion matrix for XGBoost on 885 held-out students. Dropout: 223 correct, 30 predicted Enrolled, 31 predicted Graduate. Enrolled: 59 correct, 36 predicted Dropout, 64 predicted Graduate. Graduate: 413 correct, 17 predicted Dropout, 12 predicted Enrolled.
Hold-out confusion matrix. Enrolled students are most often mistaken for graduates.

What predicts dropout

The strongest predictors were the number of curricular units approved and whether tuition fees were up to date, followed by units enrolled and scholarship status: academic progress and financial stability.

Bar chart of the 15 most important XGBoost features. Total approved units is highest, then tuition fees up to date, total enrolled units, scholarship holder and academic intensity.
Top predictors. Units approved leads, followed by tuition status.

04Limitations

  • One institution's data; nothing here shows the model transfers to other universities or years.
  • Because units approved is the top predictor, much of the signal arrives only after a student has already struggled. It supports intervention only where those features are available early.
  • The report includes an ethical reflection on using predictions about individual students; any deployment would need that discussion first.

Code: notebook, script and data on GitHub. The written report is not published.

Reproducibility check: report versus re-run
Reproducibility check: report versus re-run (xgboost 2.1.4)
MeasureReportRe-run
Baseline CV accuracy0.7590.759
Random Forest CV accuracy0.7630.763
XGBoost CV accuracy0.7740.774
XGBoost test accuracy0.7850.780
Dropout recall0.790.79
Enrolled recall0.370.33

Why show this. Re-running the published notebook today reproduces the baseline and Random Forest exactly, and XGBoost to within about half a percentage point. The small gap is expected across XGBoost versions and is within the cross-validation spread, so the conclusions hold.