MétaCan
Menu
Back to cohort
Record W4417515038 · doi:10.1038/s41598-025-31562-5

Predicting and classifying type 2 diabetes using a transparent ensemble model combining random forest, k-nearest neighbor, and neural networks

2025· article· en· W4417515038 on OpenAlexaff
Niloufar Zaferani, Mohammad Reza Afrash, Khadijeh Moulaei

Bibliographic record

VenueScientific Reports · 2025
Typearticle
Languageen
FieldHealth Professions
TopicArtificial Intelligence in Healthcare
Canadian institutionsArtificial Intelligence in Medicine (Canada)
Fundersnot available
KeywordsInterpretabilityRandom forestEnsemble learningArtificial neural networkFeature selectionMissing dataDecision treeLeverage (statistics)Deep learningData pre-processing

Abstract

fetched live from OpenAlex

Diabetes is one of the major health challenges in today's world, since chronic elevation of blood sugar can cause serious and sometimes irreparable damage to organs such as the heart, kidneys, and nervous system. Early detection of this disease plays a vital role in reducing its complications. However, machine learning and deep learning models often face distrust in medical settings due to their opaque, "black-box" nature. The aim of this study was to combine three machine learning algorithms using stacking and voting methods to propose a model for type 2 diabetes detection, and to increase transparency by using the explainability techniques LIME and SHAP to identify important features. This study used medical data from 768 Pima Indians Diabetes samples, including 8 features such as age, BMI, glucose, insulin, blood pressure, skin thickness, pregnancies, and family history. Data preprocessing included mean imputation for missing or zero values, Min-Max normalization, and classification into "Normal", "Prediabetes", and "Diabetes" based on fasting glucose thresholds. Feature selection was performed using Spearman correlation to retain the most relevant variables. A hybrid machine learning model was developed using three base models Neural Network (NN), k-Nearest Neighbors (KNN), and Random Forest (RF) with automated hyperparameter tuning. The outputs of these models were combined via stacking using a logistic regression (LR) meta-model and in parallel using a soft voting method. Nested cross-validation (5 outer and 5 inner folds) was applied to prevent data leakage and ensure robust evaluation. Model interpretability was assessed using LIME for local explanations and SHAP for global feature importance. Decision thresholds and influential feature regions were identified, and model calibration and decision curves evaluated clinical reliability. Models performance was evaluated using accuracy, precision, recall, specificity, F1-score, AUROC, Brier Score (1-B), and Expected Calibration Error (1-E). Statistical reliability was assessed using bootstrap resampling to compute 95% confidence intervals, as well as paired tests to compare the hybrid model with the base models and voting ensemble. Based on the evaluation metrics, the stacking ensemble achieved perfect performance for Class 0, with 100% accuracy, precision, recall, specificity, F1 score, and AUROC, alongside the highest calibration metrics (Brier Score: 99.9, ECE: 98.7). The Random Forest model also excelled, achieving 100% accuracy, precision, recall, specificity, and F1 score for Class 0 and Class 2. In contrast, the KNN model consistently underperformed, particularly for Class 0 (F1: 83.3, Precision: 83.3, Recall: 83.3). The Neural Network demonstrated strong recall for Class 0 (100%), while the voting ensemble showed balanced results but was slightly outperformed by the top ensemble methods. Explainable AI analyses using LIME and SHAP revealed that glucose was the most influential predictor for identifying the Pre-diabetes state. Both methods consistently identified a decision band between 0.35 and 0.47 (corresponding to 100-125 mg/dL) as the transition zone between "Normal" and "Prediabetes", confirming the model's alignment with WHO/ADA diagnostic criteria. The stacking model achieved perfect performance and superior calibration, outperforming all other models in type 2 diabetes prediction and classification. Explainability techniques (LIME and SHAP) identified glucose level, body mass index, and blood pressure as key predictive factors. This approach provides an accurate and interpretable tool for clinical decision support in healthcare systems.

Fetched live from OpenAlex and de-inverted. Abstracts are not stored in this database: the inverted indexes are 8.6 GB of the frame’s 9.3 GB of text, and the host has 13 GB free.

How this classification was reachedexpand

Full frame distilled prediction

Teacher imitation

Not calibrated prevalence, not ground truth. Human validation pending. Learned from the 10,348 direct Codex labels and 10,348 direct Gemma labels. Candidate is the union of thresholded teacher heads; consensus is their intersection. These outputs are machine_predicted_unvalidated and are not human labels or direct frontier model labels.

metaresearch head score (Codex)0.002
metaresearch head score (Gemma)0.001
Version: codex-gemma-dda1882f352aValidation status: machine_predicted_unvalidated
Candidate categoriesScience and technology studies
Consensus categoriesnone
DomainCandidate signal: none · Consensus signal: none
Study designCandidate signal: Simulation or modeling · Consensus signal: none
GenreCandidate signal: Empirical · Consensus signal: Empirical
Teacher disagreement score0.928
Threshold uncertainty score0.998

Codex and Gemma teacher scores by category

CategoryCodexGemma
Metaresearch0.0020.001
Meta-epidemiology (narrow)0.0000.000
Meta-epidemiology (broad)0.0000.000
Bibliometrics0.0000.001
Science and technology studies0.0030.000
Scholarly communication0.0000.000
Open science0.0000.000
Research integrity0.0000.001
Insufficient payload (model declined to judge)0.0000.000

Machine scores (provisional)

The two teacher heads of the student model, read on this work. A score orders the frame for review; it never asserts a category, and the validation status ships verbatim with every row.

Baseline scores from an immature model (maturity gate not passed, 7 training rounds). Scores rank; they never assert a category.

Opus teacher head0.149
GPT teacher head0.422
Teacher spread0.273 · how far apart the two teachers sit on this one work
Validation statusscore_only:v0-immature-baseline · verbatim from the scoring run: score_only means the number may rank works, and no category label ships from it

Classification

machine, unvalidated

Machine predicted; a candidate call from one teacher head, not a consensus.

Study designSimulation or modeling
Domainnot available
GenreEmpirical

How this classification was reached, model by model and score by score, is at the end of the page under "How this classification was reached".

Quick stats

Citations3
Published2025
Admission routes1
Has abstractyes

Explore more

Same venueScientific ReportsSame topicArtificial Intelligence in HealthcareFrench-language works237,207