Objective

Schools collect large amounts of data, and machine learning (computer programs that learn patterns from past records) can use it to guess which students are likely to fail. An early guess matters because teachers can still help. The authors point to two gaps in earlier work. First, most studies looked at universities, not middle schools, even though that is where struggles can start to stick. Second, many models work like black boxes: they give an answer but not the reason, which makes teachers and administrators hesitant to trust them or explain them to families.

This study built a model for third-year middle school students in Morocco. It predicts whether a student will pass or fail the end-of-year exams, using only data from the first semester, about five months before the exams. The authors also used explainable AI (XAI), which means tools that show which facts pushed a prediction up or down. The aims were to:

  • Find a model that sorts pass and fail students accurately, even though far fewer students fail than pass.
  • Choose the best model with a fair method that looks at several measures together.
  • Explain predictions for the whole group and for single students.

Methods

This was a data analysis study with numbers only. It looks for patterns in past records, so it can show what goes along with failing, but it cannot show what causes it or whether acting on a warning would help.

The data came from two sources. Massar, Morocco's national student management system, supplied demographics, exam and continuous assessment results, schooling history and services received. The High Commission for Planning supplied poverty rates for the area each school serves. After merging, there were 600,218 records and 22 variables, covering students in the third and final year of middle school in the Rabat-Salé-Kénitra region. The authors removed records with missing values and extreme values that looked like data entry errors, and kept students aged 14 to 19. That left 561,538 records. Of these, 76.66% passed and 23.34% failed. The data were anonymized, and access was authorized by a regional education director.

The authors dropped five variables that scored low in two importance checks (Location, Gender, HasSocialSupport, HasDisability and HasPedagSupport). They split the records into training (393,076), validation (84,231) and test (84,231) sets, keeping the pass and fail mix the same in each. The test set was used only at the end.

They compared seven models, including logistic regression, random forest, XGBoost, LightGBM, CatBoost and a neural network. Because fewer students fail, they gave errors on failing students extra weight and tuned each model's decision threshold. Models were ranked on several measures at once using the Borda Count method. The best model was then examined with SHAP and LIME (tools that show how much each fact moved a prediction) and ELI5 (which checks how much accuracy drops when a fact is scrambled).

Key Findings

Overall, the model sorted students well from first-semester information, and grades from that semester drove the predictions. These are patterns in past data, not tested advice for schools.

How well it predicted

  • CatBoost had the best combined ranking (Borda score 17.0, lowest is best). On the test set it reached balanced accuracy of 88.8%, MCC of 70.6%, G-Mean of 88.7% and F1-score of 91.4%.
  • It caught students who went on to fail well: recall for the fail group was 0.91, meaning it found nearly all but a small share of failing students. But precision for that group was 0.67, so about one in three students it flagged as likely to fail was not actually in that group. Teachers would see false alarms.

What drove predictions

  • Three academic measures led: the first-semester continuous assessment average (importance 1.618), the first-semester exam average (1.141) and the previous year's overall average (0.580). Higher scores pushed predictions toward pass.
  • Area poverty was the strongest non-academic factor (0.366), and higher poverty pushed predictions toward fail. Individual subjects such as Islamic Education, French and Math sat in a middle band, and class size and age had smaller roles.
  • The ELI5 check agreed that the two first-semester measures stood far above the rest.
  • The model used poverty together with other facts, such as class size and exam scores, rather than on its own.
  • Most of the other overall measures looked similar: the model gave a specificity of 0.90, so it also correctly cleared students who went on to pass at a high rate.
  • All seven models had high ROC-AUC values (CatBoost 0.9576, XGBoost 0.9561), so the choice among them was close, and the Borda Count method was used to settle it.

Individual students

  • The authors showed how the tool explains single cases. One student who actually passed was predicted to fail, mainly because of low first-semester scores, even though area poverty pushed toward pass. A second student was predicted to pass because of a strong exam average. LIME agreed on the main drivers but gave poverty much less weight than SHAP did.

Implications

The authors say the tool is meant to feed a future school-facing early warning system. It is not ready for classrooms yet.

Schools and teachers

  • The authors say explanations let a teacher see why a student was flagged. A flag driven by low first-semester exam scores calls for a different response than one driven by a poor mark in a single subject.
  • The authors say outputs should prompt a human conversation, not replace it, because grades and area poverty cannot capture a student's real circumstances.

Education authorities

  • The authors say the results could help direct support to schools and students most affected by disadvantage.
  • Our reading (not the authors' recommendation): because poverty here is an area-level figure, a flag should lead to support, not to labeling a child or a school.

Developers and researchers

  • The authors suggest picking models with several measures rather than one, and checking explanations with more than one tool, since the tools did not agree on everything.
  • Our reading (not the authors' recommendation): a school thinking about using this should expect false alarms and plan for how staff will check each flagged student before any decision.

Our reading (not the authors' recommendation): school leaders should ask who sees a flag, how families would be told, and what support follows, before any pilot. Teachers could also use the explanation plots to talk with a student about which subjects to work on first.

The evidence does not yet show whether early warnings improve student results.

Limitations

The authors name several limits. All the data came from one region, Rabat-Salé-Kénitra, and the model has not been tested on other Moroccan regions or other countries, so the poverty effect in particular may look different elsewhere. The data held only what the school systems record. Attendance, parents' education and involvement, motivation and emotional well-being were missing. The authors also say that grades and area poverty reduce a student's life to numbers and cannot capture things such as food insecurity, housing problems or caring duties at home. Students with disabilities or learning support may be under-represented, because those flags were rare and were dropped from the model. Finally, use as a school tool, including teacher testing and dashboard design, was not part of this study.

The paper does not mention, but the model predicts from earlier grades, so a student who is flagged may simply be one whose marks are already low, which is information teachers already have. The paper does not mention, but the data are only from third-year students, so the results do not tell us about earlier middle school years. The paper does not mention, but a precision of 0.67 for failing students means some students would be wrongly flagged, and the paper does not look at what that could mean for them.

Future Directions

The authors plan three next steps:

  • Add attendance, behavior and engagement information as it becomes available, so the model can pick up changes during the school year.
  • Build and test a school-facing early warning tool, including a dashboard, teacher usability testing and checks in real schools, to find out whether it is useful to teachers and not only accurate in past data.
  • Add interviews, focus groups and student accounts to learn what is behind risk indicators such as poverty, which administrative data cannot show.

They also say that how well explanations stay stable when the way of handling uneven groups changes should be tested in a systematic way, and that a quantitative test of explanation fidelity, stability and actionability on this dataset is still needed.

The bottom line: A model built on 561,538 Moroccan middle school records predicted pass or fail from first-semester information with 88.8% balanced accuracy, and showed that early grades drove most predictions, with area poverty a smaller factor. The evidence is a test on past data from one region. It flagged failing students well but also raised false alarms, and nobody has yet checked whether teachers can use it or whether it helps students. It may be useful as a prompt for a human conversation, but not as a stand-alone decision tool.