Explainable machine learning for the classification of prevalent cardiovascular disease using clinical and nutritional factors in United States adults: a cross-sectional analysis of the National Health and Nutrition Examination Survey 2011–2018
Background and aims: Machine learning (ML) is increasingly applied to the National Health and Nutrition Examination Survey (NHANES) to classify cardiovascular disease (CVD), but whether it outperforms logistic regression, and whether dietary intake adds information beyond clinical variables, is uncertain. Because NHANES is cross-sectional, such models classify prevalent disease rather than predict future risk. We developed and internally validated explainable ML models for prevalent, self-reported CVD in US adults using a leakage-safe pipeline, compared six algorithms against conventional logistic regression, and compared clinical-only, dietary-only and combined predictor sets. Methods: We analysed 19,404 adults aged ≥20 years from NHANES 2011–2018 with complete self-reported CVD status (heart failure, coronary heart disease, angina, myocardial infarction or stroke), at least one 24-hour dietary recall, and examination data. The sample was split 80:20 before any data-dependent processing. Within the development set, multivariate imputation, correlation filtering, LASSO selection and 1:1 down-sampling were nested inside repeated 5-fold cross-validation (2 repeats) to tune six algorithms (elastic-net logistic regression, random forest, naive Bayes, support-vector machine, XGBoost, LightGBM). Performance was assessed once on the test set using ROC-AUC, PR-AUC, Brier score, calibration intercept/slope, and decision-curve analysis, with bootstrap confidence intervals (CIs). Predicted probabilities were corrected for down-sampling. SHAP values were computed for the final LightGBM models. Results: Prevalent CVD was reported by 2,117 participants (10.9%). The combined LightGBM model discriminated well (ROC-AUC 0.843 [0.825–0.861]; PR-AUC 0.409 [0.364–0.462] vs. a 0.109 prevalence baseline) and, after down-sampling correction, was adequately calibrated (intercept 0.043 [−0.074–0.151], slope 0.989 [0.906–1.086], Brier 0.078 [0.072–0.084]), with net benefit over classify-all/none across thresholds of 1–50%. Cross-validated and test ROC-AUC were similar (0.862 and 0.843), and discrimination was similar across sex, race/ethnicity, education and income groups but lower within age strata. In the unweighted test set the six algorithms did not outperform conventional logistic regression (LightGBM minus conventional: 0.009 [−0.000 to 0.020]), and clinical predictors carried nearly all discriminative information (combined minus clinical: −0.0004 [−0.004 to 0.003]); dietary-only discrimination was poor (0.587 [0.558–0.615]). Age, hypertension, total cholesterol, poverty-income ratio, kidney function and red-cell distribution width had the largest SHAP attributions. Conclusions: Explainable gradient-boosting models classified prevalent, self-reported CVD with good discrimination but not clearly better than logistic regression, and dietary intake added little beyond clinical measures. Cross-sectional design, self-reported outcome and lack of external validation limit these models to epidemiological description and hypothesis generation, and support simple clinical models as the starting point for prospective analyses.