Submitted:
09 June 2026
Posted:
10 June 2026
You are already at the latest version
Abstract
Keywords:
1. Introduction
1.1. Key Contributions
- A comparative XML framework incorporating LR, RF, and XGBoost is developed to predict diabetes with high accuracy and clinical interpretability.
- A comprehensive preprocessing pipeline with missing-value imputation, categorical encoding, feature normalization, and class balancing is applied to enhance data quality and model performance.
- The Marine Predators Algorithm (MPA) is used to optimize hyperparameters of RF and XGBoost, enhancing classification performance, generalization ability, and robustness.
- SHAP-based explainability provides global and local interpretability for transparent and clinically meaningful diabetes risk investigation.
- The framework is validated using cross-validation, calibration analysis, ablation study, and statistical tests for robust and rigorous evaluation.
2. Literature Review
3. Problem Statement
4. Proposed Approach
4.1. Comparative ML Model Development for Diabetes Prediction
4.1.1. Baseline Model: Logistic Regression for Clinical Interpretability
4.1.2. Ensemble Learning Model: Random Forest for Robust Prediction
4.1.3. Gradient Boosting Model: XGBoost for High-Performance Classification
| Algorithm 1. Comparative Machine Learning Model Development for Diabetes Prediction. |
| Input: Pre-processed dataset D Output: Trained models, predictions, and best performing model Step 1: Load D; partition into D_train and D_test (stratified split). Step 2: Define LR (baseline), RF (ensemble), and XGBoost (gradient boosting). Step 3: Train LR on D_train using linear probabilistic relationships. Step 4: Train RF using bootstrap aggregation and majority voting. Step 5: Train XGBoost using sequential additive learning. Step 6: For each model, generate probability outputs for D_test; convert to binary labels (0 = non-diabetic, 1 = diabetic). Step 7: Evaluate each model: Accuracy, Precision, Recall, F1, ROC-AUC. Step 8: Compare models; select best performer. Step 9: Return best model, predictions, and comparative performance results. |
4.2. Hyperparameter Optimization Using Marine Predators Algorithm
4.2.1. Optimization Problem Definition
4.2.2. MPA Mechanism
4.2.3. Exploration-Exploitation Control Strategy
4.2.4. Fitness Evaluation Strategy
| Algorithm 2. MPA-Based Hyperparameter Optimization for Diabetes Prediction. |
| Input: D_train, RF and XGBoost models Output: Optimized hyperparameters θ* for RF and XGB Step 1: Define hyperparameter search spaces for RF and XGBoost. Step 2: Initialize MPA: population size N, max iterations T. Step 3: Randomly initialize candidate solutions; assign to hyperparameter configs. Step 4: For each candidate, train model, perform K-fold CV, compute fitness. Step 5: Identify candidate with highest fitness as global best θ*. Step 6: For t = 1 to T: 6.1 Compute control factor CF. 6.2 Update candidate positions using MPA rule. 6.3 Enforce hyperparameter bounds. 6.4 Re-evaluate fitness; update global best if improved. Step 7: Apply optimized θ* to RF and XGB; generate final models. |
4.3. Explainable Artificial Intelligence Using SHAP
4.3.1. SHAP-Based Explainability Framework
4.3.2. Global Interpretability Analysis
4.3.3. Local Explanation Mechanism
4.3.4. Feature Interaction Analysis
5. Experimental Setup
5.1. Dataset Acquisition
5.2. Data Preprocessing
5.2.1. Mean Imputation for Missing Value Handling
5.2.2. One-Hot Encoding for Categorical Feature Transformation
5.2.3. Min-Max Normalization for Feature Scaling
5.2.4. SMOTE for Class Imbalance Handling
| Algorithm 3. SMOTE for Class Imbalance Handling. |
| Input: X_min (minority class), N (synthetic samples required), k (nearest neighbors) Output: X_syn (synthetic minority class samples) Step 1: Initialize X_syn = ∅. Step 2: For each xi ∈ X_min: 2.1 Locate k nearest neighbors in X_min. Step 3: For i = 1 to N: 3.1 Randomly select xi from X_min. 3.2 Randomly select xnn from k nearest neighbors of xi. 3.3 Generate: xnew = xi + λ × (xnn − xi), λ ∈ [0,1]. 3.4 Add xnew to X_syn. Step 4: Return X_syn. |
5.3. Data Splitting Strategy
5.3.1. Training and Testing Split
5.3.2. Stratified 10-Fold Cross-Validation
5.4. Experimental Environment
5.5. Hyperparameter Configuration
5.6. Performance Metrics
6. Results and Discussion
6.1. Dataset Distribution and Feature Analysis
6.2. Cross-Validation and Comparative Performance
6.3. Evaluation of Predictive Probability Calibration
6.4. ROC and Precision-Recall Analysis
6.5. Error Analysis Using Confusion Matrices
6.6. Explainable AI Analysis Using SHAP
6.6.1. Global SHAP Analysis
6.6.2. SHAP Beeswarm Analysis
6.6.3. SHAP Feature Influence and Local Interpretation
6.7. Ablation Study
6.8. Statistical Significance Analysis
6.9. Comparison with State-of-the-Art Methods
6.10. Discussion
7. Conclusions
7.1. Summary
7.2. Limitations
7.3. Future Work
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Mushtaq, Z.; Ramzan, M.F.; Ali, S.; Baseer, S.; Samad, A.; Husnain, M. Voting Classification-Based Diabetes Mellitus Prediction Using Hypertuned Machine-Learning Techniques. Mob. Inf. Syst. 2022, 2022, 1–16. [Google Scholar] [CrossRef]
- Qin, Y.; et al. Machine Learning Models for Data-Driven Prediction of Diabetes by Lifestyle Type. Int. J. Environ. Res. Public Health 2022, 19, 15027. [Google Scholar] [CrossRef]
- Mohanty, P.K.; Francis, S.A.J.; Barik, R.K.; Roy, D.S.; Saikia, M.J. Leveraging Shapley Additive Explanations for Feature Selection in Ensemble Models for Diabetes Prediction. Bioengineering 2024, 11, 1215. [Google Scholar] [CrossRef]
- El-Sofany, H.; El-Seoud, S.A.; Karam, O.H.; Abd El-Latif, Y.M.; Taj-Eddin, I.A.T.F. A Proposed Technique Using Machine Learning for the Prediction of Diabetes Disease through a Mobile App. Int. J. Intell. Syst. 2024, 2024, 1–13. [Google Scholar] [CrossRef]
- Sun, Q.; Cheng, X.; Han, K.; Sun, Y.; Ren, H.; Li, P. Machine learning-based assessment of diabetes risk. Appl. Intell. 2025, 55, 106. [Google Scholar] [CrossRef]
- Bhat, S.S.; Selvam, V.; Ansari, G.A.; Ansari, M.D.; Rahman, M.H. Prevalence and Early Prediction of Diabetes Using Machine Learning in North Kashmir. Comput. Intell. Neurosci. 2022, 2022, 1–12. [Google Scholar] [CrossRef]
- Sghaireen, M.G.; et al. Machine Learning Approach for Metabolic Syndrome Diagnosis Using Explainable Data-Augmentation-Based Classification. Diagnostics 2022, 12, 3117. [Google Scholar] [CrossRef]
- Dutta, A.; et al. Early Prediction of Diabetes Using an Ensemble of Machine Learning Models. Int. J. Environ. Res. Public Health 2022, 19, 12378. [Google Scholar] [CrossRef]
- Oliullah, K.; Rasel, M.H.; Islam, M.M.; Islam, M.R.; Wadud, M.A.H.; Whaiduzzaman, M. A stacked ensemble machine learning approach for the prediction of diabetes. J. Diabetes Metab. Disord. 2023, 23, 603–617. [Google Scholar] [CrossRef]
- Sunny, M.N.M.; Sakil, M.B.H.; Atayeva, J.; Munmun, Z.S.; Mollick, M.S.; Faruq, M.O. Predictive Healthcare: An IoT-Based ANFIS Framework for Diabetes Diagnosis. Engineering 2024, 16, 325–336. [Google Scholar] [CrossRef]
- Bhuyan, H.K.; Chakraborty, C. Explainable Machine Learning for Data Extraction Across Computational Social System. IEEE Trans. Comput. Soc. Syst. 2024, 11, 3131–3145. [Google Scholar] [CrossRef]
- Afolabi, S.; Ajadi, N.; Jimoh, A.; Adenekan, I. Predicting diabetes using supervised machine learning algorithms on E-health records. Inform. Health 2025, 2, 9–16. [Google Scholar] [CrossRef]
- Kakoly, I.J.; Hoque, M.R.; Hasan, N. Data-Driven Diabetes Risk Factor Prediction Using Machine Learning Algorithms with Feature Selection Technique. Sustainability 2023, 15, 4930. [Google Scholar] [CrossRef]
- Laila, U.E.; Mahboob, K.; Khan, A.W.; Khan, F.; Taekeun, W. An Ensemble Approach to Predict Early-Stage Diabetes Risk Using Machine Learning: An Empirical Study. Sensors 2022, 22, 5247. [Google Scholar] [CrossRef]
- Maimaitijiang, E.; Aihaiti, M.; Mamatjan, Y. An Explainable AI Framework for Online Diabetes Risk Prediction with a Personalized Chatbot Assistant. Electronics 2025, 14, 3738. [Google Scholar] [CrossRef]
- Ganie, S.M.; Malik, M.B. A Lifestyle-Based Fuzzy-Enhanced ANN Model for Early Prediction of Type 2 Diabetes. Diagnostics 2025, 15, 3139. [Google Scholar] [CrossRef] [PubMed]
- Netayawijit, P.; Chansanam, W.; Sorn-In, K. Interpretable Machine Learning Framework for Diabetes Prediction: Integrating SMOTE Balancing with SHAP Explainability for Clinical Decision Support. Healthcare 2025, 13, 2588. [Google Scholar] [CrossRef]
- Hoyos, W.; Hoyos, K.; Ruiz, R.; Aguilar, J. An explainable analysis of diabetes mellitus using statistical and artificial intelligence techniques. BMC Med. Inform. Decis. Mak. 2024, 24, 383. [Google Scholar] [CrossRef]
- Jasim, A.A.; Hazim, L.R.; Mohammedqasim, H.; Mohammedqasem, R.; Ata, O.; Salman, O.H. e-Diagnostic system for diabetes disease prediction on an IoMT environment-based hyper AdaBoost machine learning model. J. Supercomput. 2024, 80, 15664–15689. [Google Scholar] [CrossRef]
- Ashisha, G.R.; Mary, X.A.; Kanaga, E.G.M.; Andrew, J.; Eunice, R.J. Random Oversampling-Based Diabetes Classification via Machine Learning Algorithms. Int. J. Comput. Intell. Syst. 2024, 17, 270. [Google Scholar] [CrossRef]
- Dharmarathne, G.; Jayasinghe, T.N.; Bogahawaththa, M.; Meddage, D.P.P.; Rathnayake, U. A novel machine learning approach for diagnosing diabetes with a self-explainable interface. Healthc. Anal. 2024, 5, 100301. [Google Scholar] [CrossRef]
- Rastogi, R.; Bansal, M.; Kumar, N.; Singla, S.; Singla, P.; Jaswal, R.A. Effective Diabetes Prediction using an IoT-based Integrated Ensemble Machine Learning Framework. Eng. Technol. Appl. Sci. Res. 2025, 15, 20064–20070. [Google Scholar] [CrossRef]
- Tasin, I.; Nabil, T.U.; Islam, S.; Khan, R. Diabetes prediction using machine learning and explainable AI techniques. Healthc. Technol. Lett. 2023, 10, 1–10. [Google Scholar] [CrossRef]
- Pang, K. A comparative study of explainable machine learning models with Shapley values for diabetes prediction. Healthc. Anal. 2025, 7, 100390. [Google Scholar] [CrossRef]
- Curia, F. Explainable and transparency machine learning approach to predict diabetes develop. Health Technol. 2023, 13, 769–780. [Google Scholar] [CrossRef]
- Iftikhar, K.; Javaid, N.; Ahmed, I.; Alrajeh, N. A Novel Explainable Deep Learning Framework for Accurate Diabetes Mellitus Prediction. Appl. Sci. 2025, 15, 9162. [Google Scholar] [CrossRef]
- Hasan, R.; Dattana, V.; Mahmood, S.; Hussain, S. Towards Transparent Diabetes Prediction: Combining AutoML and Explainable AI for Improved Clinical Insights. Information 2024, 16, 7. [Google Scholar] [CrossRef]
- Vivek Khanna, V.; et al. Explainable artificial intelligence-driven gestational diabetes mellitus prediction using clinical and laboratory markers. Cogent Eng. 2024, 11, 2330266. [Google Scholar] [CrossRef]
- Massari, H.E.; Sabouri, Z.; Mhammedi, S.; Gherabi, N. Diabetes Prediction Using Machine Learning Algorithms and Ontology. J. ICT Stand. 2022, 10. [Google Scholar] [CrossRef]
- Febrian, M.E.; Ferdinan, F.X.; Sendani, G.P.; Suryanigrum, K.M.; Yunanda, R. Diabetes prediction using supervised machine learning. Procedia Comput. Sci. 2023, 216, 21–30. [Google Scholar] [CrossRef]
- Mustafa, M. Diabetes prediction dataset. Kaggle. 2020. Available online: https://www.kaggle.com/datasets/iammustafatz/diabetes-prediction-dataset (accessed on 12 May 2026).
- Kibria, H.B.; Nahiduzzaman, M.; Goni, M.O.F.; Ahsan, M.; Haider, J. An Ensemble Approach for the Prediction of Diabetes Mellitus Using a Soft Voting Classifier with an Explainable AI. Sensors 2022, 22, 7268. [Google Scholar] [CrossRef]
- Rafie, Z.; Talab, M.S.; Koor, B.E.Z.; Garavand, A.; Salehnasab, C.; Ghaderzadeh, M. Leveraging XGBoost and explainable AI for accurate prediction of type 2 diabetes. BMC Public Health 2025, 25, 3688. [Google Scholar] [CrossRef]
- Chike, O.E.; Oduniyi, O.S.; Nwaiwu, J.I. An interpretable machine learning approach to predicting depression and diabetes. Healthc. Anal. 2026, 9, 100454. [Google Scholar] [CrossRef]















