Research Square · Oct 20, 2026

Avoiding Data Leakage in Machine Learning Models for Diabetes and Hypertension Classification Using Routine Occupational Health Screening Data

By Alizadeh-dizaj G, Amiri-Ara M, Teymourzadeh E et al.

Background and Aim: Reliable clinical prediction using machine learning requires leakage-free model development, yet this critical methodological concern is often overlooked. Type 2 diabetes and hypertension represent major public health challenges in Iran, and early identification of at-risk individuals using routine workplace health screening data could enable cost-effective prevention. This study had a dual objective: first, to develop and validate machine learning models for identifying diabetes and hypertension using routine occupational health screening data; and second and more critically to demonstrate how the inclusion of outcome-defining predictors (fasting blood glucose and blood pressure) artificially inflates model performance through data leakage, a methodological pitfall often overlooked in clinical prediction studies. By comparing 'full' models (with all predictors) against 'clinically meaningful' models (excluding outcome-defining variables), we provide empirical evidence of the magnitude of this bias and offer a transparent framework for avoiding it in similar studies. Methods A retrospective cross-sectional analysis was conducted on 370 health screening records. Five algorithms Decision Tree, Ridge Classifier, Logistic Regression, XGBoost, and Random Forest were developed and compared. Two modeling strategies were implemented: (1) a full model including all predictors, and (2) a clinically meaningful model excluding outcome-defining predictors (fasting blood glucose and blood pressure). The dataset was split into 80% training and 20% testing sets. Five-fold cross-validation was used for hyperparameter optimization, and SMOTE was applied solely to the training set to address class imbalance. Performance was evaluated using accuracy, sensitivity, specificity, F1 score, AUC-ROC with 95% CI, calibration plots, and Brier scores. Feature importance was assessed using SHAP values. Results The prevalence of diabetes and hypertension was 18.4% (68 cases) and 20.5% (76 cases), respectively. In the clinically meaningful models that excluded outcome-defining predictors (fasting blood glucose and blood pressure), discrimination performance was moderate, with Random Forest achieving an AUC-ROC of 78.34% (95% CI: 72.15–84.92) for diabetes and 76.81% (95% CI: 70.23–83.45) for hypertension. In contrast, when these predictors were included in the full models, performance was artificially inflated (Random Forest AUC-ROC: 96.22% for diabetes and 94.59% for hypertension), confirming substantial data leakage. XGBoost performed comparably in both approaches. SHAP analysis identified age, BMI, waist circumference, and psychological distress (GSI) as the most important non-outcome predictors. Conclusion After excluding outcome-defining predictors to prevent data leakage, machine learning models particularly Random Forest and XGBoost showed moderate but clinically realistic discriminative ability for identifying diabetes and hypertension using routine screening data. Psychological variables contributed meaningfully to prediction, supporting integrated physical and mental health screening in occupational settings. External validation in independent cohorts is required before clinical implementation.

doi.org/10.21203/rs.3.rs-10780902/v1Open accessBiomarkers

AgingResearch.News