Abstract
INTRODUCTION: Type 2 diabetes mellitus (T2DM) poses a major public health challenge, particularly in regions with limited representation in predictive modeling studies. This research aimed to develop and interpret robust machine learning (ML) models for early T2DM risk prediction using data from the Dena Cohort in Iran. METHODS: Data from 3,203 adults aged 35–70 years were preprocessed through outlier removal, median/mode imputation, feature selection via LightGBM, and class balancing with the Synthetic Minority Over‑sampling Technique (SMOTE). Two gradient‑boosting algorithms, XGBoost and CatBoost, underwent hyperparameter tuning and 10‑fold cross‑validation. Model performance was assessed using accuracy, F1‑score, and the area under the receiver operating characteristic curve (AUC). Shapley Additive Explanations (SHAP) provided global and case‑specific interpretability of predictive features. RESULTS: XGBoost achieved the highest performance (accuracy = 96.07%, AUC = 99.29%), outperforming CatBoost and demonstrating substantial improvement with SMOTE balancing. Key predictors included fasting blood sugar, fatty liver, urolithiasis, red blood cell indices, and lifestyle factors such as energy drink consumption and prolonged television viewing. SHAP visualizations enhanced model transparency and facilitated individualized risk interpretation. CONCLUSION: This study demonstrates that combining advanced gradient‑boosting models with SHAP explainability yields highly accurate, interpretable T2DM risk prediction in an underrepresented population. These findings support integrating interpretable ML into clinical workflows for personalized prevention and early intervention strategies. GRAPHICAL ABSTRACT: [Image: see text] SUPPLEMENTARY INFORMATION: The online version contains supplementary material available at 10.1186/s12889-025-24953-w.