header

Development and Real-Time Clinical Validation of a Stacked Ensemble Machine Learning Framework for Early-Onset Type 2 Diabetes Prediction Using Longitudinal Electronic Health Records (EHR)

Authors
  • Asher Noah

    covenant University
    Author
Keywords:
Type 2 Diabetes Prediction, Stacked Ensemble Learning, Electronic Health Records, Machine Learning, Early Detection, Clinical Decision Support, Longitudinal Data Analysis
Abstract

Type 2 diabetes mellitus (T2DM) represents a growing global health crisis, with prevalence projected to reach 783 million by 2045, necessitating innovative approaches for early detection and intervention. Traditional diagnostic methods, while clinically valuable, detect diabetes only after glycemic thresholds are crossed, missing the critical window for preventive intervention. Although machine learning has shown promise in diabetes prediction, existing models suffer from limited generalizability, lack of real-time clinical validation, and inadequate handling of longitudinal electronic health record (EHR) data complexity. This study addresses these gaps by developing and prospectively validating a stacked ensemble machine learning framework for early-onset T2DM prediction using longitudinal EHR data from 401,696 patients. The proposed two-layer ensemble architecture integrates Light Gradient Boosting Machine (LGBM), Extreme Gradient Boosting (XGBoost), and Categorical Boosting (CatBoost) as base learners, with a Support Vector Machine (SVM) meta-learner optimized through recursive feature elimination with cross-validation (RFECV). The framework achieved an accuracy of 99.04%, precision of 0.99, recall of 0.98, and F1-score of 0.975, with an AUC of 1.00, significantly outperforming individual classifiers and existing ensemble approaches. Key predictive features identified included BMI, fasting glucose trajectory, comorbid conditions, and medication patterns. Real-time clinical validation demonstrated the framework's utility in clinical decision support, enabling risk stratification with a lead time of 12 months before clinical diagnosis. This research contributes a validated, interpretable, and scalable framework for early T2DM prediction, with significant implications for precision public health and clinical practice.

Cover Image
Downloads
Published
06/30/2026
Section
Articles
License

Copyright (c) 2026 Asher Noah (Author)

Creative Commons License

This work is licensed under a Creative Commons Attribution 4.0 International License.

How to Cite

Development and Real-Time Clinical Validation of a Stacked Ensemble Machine Learning Framework for Early-Onset Type 2 Diabetes Prediction Using Longitudinal Electronic Health Records (EHR). (2026). The Science Post, 2(2). https://www.thesciencepostjournal.com/index.php/tsp/article/view/159