| Class 1 (Diabetic) | Class 0 (Non-diabetic) | Total Records | Dataset Phase |
|---|---|---|---|
| 8,500 | 91,500 | 100,000 | Original Dataset |
| 10,000 | 10,000 | 20,000 | After SMOTE Balancing |
| 8,000 | 8,000 | 16,000 | Training Set (80%) |
| 2,000 | 2,000 | 4,000 | Testing Set (20%) |
| Specification | Component | Category |
|---|---|---|
| Intel Core i5-12400 12th Gen @ 2.50 GHz | Processor | Hardware |
| 16 GB | RAM | |
| 64-bit OS, x64-based processor | Architecture | |
| Python 3.x | Language | Software |
| 2.2.6 | NumPy | |
| 2.3.2 | Pandas | |
| 1.7.2 | Scikit-learn | |
| 3.0.5 | XGBoost | |
| 0.50.0 | SHAP | |
| 0.14.0 | Imbalanced-learn | |
| 1.16.1 | SciPy | |
| 3.10.6 | Matplotlib |
| Configuration | Component | Category |
|---|---|---|
| 2000 | max_iter | LR |
| lbfgs | solver | |
| 1 | Regularization (C) | |
| 300 | n_estimators | RF |
| 15 | max_depth | |
| balanced | class_weight | |
| 0.05 | learning_rate | XGBoost |
| 500 | n_estimators | |
| 8 | max_depth | |
| 80% / 20% | Train/Test Ratio | Data Splitting |
| Stratified 10-Fold | Cross-Validation | |
| 10 | Population Size | MPA Optimization |
| 15 | Epochs | |
| 42 | Random Seed | Reproducibility |
| Recall | Precision | ROC-AUC | F1-Score | Accuracy | Model |
|---|---|---|---|---|---|
| 0.9585 | 0.9701 | 0.9954 | 0.9643 | 0.9645 | Without SMOTE |
| 0.9445 | 0.9338 | 0.9885 | 0.9391 | 0.9388 | Without MPA |
| 0.957 | 0.977 | 0.9956 | 0.9671 | 0.9672 | Proposed Model |
| p-value | Test Statistic | Comparison |
|---|---|---|
| p < 0.001 | W = 12.45 | LR vs. RF |
| p < 0.001 | W = 10.87 | LR vs. XGBoost |
| p = 0.002 | W = 6.34 | RF vs. XGBoost |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).