Jonathan Melvin Ikapule2026-06-242026-06-242025-05https://hdl.handle.net/20.500.11951/2165PostgraduateRetention in HIV care is critical to viral suppression, improved health outcomes, and reduced transmission; however, retention rates remain suboptimal in urban Uganda, with some studies reporting rates below 60%. This study aimed to identify retention predictors and develop a machine learning model to predict retention among people living with HIV (PLHIV) using routinely collected patient-level data. A retrospective cohort study was conducted using data from electronic medical records (EMR) from three urban HIV clinics in Kampala (January 2021 - December 2023). Clients who died or were transferred out were excluded, yielding 22,213 clients. Data included demographic, clinical, and visit-related variables, as well as engineered features like duration on antiretroviral therapy, distance to clinic, and viral suppression history. Retention was defined as attending a scheduled appointment within 90 days. Six classification algorithms were trained and evaluated using a 70:30 split and SMOTE (a technique to balance data). Accuracy, precision, recall, and F1 score assessed model performance. XGBoost outperformed other models, achieving an accuracy of 88% and an F1 score of 0.85. Key predictors, identified using SHAP values for feature importance, included duration on ART, weight, age, baseline CD4, distance to the clinic, and ART adherence. These findings demonstrate the feasibility of using EMR data and machine learning to support data-driven decision-making in HIV programs. Machine learning models integrated into EMR systems can enable real-time identification of clients at risk of disengaging from care, guiding targeted interventions. This study highlights the potential of data science to improve HIV service delivery, although further validation in diverse contexts is needed. Keywords: Antiretroviral Therapy, Classification, EMR, Retention, SHAP, SMOTE, Supervised Learning, XGBoost, Urban Clinic, Uganda.enPredicting client retention in an urban HIV clinic – a machine learning approachProject Report