An Interpretable XGBoost Model for Diabetes Prediction: Nested Cross-Validation, Calibration, and SHAP Analysis
Article Information
Publication Timeline
- Received07 June 2026
- Accepted06 July 2026
- Published
Abstract
Background: Diabetes mellitus is a major global health burden, and its early detection is essential for preventing serious complications. Machine learning, and eXtreme Gradient Boosting (XGBoost) in particular, performs strongly on routine clinical data; however, reported results are frequently optimistic because of hold-out evaluation and data leakage, and the resulting models are often difficult to interpret.
Objective: To develop and rigorously evaluate an interpretable XGBoost model for predicting the presence of diabetes from eight routine diagnostic measurements, using an unbiased, leakage-controlled evaluation design.
Methods: An openly available dataset of 1,168 patient records (771 non-diabetic and 397 diabetic; an approximately 66:34 class imbalance) with eight clinical features was analysed. Physiologically implausible zero values were treated as missing and imputed with the median inside a processing pipeline. Model selection and performance estimation were separated using a 5×5 nested cross-validation scheme, with all preprocessing confined to the training folds to prevent data leakage. Performance was assessed on out-of-fold predictions using accuracy, sensitivity, specificity, precision, F1 score, the area under the ROC curve (ROC-AUC), and the Brier score; probability calibration was examined; and the contribution of each feature was quantified with SHapley Additive exPlanations (SHAP).
Results: The model achieved an ROC-AUC of 0.823, an accuracy of 0.769, a specificity of 0.859, a sensitivity of 0.595, a precision of 0.684, an F1 score of 0.636, and a Brier score of 0.160. The near-diagonal calibration curve and low Brier score indicated that the predicted probabilities were well calibrated and could be interpreted as reliable risk estimates. SHAP analysis identified glucose, body mass index, and age as the most influential predictors, in agreement with established clinical risk factors for diabetes.
Conclusions: Under a leakage-controlled, unbiased evaluation, XGBoost provided moderate but trustworthy discrimination together with well-calibrated probabilities for diabetes prediction, while SHAP confirmed clinically plausible predictors. The comparatively conservative performance underscores the importance of nested cross-validation over simple hold-out splits for realistic model assessment. External validation and decision-threshold or class-imbalance strategies represent promising directions for future work.
Keywords
diabetes predictionXGBoostnested cross-validationSHAPmodel calibrationexplainable artificial intelligencemachine learningReferences
- Genitsaridi I, Salpea P, Salim A, Sajjadi SF, Tomic D, James S, et al. 11th edition of the IDF Diabetes Atlas: global, regional, and national diabetes prevalence estimates for 2024 and projections for 2050. Lancet Diabetes Endocrinol. 2026;14(2):149-56. [Google Scholar][Crossref]
- Teufel F, Orgutsova K, Genitsaridi I, Carrillo-Larco RM, Varghese JS, Marcus ME, et al. Global, regional, and national estimates of undiagnosed diabetes in adults: findings from the 2025 IDF Diabetes Atlas. Diabetes Care. 2026;49(3):490-6. [Google Scholar][Crossref]
- Masood S, Al-Bashrawi MA, Khan MA, Dwivedi YK. From data to diagnosis: a systematic review on AI-driven approaches to diabetes prediction. Artif Intell Rev. 2026;59(3):103. [Google Scholar][Crossref]
- Kiran M, Xie Y, Anjum N, Ball G, Pierscionek B, Russell D. Machine learning and artificial intelligence in type 2 diabetes prediction: a comprehensive 33-year bibliometric and literature analysis. Front Digit Health. 2025;7:1557467. [Google Scholar][Crossref]
- Smith JW, Everhart JE, Dickson WC, Knowler WC, Johannes RS. Using the ADAP learning algorithm to forecast the onset of diabetes mellitus. Proc Annu Symp Comput Appl Med Care. 1988 Nov 9:261-5. [Google Scholar][Crossref]
- Chen T, Guestrin C. XGBoost: a scalable tree boosting system. In: Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining. 2016. p. 785-94. [Google Scholar][Crossref]
- Li W, Peng Y, Peng K. Diabetes prediction model based on GA-XGBoost and stacking ensemble algorithm. PLoS One. 2024;19(9):e0311222. [Google Scholar][Crossref]
- Varma S, Simon R. Bias in error estimation when using cross-validation for model selection. BMC Bioinformatics. 2006;7:91. [Google Scholar][Crossref]
- Cawley GC, Talbot NL. On over-fitting in model selection and subsequent selection bias in performance evaluation. J Mach Learn Res. 2010;11:2079-107. [Google Scholar][Crossref]
- Lundberg SM, Lee SI. A unified approach to interpreting model predictions. In: Advances in Neural Information Processing Systems. 2017;30. [Google Scholar][Crossref]
- Lundberg SM, Erion G, Chen H, DeGrave A, Prutkin JM, Nair B, et al. From local explanations to global understanding with explainable AI for trees. Nat Mach Intell. 2020;2(1):56-67. [Google Scholar][Crossref]
- Hernesto C. Predicting diabetes from tracking medical records [dataset]. Mendeley Data. Version 3. 2020. doi:10.17632/nxnty5g7y6.3. [Google Scholar][Crossref]
- Demirel Tatli Ş, Aytekin K, Agraz M. Enhanced diabetes prediction using novel additive-multiplicative neural networks: a comprehensive machine learning analysis of the PIMA Indians dataset. medRxiv. 2025:2025.09.20.25336250. [Google Scholar][Crossref]
- Nassiwa F, Zeng J. Evaluating traditional machine learning models for predicting diabetes onset using the Pima Indians dataset. SSRN. 2022. Available from: SSRN 4878052. [Google Scholar][Crossref]
- Shams MY, Tarek Z, Elshewey AM. A novel RFE-GRU model for diabetes classification using PIMA Indian dataset. Sci Rep. 2025;15(1):982. [Google Scholar][Crossref]
- Van Calster B, McLernon DJ, van Smeden M, Wynants L, Steyerberg EW. Calibration: the Achilles heel of predictive analytics. BMC Med. 2019;17(1):230. [Google Scholar][Crossref]
- Liang X, Song W, Yang W, Yue Z. Enhancing diabetes risk assessment through Bayesian networks: an in-depth study on the Pima Indian population. Endocr Metab Sci. 2025;17:100212. [Google Scholar][Crossref]
How to Cite
Kucukakcali, Z., & Cicek, I. B. (2026). An Interpretable XGBoost Model for Diabetes Prediction: Nested Cross-Validation, Calibration, and SHAP Analysis. International Journal of Medical and All Body Health Research, 7(3), 168-174. https://doi.org/10.54660/IJMBHR.2026.7.3.168-174
Kucukakcali, Zeynep, and Ipek Balikci Cicek. "An Interpretable XGBoost Model for Diabetes Prediction: Nested Cross-Validation, Calibration, and SHAP Analysis." International Journal of Medical and All Body Health Research, vol. 7, no. 3, 2026, pp. 168-174. https://doi.org/10.54660/IJMBHR.2026.7.3.168-174.
Kucukakcali, Z. and Cicek, I. B. (2026) 'An Interpretable XGBoost Model for Diabetes Prediction: Nested Cross-Validation, Calibration, and SHAP Analysis', International Journal of Medical and All Body Health Research, 7(3), pp. 168-174. doi: 10.54660/IJMBHR.2026.7.3.168-174.
Kucukakcali Z, Cicek IB. An Interpretable XGBoost Model for Diabetes Prediction: Nested Cross-Validation, Calibration, and SHAP Analysis. International Journal of Medical and All Body Health Research. 2026;7(3):168-174. doi:10.54660/IJMBHR.2026.7.3.168-174
Similar Articles
- Comparative Diagnostic Performance of RIPASA, ALVARADO, and AIR Scoring Systems in Acute Appendicitis: A Retrospective Evaluation Using Traditional Metrics and XGBoost Algorithm Vol 6, Issue 2 (2025)
- Changing Demographic Trends, Indications and Clinical Outcomes of Keratoplasty: An Observational Study from a Tertiary Care Centre Vol 7, Issue 3 (2026)
- The Use of Optical Coherence Tomography for the Detection of Ocular Toxicity by Ethambutol in Newly Diagnosed Tuberculosis Patients Vol 7, Issue 3 (2026)
- Colchicine toxicity: Accidental Plant Poisoning with Colchicum Autumnale Resulting in Multiorgan Failure: A Case Report Vol 7, Issue 3 (2026)
- Beyond Binary Classification: A Comprehensive Survival Analysis and Calibration Assessment of the Heart Failure Clinical Records Datase Vol 7, Issue 3 (2026)
Find this Article on
Google Scholar Semantic Scholar OpenAlex Scilit Crossref ResearchGate BASEA newly published article may take a few days to appear on these services.