An Explainable Machine Learning Model for Predicting the Mental Health of Kenyan University Students

dc.contributor.authorAlii, Leonard Kiti
dc.date.accessioned2026-11-27T09:52:22Z
dc.date.issued2026-11-27
dc.descriptionA Master's Thesis submitted in partial fulfilment of the requirements for the award of the Master of Science in Artificial Intelligence at the Open University of Kenya. Supervisor: Dr. Ronald Ojino.
dc.description.abstractMental health disorders, especially depression and anxiety, are increasingly becoming a major public health concern among university students. These are greatly affecting the performance of the learners academically, relationships, and overall well-being of the students. It is important that students at risk are identified early for timely intervention. Conventional statistical approaches have not adequately captured the complex interactions among multiple psychosocial and demographic risk factors. Machine learning model methods have demonstrated a high ability to capture complexities. Even where these models have been used, explainability of the models has been insufficient. The main objective of this study was therefore to develop an explainable machine learning model for predicting mental health outcomes for Kenyan university students. This study applied machine learning techniques to predict depression and anxiety among university students using demographic, socioeconomic, academic, behavioural, and psychosocial variables. A cross-sectional study was done among 385 university students using a structured questionnaire incorporating the Patient Health Questionnaire-9 (PHQ-9) and the Generalized Anxiety Disorder-7 (GAD-7) instruments that are commonly used to assess depression and anxiety. Depression and anxiety scores were categorised into two levels, Low and High. The study compared six supervised machine learning algorithms. Model performance was evaluated using multiple performance metrics. To enhance transparency and interpretability, the study incorporated Explainable Artificial Intelligence (XAI) techniques. The evaluated models demonstrated considerable differences in their ability to identify students in the high-risk classes. For depression, the results showed that overall accuracy alone could mask poor identification of high-risk students. The best model achieved an accuracy of 78.5%, but its recall for the high-depression class was relatively low, whereas another model achieved a substantially higher recall of 60.0%, although with lower overall accuracy of 53.2%. This demonstrates the importance of considering multiple performance measures, particularly recall, F1-score, ROC-AUC, and MCC, when evaluating mental health classification models under class imbalance. Explainability analyses further identified academic stress, financial stress, sleep quality, relationship-related factors, and substance-use variables among the important predictors contributing to model predictions. The findings show the potential of machine learning models to accurately identify students at increased risk of depression and anxiety while providing interpretable explanations of model decisions.
dc.identifier.urihttps://erepository.ouk.ac.ke/handle/123456789/1697
dc.language.isoen
dc.publisherOpen University of Kenya
dc.subjectMachine Learning
dc.subjectExplainable Artificial Intelligence (XAI)
dc.subjectMental Health
dc.subjectDepression
dc.subjectAnxiety
dc.subjectUniversity Students
dc.subjectKenya
dc.subjectStudent Well-being
dc.subjectPredictive Modeling
dc.titleAn Explainable Machine Learning Model for Predicting the Mental Health of Kenyan University Students
dc.typeThesis