Machine learning models can identify patients on antiretroviral therapy (ART) who are at high risk of disappearing from HIV care with remarkable accuracy, according to a new study from Zimbabwe published in Discover Public Health. Researchers analysed records from 1,182 ART patients in Mashonaland Central province and trained two ensemble classifiers — Random Forest and XGBoost — to predict loss to follow-up (LTFU), defined as missing a scheduled medication pickup by more than 90 days. Of the patients studied, 294 (24.87%) were lost to follow-up between May 2023 and April 2024, while 888 (75.13%) remained in care. Crucially, the team went beyond raw prediction accuracy, applying two explainable artificial intelligence techniques, LIME and SHAP, to open up the black box and show which factors drove each individual prediction.
The data came from Zimbabwe’s Ministry of Health and Child Care’s Electronic Patient Monitoring System, covering a 12-month observation window from May 2023 to April 2024. The predictors included demographic and clinical variables such as age group, gender, duration on ART, clinic visits in the last 12 months, ART regimen, TB screening and status, CD4 count category, viral suppression status, and reported adverse effects. Because the outcome was imbalanced — LTFU patients made up roughly a quarter of the dataset — the researchers applied SMOTENC, a synthetic over-sampling technique designed for mixed numerical and categorical data, strictly within the training folds of their cross-validation procedure. Validation data were never resampled, and all imputation and encoding steps were fitted on training data alone, reducing the risk of information leaking from validation sets into model training.
Performance was evaluated with repeated stratified five-fold cross-validation and ten repeats, producing 50 paired validation estimates for each model. Random Forest achieved a mean accuracy of 0.9751 (SD 0.0093), recall of 0.9810 (SD 0.0170), F1-score of 0.9517 (SD 0.0175), and ROC AUC of 0.9844 (SD 0.0095). XGBoost posted closely matched figures: accuracy of 0.9726 (SD 0.0091), recall of 0.9677 (SD 0.0239), F1-score of 0.9462 (SD 0.0176), and ROC AUC of 0.9855 (SD 0.0081). Random Forest led on several threshold-dependent measures, including balanced accuracy, the Matthews correlation coefficient and Cohen’s kappa, while XGBoost edged ahead on precision, ROC AUC and PR AUC.
The paired comparison, however, showed that the differences in probability-based discrimination were statistically fragile. The mean RF-minus-XGBoost difference in ROC AUC was −0.0011, with a bootstrap 95% confidence interval spanning −0.0026 to 0.0006 — an interval that includes zero, meaning the observed gap is compatible with no real difference. The same held for PR AUC (mean difference −0.0028; 95% CI −0.0073 to 0.0016). The authors stressed that these bootstrap intervals are descriptive resampling summaries, not hypothesis tests based on independent patient samples, since all 50 estimates derive from the same underlying dataset. Brier scores, which penalise both discrimination and calibration errors, were low for both models: 0.0221 for Random Forest and 0.0233 for XGBoost.
Threshold analysis added practical nuance. At a probability threshold of 0.50, Random Forest reached a sensitivity of 0.9796, specificity of 0.9730, positive predictive value of 0.9231 and negative predictive value of 0.9931; XGBoost achieved sensitivity of 0.9728, specificity of 0.9730, PPV of 0.9226 and NPV of 0.9908. Lowering the threshold pushed sensitivity as high as 0.9864 for both models, while raising it to 0.90 cut sensitivity to 0.8707 but lifted specificity to 0.9820. The authors caution that this threshold analysis was based on available out-of-fold predictions and should not be read as establishing a clinically optimal operating point.
The explainability analysis was where the study broke new ground for this application. SHAP (SHapley Additive exPlanations), a method rooted in cooperative game theory, quantified each feature’s contribution to model outputs at both global and local levels. The two algorithms agreed strongly on the most influential predictors: current viral suppression and viral suppression over the preceding 12 months were the top two drivers in both models, with CD4 category consistently among the leading predictors. Beyond that, the models leaned on somewhat different combinations of variables — clinic attendance ranked relatively higher in Random Forest, whereas regimen and duration on ART carried more weight in XGBoost. SHAP interaction analysis also revealed model-level interaction patterns, for example between older age and achieved viral suppression, though the authors emphasise these reflect how the models combine predictors, not biological or causal interactions.
LIME (Local Interpretable Model-Agnostic Explanations) complemented SHAP by explaining individual patient predictions using 5,000 perturbed samples around each case. For a correctly flagged LTFU patient with an out-of-fold predicted probability of 0.9996, the strongest pushes toward prediction were current viral suppression not achieved (+0.5298), 12-month viral suppression not achieved (+0.2801), the TDF+3TC+EFV regimen (+0.1365) and CD4 ≤ 200 (+0.0906). Conversely, for a correctly retained patient predicted at just 0.0002, achieved current viral suppression (−0.4857) and achieved 12-month suppression (−0.2638) argued strongly against LTFU. The error cases were especially instructive: a false positive predicted at 0.9992 who was actually retained, and a false negative predicted at only 0.0028 who was actually lost to follow-up despite achieved viral suppression. Highly confident predictions, in other words, can still be wrong — a finding the authors cite as a key argument for keeping human oversight in any model-assisted workflow.
The authors are careful about what these results do and do not show. The SHAP and LIME outputs describe the behaviour of the fitted models and should be interpreted as evidence of model reliance, not as proof that viral suppression or low CD4 counts cause patients to drop out of care; SHAP values cannot separate causal effects from associations, proxies or correlated information. The performance figures represent internal validation on a single province’s data — Mashonaland Central, where adult HIV prevalence is estimated at 12.9% (95% CI 10.6–15.2) — and the authors note that one province out of ten may limit generalisation to Zimbabwe’s wider ART population. Omitted variables that the monitoring system does not capture may also influence attrition, and the class imbalance in the outcome may affect how such models behave when deployed in real healthcare settings.
Context makes the stakes clear. An estimated 39.9 million people worldwide were living with HIV in 2023, with 1.3 million new cases and 630,000 AIDS-related deaths. Zimbabwe’s adult ART coverage stands at 97.9%, and viral suppression among adults has risen from 83.07% in 2020 to 95.90% in 2023, yet retention remains a persistent challenge driven by complex, interrelated biopsychosocial factors. Poor adherence and attrition carry serious consequences, including increased risk of treatment failure, drug resistance, inadequate viral suppression, higher transmission risk and accelerated death. Prior machine learning studies in South Africa, Uganda, Malawi and the United States have predicted retention or disengagement with good results, but the authors note that most did not apply explainable AI to interpret their outputs — a gap this study addresses directly.
The researchers propose that, once externally validated, such models could support differentiated ART retention strategies: flagging patients for enhanced appointment reminders, adherence counselling, telephone follow-up, proactive check-ins or home visits, particularly those with unsuppressed viral loads or low CD4 counts. They explicitly warn against misuse — models should never be used to deny services, label patients as likely to disengage, or make decisions without clinical and programme review. Future work, the team says, should focus on external and temporal validation in independent ART populations, prospective studies testing whether model-guided interventions actually improve retention, calibration assessment in new settings, and decision-curve analyses to establish whether model-informed support delivers meaningful clinical benefit. Until then, the study stands as a demonstration of internal predictive performance and a template for making such predictions transparent rather than opaque.
Subject of Research: Explainable machine learning prediction of loss to follow-up among antiretroviral therapy patients in Zimbabwe
Article Title: Interpreting antiretroviral therapy loss to follow-up predictive models using LIME and SHAP
Article References: Mbunge, E., Chamboko, L., Sibiya, M. N., & Batani, J. (2026). Interpreting antiretroviral therapy loss to follow-up predictive models using LIME and SHAP. Discover Public Health, 23(1), Article 1715. https://doi.org/10.1186/s12982-026-03226-w
Image Credits: AI Generated
DOI: 10.1186/s12982-026-03226-w
Keywords: antiretroviral therapy, loss to follow-up, HIV care retention, machine learning, Random Forest, XGBoost, SHAP, LIME, explainable AI, Zimbabwe, viral suppression, CD4 count
News Source: Teresa Odom. (October 29, 2026). Machine learning predicts HIV patients at risk of dropping out of antiretroviral care. Scienmag.



