Development and validation of an interpretable machine learning model for predicting 5-year major adverse cardiovascular events in patients with coronary artery disease Authors: Zhongxing Jiang, Haofeng Zhou, Yindu Liu, Han Yin, Junshuo Zhu, Xiaoya Xiong, Jinna Chang, Rou Wang, Huan Ma Published: 2026 ABSTRACT BackgroundCoronary artery disease (CAD) remains a major contributor to global cardiovascular mortality and accurate prognosis is critical for guiding clinical decision-making. This study aimed to develop and validate interpretable machine learning (ML) models for predicting 5-year major adverse cardiovascular events (MACE) in hospitalized CAD patients.MethodsA prospective cohort of 705 CAD patients was included and randomly divided into training (n = 494) and validation (n = 211) sets. Key predictors were selected using least absolute shrinkage and selection operator (LASSO) regression. Four survival-based models were developed, and model performance was assessed using discrimination, calibration, and decision curve analysis. Shapley Additive Explanations (SHAP) analysis was applied to enhance model interpretability.ResultsA total of 705 hospitalized CAD patients were included (mean age 63.2 years; 72.5% men), of whom 221 (31.3%) developed MACEs during the 5-year follow-up. LASSO regression revealed 11 key predictors, including left ventricular ejection fraction (LVEF), N-terminal pro-B-type natriuretic peptide (NT-proBNP) level, nitrate use, CAD duration, depressive symptoms, and age. Among the four models, the random survival forest (RSF) model showed favourable discrimination performance, with C-index of 0.804 (95% CI: 0.770–0.837) in the training cohort and 0.710 (95% CI: 0.650–0.768) in the validation cohort. The RSF model also showed acceptable calibration, achieving the lowest Brier score in the validation cohort. Decision curve analysis (DCA) demonstrated that the RSF model provided potential clinical benefit over the treat-all and treat-none strategies across a wide range of risk thresholds. SHAP analysis revealed that the LVEF, age, and number of diseased vessels were the most important predictors of 5-year MACEs.ConclusionsThe RSF model demonstrated relatively favourable discrimination, calibration, and clinical utility for predicting 5-year MACEs in hospitalized CAD patients. These findings suggest that ML-based approaches may assist in individualized risk stratification and guide secondary prevention strategies.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12872-026-06103-1. Introduction Coronary artery disease (CAD) remains a leading global cause of morbidity and mortality and poses a significant public health burden [1, 2]. According to the Global Burden of Disease study, ischaemic heart disease, the most common manifestation of CAD, consistently ranks among the top causes of death and disability-adjusted life years globally [3]. Despite advances in medical therapy, revascularization techniques, and secondary prevention strategies, patients with CAD continue to face substantial long-term risks [4]. Critically, the postdischarge period represents a high-risk phase rather than an endpoint of vulnerability [5, 6]. These events can significantly impact long-term survival, quality of life, and health care utilization. Consequently, effective long-term risk stratification is essential—not only to identify high-risk individuals but also to personalize postdischarge secondary prevention strategies. Traditional prognostic models for CAD patients, such as the simple integer risk score [7] and the biomarker-based ABC-CHD model [8], rely on a relatively limited set of clinical or biomarker variables and were developed primarily in stable outpatient populations, which may limit their applicability to broader hospitalized CAD cohorts. Their performance in real-world clinical settings, particularly for long-term outcomes, remains suboptimal [9]. Machine learning (ML) approaches offer the ability to model complex, nonlinear relationships and integrate a broader range of routinely collected features, including advanced imaging, detailed laboratory values, and granular clinical parameters [10, 11]. This expanded feature space enables improved risk stratification and predictive performance. While ML has demonstrated improved predictive capabilities for CAD patients, many prior studies have either concentrated on short-term outcomes or have been restricted to specific clinical contexts—such as percutaneous coronary intervention (PCI)-treated patients or those with suspected CAD—limiting its generalizability to broader cohorts and long-term secondary prevention [9, 12]. In this study, we aimed to develop and validate ML-based models for predicting 5-year MACEs among hospitalized CAD patients. By leveraging routinely collected clinical data, we sought to improve long-term risk stratification and support individualized care in secondary prevention. Methods Design and participants This prospective cohort study included 705 consecutive inpatients with a main admitting diagnosis of CAD and without the urgency for emergency PCI or intensive care at Guangdong Provincial People’s Hospital between October 2017 and January 2018. CAD was defined as the presence of at least one coronary artery stenosis ≥ 50% identified by coronary angiography. Patients underwent coronary angiography during hospitalization, and revascularization was performed according to the 2023 AHA/ACC Guidelines for the Management of Patients with Chronic Coronary Disease [13], including stent implantation or balloon angioplasty when clinically indicated. Baseline clinical data, including routine examinations, coronary angiography (CAG) results, and discharge diagnoses, were extracted from the patients’ electronic medical records. Participants were randomly assigned to a training cohort (n = 494) or a validation cohort (n = 211) at a 7:3 ratio. This study was conducted in accordance with the Declaration of Helsinki and was approved by the Medical Ethics Committee of Guangdong Provincial People’s Hospital. Written informed consent was obtained from all participants. Study variables Outcome variables The primary outcome was 5-year MACE occurrence, which was defined as a composite of cardiac death, unplanned revascularization, cardiac rehospitalization, nonfatal myocardial infarction, and stroke. Outcome data were extracted from electronic medical records and independently verified through structured annual telephone interviews with patients or their families. Participants were prospectively followed on an annual basis for up to five years. Follow-up was censored at the earliest occurrence of a MACE, all-cause death, loss to follow-up, or study termination on January 31, 2023. Participants who were lost to follow-up or who did not experience the endpoint were censored at the date of last contact. For the primary time-to-event analysis, only the first occurrence of any MACE component was considered the endpoint. Individual components were additionally summarized for descriptive purposes and were not mutually exclusive, as more than one event could have occurred in the same patient during follow-up. Predictors A total of 50 candidate predictors were selected for model development on the basis of clinical relevance, routine availability, and evidence from the literature. All the candidate predictors were collected at baseline during the index hospitalization. These variables included five categories: (1) demographic and lifestyle factors, such as age, sex, and body mass index (BMI); (2) psychological factors, such as depressive symptoms and anxiety symptoms, which were assessed using two standardized self-report questionnaires—the Patient Health Questionnaire-9 (PHQ-9) [14] and the Generalized Anxiety Disorder-7 (GAD-7) [15]—administered by the same researcher to all patients during hospitalization, typically on the night before the index procedure. Depressive symptoms and anxiety symptoms were defined as PHQ-9 and GAD-7 scores ≥ 9, respectively; (3) clinical history and comorbidities, such as CAD duration, hypertension, and diabetes mellitus; (4) medication and intervention history, such as aspirin use, statin therapy, and previous PCI; and (5) imaging and laboratory findings, such as left ventricular ejection fraction (LVEF), fasting glucose, and N-terminal pro-B-type natriuretic peptide (NT-proBNP) level. Detailed definitions, measurement methods, and coding schemes for all the predictors are provided in Supplementary Table S1. Statistical analysis Data preparation Missing data among candidate predictors were handled using multiple imputation by chained equations under the missing-at-random assumption. Imputation was performed separately within the training and validation cohorts to avoid information leakage. Five imputed datasets were generated using predictive mean matching for continuous variables and logistic or polytomous regression for categorical variables, as appropriate. The imputation model included all the candidate predictors, follow-up time, and event status to preserve the associations between the predictors and outcomes. Baseline characteristics were compared between patients with and without a MACE and between the training and validation cohorts. Student’s t-test was used to compare continuous variables, and the chi-square test was used for categorical variables. A two-sided p value < 0.05 was considered to indicate statistical significance. All analyses were conducted using R software (version 4.4.3). Variable selection To reduce model complexity and identify the most informative predictors of 5-year MACEs, the least absolute shrinkage and selection operator (LASSO) regression was applied using the glmnet package in R. All the predictors were standardized before modelling. The optimal regularization parameter (lambda) was determined using 10-fold cross-validation within the training set on the basis of the minimum mean cross-validated partial likelihood deviance (lambda.min). Variables with nonzero coefficients at lambda.min were selected for subsequent model construction. Model development Four survival-based models were used to develop prediction models for 5-year MACE: Cox proportional hazard (CoxPH), random survival forest (RSF), gradient boosting machine (GBM), and extreme gradient boosting (XGBoost). CoxPH is a classical semiparametric regression model widely used for time-to-event analysis that estimates the hazard of an event as a function of covariates. RSF is an ensemble tree-based method that extends the random forest algorithm to survival data by constructing multiple survival trees and aggregating their predictions. GBM is a boosting-based ensemble learning technique that sequentially builds decision trees to minimize prediction error and improve predictive performance. XGBoost is an optimized implementation of gradient boosting that incorporates regularization and efficient computational strategies to increase model accuracy and scalability. The hyperparameters for each model were tuned using a grid search with 10-fold cross-validation in the training cohort. The RSF hyperparameters used for model training are detailed in Supplementary Table S2. Performance evaluation Model performance was assessed in terms of discrimination, calibration, and clinical utility. Discrimination was evaluated using the C-index. Calibration was assessed via Brier scores and visualized with calibration plots. Clinical utility was evaluated using decision curve analysis (DCA). To further assess model robustness, additional analyses were performed, including bootstrap-based internal validation with 500 resamples to estimate optimism-corrected C-index values, followed by subgroup analysis according to heart failure (HF) status. Model interpretability To enhance the interpretability of the machine learning models, Shapley Additive Explanations (SHAP) were applied to explain the contribution of each predictor to the predicted risk of 5-year MACE [16]. SHAP is a model-agnostic interpretation method based on cooperative game theory that assigns each feature an attribution value, known as the SHAP value, representing its marginal contribution to the model prediction. SHAP values quantify how each predictor influences the model output for a given observation, thereby improving the transparency of the model’s decision-making process. Higher SHAP values indicate a stronger contribution to an increased predicted risk of MACEs. Global feature importance was evaluated using the mean absolute SHAP value of each predictor across all observations. In addition, SHAP dependence plots were used to visualize the relationships between individual predictors and their corresponding SHAP values, illustrating how changes in predictor values influence the model output. Model performance comparison The ABC-CHD model is a validated risk tool for predicting long-term major adverse cardiovascular events and incorporates key clinical and laboratory variables, including age, smoking status, diabetes mellitus status, peripheral artery disease history, high-sensitivity troponin T levels, NT-proBNP levels, and LDL-C levels. Differences in the C-index between the ABC-CHD model and the optimal ML model were assessed using the compareC package, which provides a z test for the difference in the C-index. Results Participant characteristics Among 705 hospitalized CAD patients, 221 (31.3%) developed a MACE within 5 years. The distributions of individual MACE components are presented in Supplementary Table S3. Because this was a composite endpoint, patients could experience more than one event during follow-up, resulting in a total number of component events exceeding the number of patients with MACE. The baseline characteristics of patients with and without MACEs are summarized in Table 1. Compared with non-MACE patients, those who experienced MACEs were more likely to be older and have a longer CAD duration, lower LVEF, higher NT-proBNP levels, a history of stroke, an advanced New York Heart Association (NYHA) functional class, and elevated blood urea nitrogen (BUN) and creatinine levels. They were also more likely to have received nitrate therapy, undergo multistent PCI, and present with extensive coronary artery disease. The baseline characteristics of the training and validation cohorts are shown in Supplementary Table S4, and the demographic, clinical, and biochemical profiles of the two cohorts were generally comparable. The distribution of the LVEF in the study population is presented in Supplementary Figure S1, and the cumulative incidence of each component during follow-up is illustrated in Supplementary Figure S2. Table 1Characteristics of subjects with or without MACEPredictorsNon-MACE (n = 484)MACE (n = 221)x2/W/t ap- valueAge, Mean ± SD62.32 ± 10.1464.98 ± 10.84−3.070.002*Sex, n(%)Female129(26.7)65(29.4)0.450.503Male355(73.3)156(70.6)Body mass index(kg/m2), Mean ± SD24.55 ± 3.0824.17 ± 3.641.330.184Marriage, n(%)Divorced or Widowed or Single32(6.6)9(4.1%)1.350.245Married452(93.4)212(95.9)Education, n(%)Less than 6 years131(27.1)75(33.9)4.590.2047–9 years149(30.8)54(24.4)10–12 years101(20.9)45(20.4)More than 12 years103(21.3)47(21.3)Sleep quality, n(%)Good104(21.5)50(22.6)5.80.122Fair202(41.7)78(35.3)Poor120(24.8)53(24%)Very poor58(12)40(18.1)Smoking status, n(%)Previous/current210(43.4)104(47.1)0.690.408Depressive symptoms, n(%)56 (12)38 (17)3.680.055Anxiety symptoms, n(%)32 (7)20 (9)0.990.320CAD duration(months), Mean ± SD31.06 ± 48.9340.29 ± 51.33−2.250.025*NYHA, n(%)Class I186 (38)68 (31)17.4< 0.001*Class II248 (51)107 (48)Class III42 (9)33 (15)Class III-IV8 (2)13 (6)Medical historyHypertension, n(%)283(58.5)133(60.2)0.120.730Diabetes mellitus, n(%)149(30.8)74(33.5)0.390.530Stroke22 (5)21 (10)5.670.017*Medication useAspirin, n(%)397 (82)188 (85)0.790.374Clopidogrel or Ticagrelor, n(%)360 (74)179 (81)3.330.068Anticoagulants, n(%)23 (5)14 (6)0.480.489Statin, n(%)436(90.1)208(94.1)2.640.104βBlocker, n(%)389(80.4)187(84.6)1.550.212ACEI or ARB, n(%)325(67.1)158(71.5)1.130.287Nitrates, n(%)50(10.3)36(16.3)4.490.034*CCB, n(%)108(22.3)53(24)0.150.695Previous PCI, n(%)Never359(74)146(66)14.370.039*One stent60(12)27(12)Two stents35(7)23(10)Three or more stents30(6)25(11)Number of diseased vessels, n(%)Single vessel186 (38)57 (25)13.50.004*Two vessels90 (19)41 (19)Three vessels208 (43)123 (56)Left main CAD, n(%)No396 (82)179 (81)0.020.876Yes88 (18)42 (19)HbA1c(%), Mean ± SD6.52 ± 1.416.76 ± 1.61−1.940.054Fast glucose(mmol/L), Mean ± SD6.28 ± 2.726.66 ± 2.87−1.650.099CREA(µmol/L), Mean ± SD94.87 ± 31.72105.8 ± 64.91−2.380.018*BUN(mmol/L), Mean ± SD6.17 ± 2.047.17 ± 3.65−3.83< 0.001*TC(mmol/L), Mean ± SD4.46 ± 1.324.34 ± 1.181.250.212HDL-C(mmol/L), Mean ± SD1 ± 0.240.96 ± 0.232.180.030*LDL-C(mmol/L), Mean ± SD2.89 ± 0.922.83 ± 0.880.840.403TG(mmol/L), Mean ± SD1.74 ± 1.71.77 ± 1.27−0.250.804ApoA(g/L), Mean ± SD1.14 ± 0.181.13 ± 0.181.090.277ApoB(g/L), Mean ± SD0.91 ± 0.270.9 ± 0.260.710.479Lpa(nmol/L), Median (IQR)162.00(88.00,344.50)180.00(91.00,366.00)52,2830.633FT3(pmol/L), Mean ± SD4.86 ± 0.84.77 ± 0.861.310.189FT4(pmol/L), Mean ± SD12.5 ± 9.513.37 ± 12.44−0.920.360TSH(mIU/L), Mean ± SD1.92 ± 3.511.82 ± 1.650.560.578CK(U/L), Mean ± SD115.39 ± 98.87128.77 ± 146.84−1.230.218CKMB(U/L), Mean ± SD11.86 ± 7.6112.72 ± 8.84−1.260.208NT-proBNP(ng/L), Median (IQR)162.05(55.95,992.36)515.80(108.30,992.36)41,140< 0.001*PT(s), Mean ± SD13.65 ± 1.1513.86 ± 1.19−2.170.031*APTT(s), Mean ± SD37.99 ± 4.338.04 ± 4.63−0.150.883FIB(g/L), Mean ± SD3.94 ± 1.14.08 ± 1.15−1.470.143TT(s), Mean ± SD17.14 ± 8.0617.57 ± 8.43−0.630.527INR, Mean ± SD1.05 ± 0.121.06 ± 0.11−1.560.120D-dimer(µg/mL), Median (IQR)375.00(270.00–660.00)440.00(310.00–710.00)47,4560.016hs-CRP(mg/L), Median (IQR)3.84(0.93,8.74)5.70(1.27,8.74)48,2170.035LVEF(%), Median (IQR)62.00(58.20,65.00)59.00(46.00,64.00)64,007< 0.001*Abbreviations: CAD Coronary artery disease, NYHA New York Heart Association functional classification, ACEI Angiotensin-converting enzyme inhibitor, ARB Angiotensin receptor blocker, CCB Calcium channel blocker, PCI Percutaneous coronary intervention, HbA1c Glycated hemoglobin A1c, Fast glucose Fasting blood glucose, CREA Creatinine, BUN Blood urea nitrogen, TC Total cholesterol, HDL-C High density lipoprotein cholesterol, LDL-C Low density lipoprotein cholesterol, TG Triglyceride, ApoA Apolipoprotein A1, ApoB Apolipoprotein B, Lpa Lipoprotein(a), FT3 Free triiodothyronine, FT4 Free thyroxine, TSH Thyroid-stimulating hormone, CK Creatine kinase, CKMB Creatine kinase MB isoenzyme, NT-proBNP N-terminal pro-brain natriuretic peptide, PT Prothrombin time, APTT Activated partial thromboplastin time, FIB Fibrinogen, TT Thrombin time, INR International normalized ratio, hs-CRP High sensitivity C-reactive protein, LVEF Left ventricular ejection fractionaThe comparative analyses for continuous variables were conducted using Student’s t test and Wilcoxon rank-sum test. Categorical variables were compared using the Chi-square test* p < 0.05 Table 1Characteristics of subjects with or without MACEPredictorsNon-MACE (n = 484)MACE (n = 221)x2/W/t ap- valueAge, Mean ± SD62.32 ± 10.1464.98 ± 10.84−3.070.002*Sex, n(%)Female129(26.7)65(29.4)0.450.503Male355(73.3)156(70.6)Body mass index(kg/m2), Mean ± SD24.55 ± 3.0824.17 ± 3.641.330.184Marriage, n(%)Divorced or Widowed or Single32(6.6)9(4.1%)1.350.245Married452(93.4)212(95.9)Education, n(%)Less than 6 years131(27.1)75(33.9)4.590.2047–9 years149(30.8)54(24.4)10–12 years101(20.9)45(20.4)More than 12 years103(21.3)47(21.3)Sleep quality, n(%)Good104(21.5)50(22.6)5.80.122Fair202(41.7)78(35.3)Poor120(24.8)53(24%)Very poor58(12)40(18.1)Smoking status, n(%)Previous/current210(43.4)104(47.1)0.690.408Depressive symptoms, n(%)56 (12)38 (17)3.680.055Anxiety symptoms, n(%)32 (7)20 (9)0.990.320CAD duration(months), Mean ± SD31.06 ± 48.9340.29 ± 51.33−2.250.025*NYHA, n(%)Class I186 (38)68 (31)17.4< 0.001*Class II248 (51)107 (48)Class III42 (9)33 (15)Class III-IV8 (2)13 (6)Medical historyHypertension, n(%)283(58.5)133(60.2)0.120.730Diabetes mellitus, n(%)149(30.8)74(33.5)0.390.530Stroke22 (5)21 (10)5.670.017*Medication useAspirin, n(%)397 (82)188 (85)0.790.374Clopidogrel or Ticagrelor, n(%)360 (74)179 (81)3.330.068Anticoagulants, n(%)23 (5)14 (6)0.480.489Statin, n(%)436(90.1)208(94.1)2.640.104βBlocker, n(%)389(80.4)187(84.6)1.550.212ACEI or ARB, n(%)325(67.1)158(71.5)1.130.287Nitrates, n(%)50(10.3)36(16.3)4.490.034*CCB, n(%)108(22.3)53(24)0.150.695Previous PCI, n(%)Never359(74)146(66)14.370.039*One stent60(12)27(12)Two stents35(7)23(10)Three or more stents30(6)25(11)Number of diseased vessels, n(%)Single vessel186 (38)57 (25)13.50.004*Two vessels90 (19)41 (19)Three vessels208 (43)123 (56)Left main CAD, n(%)No396 (82)179 (81)0.020.876Yes88 (18)42 (19)HbA1c(%), Mean ± SD6.52 ± 1.416.76 ± 1.61−1.940.054Fast glucose(mmol/L), Mean ± SD6.28 ± 2.726.66 ± 2.87−1.650.099CREA(µmol/L), Mean ± SD94.87 ± 31.72105.8 ± 64.91−2.380.018*BUN(mmol/L), Mean ± SD6.17 ± 2.047.17 ± 3.65−3.83< 0.001*TC(mmol/L), Mean ± SD4.46 ± 1.324.34 ± 1.181.250.212HDL-C(mmol/L), Mean ± SD1 ± 0.240.96 ± 0.232.180.030*LDL-C(mmol/L), Mean ± SD2.89 ± 0.922.83 ± 0.880.840.403TG(mmol/L), Mean ± SD1.74 ± 1.71.77 ± 1.27−0.250.804ApoA(g/L), Mean ± SD1.14 ± 0.181.13 ± 0.181.090.277ApoB(g/L), Mean ± SD0.91 ± 0.270.9 ± 0.260.710.479Lpa(nmol/L), Median (IQR)162.00(88.00,344.50)180.00(91.00,366.00)52,2830.633FT3(pmol/L), Mean ± SD4.86 ± 0.84.77 ± 0.861.310.189FT4(pmol/L), Mean ± SD12.5 ± 9.513.37 ± 12.44−0.920.360TSH(mIU/L), Mean ± SD1.92 ± 3.511.82 ± 1.650.560.578CK(U/L), Mean ± SD115.39 ± 98.87128.77 ± 146.84−1.230.218CKMB(U/L), Mean ± SD11.86 ± 7.6112.72 ± 8.84−1.260.208NT-proBNP(ng/L), Median (IQR)162.05(55.95,992.36)515.80(108.30,992.36)41,140< 0.001*PT(s), Mean ± SD13.65 ± 1.1513.86 ± 1.19−2.170.031*APTT(s), Mean ± SD37.99 ± 4.338.04 ± 4.63−0.150.883FIB(g/L), Mean ± SD3.94 ± 1.14.08 ± 1.15−1.470.143TT(s), Mean ± SD17.14 ± 8.0617.57 ± 8.43−0.630.527INR, Mean ± SD1.05 ± 0.121.06 ± 0.11−1.560.120D-dimer(µg/mL), Median (IQR)375.00(270.00–660.00)440.00(310.00–710.00)47,4560.016hs-CRP(mg/L), Median (IQR)3.84(0.93,8.74)5.70(1.27,8.74)48,2170.035LVEF(%), Median (IQR)62.00(58.20,65.00)59.00(46.00,64.00)64,007< 0.001*Abbreviations: CAD Coronary artery disease, NYHA New York Heart Association functional classification, ACEI Angiotensin-converting enzyme inhibitor, ARB Angiotensin receptor blocker, CCB Calcium channel blocker, PCI Percutaneous coronary intervention, HbA1c Glycated hemoglobin A1c, Fast glucose Fasting blood glucose, CREA Creatinine, BUN Blood urea nitrogen, TC Total cholesterol, HDL-C High density lipoprotein cholesterol, LDL-C Low density lipoprotein cholesterol, TG Triglyceride, ApoA Apolipoprotein A1, ApoB Apolipoprotein B, Lpa Lipoprotein(a), FT3 Free triiodothyronine, FT4 Free thyroxine, TSH Thyroid-stimulating hormone, CK Creatine kinase, CKMB Creatine kinase MB isoenzyme, NT-proBNP N-terminal pro-brain natriuretic peptide, PT Prothrombin time, APTT Activated partial thromboplastin time, FIB Fibrinogen, TT Thrombin time, INR International normalized ratio, hs-CRP High sensitivity C-reactive protein, LVEF Left ventricular ejection fractionaThe comparative analyses for continuous variables were conducted using Student’s t test and Wilcoxon rank-sum test. Categorical variables were compared using the Chi-square test* p < 0.05 Characteristics of subjects with or without MACE Depressive symptoms , n(%) Abbreviations: CAD Coronary artery disease, NYHA New York Heart Association functional classification, ACEI Angiotensin-converting enzyme inhibitor, ARB Angiotensin receptor blocker, CCB Calcium channel blocker, PCI Percutaneous coronary intervention, HbA1c Glycated hemoglobin A1c, Fast glucose Fasting blood glucose, CREA Creatinine, BUN Blood urea nitrogen, TC Total cholesterol, HDL-C High density lipoprotein cholesterol, LDL-C Low density lipoprotein cholesterol, TG Triglyceride, ApoA Apolipoprotein A1, ApoB Apolipoprotein B, Lpa Lipoprotein(a), FT3 Free triiodothyronine, FT4 Free thyroxine, TSH Thyroid-stimulating hormone, CK Creatine kinase, CKMB Creatine kinase MB isoenzyme, NT-proBNP N-terminal pro-brain natriuretic peptide, PT Prothrombin time, APTT Activated partial thromboplastin time, FIB Fibrinogen, TT Thrombin time, INR International normalized ratio, hs-CRP High sensitivity C-reactive protein, LVEF Left ventricular ejection fraction aThe comparative analyses for continuous variables were conducted using Student’s t test and Wilcoxon rank-sum test. Categorical variables were compared using the Chi-square test * p < 0.05 Variable selection results LASSO regression with 10-fold cross-validation was used to identify the most relevant predictors of 5-year MACE, and variables corresponding to the minimum cross-validated partial likelihood deviance (lambda.min) were selected for subsequent model construction (Supplementary Figure S3). At this lambda value, 11 variables with nonzero coefficients were retained, including age, stroke, NYHA functional class, previous PCI, number of diseased vessels, CAD duration, depressive symptoms, nitrate use, NT-proBNP level, BUN level, and LVEF. Most of these predictors have well-established associations with adverse cardiovascular outcomes. The selected predictors were subsequently used for model development across the four survival-based prediction models. Prediction performance for 5-year MACE The performance of all four models is illustrated in Table 2. When all the variables were included, the XGBoost model achieved the highest discrimination in the training cohort with a C-index of 0.792 (95% CI: 0.754–0.829). In the validation cohort, the RSF and GBM models demonstrated the best discrimination (both C-index = 0.640). In terms of overall predictive accuracy, the XGBoost model yielded the lowest Brier score in the training cohort (0.105), and the RSF and GBM models both achieved the lowest Brier scores in the validation cohort (0.153). The time-dependent ROC curves of the RSF model are presented in Fig. 1. Table 2Comparing the predictive performance of different modelsModelsCoxPHRSFGBMXGBoostModels trained with all variables Training cohort C-index0.720(0.670–0.767)0.778(0.740–0.810)0.729(0.685–0.770)0.792(0.754–0.829) Validation cohort C-index0.604(0.542–0.669)0.640(0.572–0.710)0.640(0.561–0.712)0.629(0.555–0.696) Training cohort Brier score0.110(0.095–0.128)0.107(0.091–0.123)0.121(0.107–0.140)0.105(0.094–0.121) Validation cohort Brier score0.165(0.135–0.201)0.153(0.125–0.185)0.153(0.117–0.190)0.158(0.122–0.194)Models trained with top 11 variables Training cohort C-index0.721(0.677–0.764)0.804(0.770–0.837)0.791(0.757–0.827)0.797(0.758–0.832) Validation cohort C-index0.663(0.599–0.730)0.710(0.650–0.768)0.691(0.629–0.750)0.676(0.613–0.730) Training cohort Brier score0.120(0.104–0.138)0.103(0.087–0.117)0.106(0.093–0.121)0.101(0.090–0.120) Validation cohort Brier score0.150(0.124–0.180)0.143(0.119–0.173)0.152(0.119–0.189)0.157(0.124–0.187)Abbreviations: CoxPH Cox Proportional Hazard, RSF Random survival forest, GBM Gradient boosting machine, XGBoost Extreme gradient boosting Table 2Comparing the predictive performance of different modelsModelsCoxPHRSFGBMXGBoostModels trained with all variables Training cohort C-index0.720(0.670–0.767)0.778(0.740–0.810)0.729(0.685–0.770)0.792(0.754–0.829) Validation cohort C-index0.604(0.542–0.669)0.640(0.572–0.710)0.640(0.561–0.712)0.629(0.555–0.696) Training cohort Brier score0.110(0.095–0.128)0.107(0.091–0.123)0.121(0.107–0.140)0.105(0.094–0.121) Validation cohort Brier score0.165(0.135–0.201)0.153(0.125–0.185)0.153(0.117–0.190)0.158(0.122–0.194)Models trained with top 11 variables Training cohort C-index0.721(0.677–0.764)0.804(0.770–0.837)0.791(0.757–0.827)0.797(0.758–0.832) Validation cohort C-index0.663(0.599–0.730)0.710(0.650–0.768)0.691(0.629–0.750)0.676(0.613–0.730) Training cohort Brier score0.120(0.104–0.138)0.103(0.087–0.117)0.106(0.093–0.121)0.101(0.090–0.120) Validation cohort Brier score0.150(0.124–0.180)0.143(0.119–0.173)0.152(0.119–0.189)0.157(0.124–0.187)Abbreviations: CoxPH Cox Proportional Hazard, RSF Random survival forest, GBM Gradient boosting machine, XGBoost Extreme gradient boosting Comparing the predictive performance of different models Abbreviations: CoxPH Cox Proportional Hazard, RSF Random survival forest, GBM Gradient boosting machine, XGBoost Extreme gradient boosting Fig. 1Time-dependent ROC curves of random survival forest model with 11 variables for predicting 5-year MACE in patients with coronary artery disease in the training cohort (A) and validation cohort (B). The x-axis represents specificity [probability of correctly identifying patients who did not experience MACE], and the y-axis represents sensitivity [probability of correctly identifying patients who did experience MACE] Time-dependent ROC curves of random survival forest model with 11 variables for predicting 5-year MACE in patients with coronary artery disease in the training cohort (A) and validation cohort (B). The x-axis represents specificity [probability of correctly identifying patients who did not experience MACE], and the y-axis represents sensitivity [probability of correctly identifying patients who did experience MACE] When models were constructed using the predictors selected by LASSO regression, the RSF model showed comparatively favourable discrimination in both cohorts, with C-index of 0.804 (95% CI: 0.770–0.837) in the training cohort and 0.710 (95% CI: 0.650–0.768) in the validation cohort. The GBM and XGBoost models also showed strong performance in the training cohort (C-index = 0.791 and 0.797, respectively), whereas the CoxPH model showed lower discrimination. Similarly, the RSF model achieved the lowest Brier score in the validation cohort (0.143). The calibration of the RSF model was evaluated using the calibration plots in Supplementary Figure S4. The calibration curves of the RSF model demonstrated good agreement between the predicted and observed risks, with predictions closely aligned with the ideal diagonal line, indicating satisfactory calibration performance. Decision curve analysis (Fig. 2) further demonstrated the clinical utility of the RSF model. In the training cohort, the RSF model provided a greater net benefit than both the “treat-all” and “treat-none” strategies across a wide range of threshold probabilities (0.10–0.75), supporting its potential role in individualized risk assessment and clinical decision-making. Fig. 2Decision curve analysis of random survival forest model with 11 variables for predicting 5-year major adverse cardiovascular events (MACE) in patients with coronary artery disease in the training cohort (A) and validation cohort (B). The x-axis represents the threshold probability of 5-year MACE. The y-axis represents net benefit Decision curve analysis of random survival forest model with 11 variables for predicting 5-year major adverse cardiovascular events (MACE) in patients with coronary artery disease in the training cohort (A) and validation cohort (B). The x-axis represents the threshold probability of 5-year MACE. The y-axis represents net benefit Decision curve analysis in the validation cohort also demonstrated the favourable clinical utility of the RSF model. The RSF model maintained a positive net benefit across a broad range of clinically relevant threshold probabilities, indicating its potential value for individualized risk stratification and secondary prevention decision-making (Supplementary Figure S5). Compared with the ABC-CHD model, the RSF model demonstrated higher discrimination, with a ΔC-index of 0.132 (0.106–0.158) in the training cohort and 0.101 (0.072–0.130) in the validation cohort (P < 0.001 for both), as well as lower Brier scores (0.103 vs. 0.128 in the training cohort; 0.143 vs. 0.156 in the validation cohort). Detailed results are provided in Supplementary Table S5. In addition, calibration and decision curve analyses in the validation cohort (Supplementary Figures S6–S7) showed that the RSF model demonstrated more stable calibration and greater net clinical benefit across a wider range of threshold probabilities than the ABC-CHD model. Importance of predictive variables for 5-year MACE Variable importance was evaluated on the basis of the RSF model trained with the 11 predictors selected by LASSO regression. As shown in Fig. 3, LVEF, age, and the number of diseased vessels were identified as the top three predictors contributing most to model performance. LVEF was negatively associated with the predicted risk, whereas age and the number of diseased vessels were positively associated, indicating that a lower LVEF and greater age or greater coronary disease burden were associated with an increased risk of 5-year MACE. Fig. 3SHAP summary plot of the random forest prediction model with 11 variables for predicting 5-year major adverse cardiovascular events (MACE) in patients with coronary artery disease SHAP summary plot of the random forest prediction model with 11 variables for predicting 5-year major adverse cardiovascular events (MACE) in patients with coronary artery disease Furthermore, SHAP dependence plots were used to visualize the relationships between individual predictors and the predicted risk (Supplementary Figure S8). LVEF demonstrated an inverse relationship with predicted risk, with SHAP values increasing markedly when the LVEF decreased below approximately 50%. Higher SHAP values were also observed with older age, elevated NT-proBNP levels, nitrate use, higher NYHA class, a history of PCI, depressive symptoms, increased BUN levels, longer CAD duration, prior stroke, and a greater number of diseased coronary vessels, all of which were associated with increased MACE risk. Sensitivity analysis Bootstrap-based internal validation was performed to evaluate potential overfitting. After optimism correction, the RSF model maintained acceptable discrimination performance (Supplementary Table S6). In addition, subgroup analysis according to the presence of HF revealed similar performance patterns across the models, although discrimination was slightly lower among HF patients (Supplementary Table S7). Additional complete-case sensitivity analysis revealed similar overall performance patterns for the RSF model, although discrimination in the validation cohort modestly decreased after patients with missing data were excluded (Supplementary Table S8). Discussion CAD remains a major global contributor to long-term cardiovascular morbidity and mortality. Accurate postdischarge risk prediction is essential for optimizing secondary prevention. In this prospective study, we developed four ML models to predict 5-year MACEs in hospitalized CAD patients, identifying RSF as the selected model. ML offers distinct advantages over traditional statistical models in prognostic prediction, particularly for diseases with multiple and complex risk factors such as coronary heart disease. Unlike conventional linear models that rely on predefined assumptions, ML algorithms can automatically learn nonlinear relationships and interactions from large-scale, high-dimensional clinical data, thereby improving prediction accuracy and enabling personalized risk stratification. In cardiovascular medicine, ML has been increasingly applied to diagnosis, classification, and outcome prediction, showing the potential to refine prognostic assessments and guide more targeted interventions for patients undergoing PCI [9]. Previous models for predicting cardiovascular risk in coronary artery disease patients have shown varying approaches and performance. Ganz et al. developed a 9-protein risk score with moderate discrimination (C-statistics 0.64–0.75), outperforming the Framingham model for 4-year outcomes [17]. Lindholm et al. created an “ABC-CHD” model combining biomarkers and clinical factors, achieving high discrimination for cardiovascular death (C-index 0.78–0.81) [8]. Liu et al. applied machine learning to PCI patients, with a random forest model predicting 5-year all-cause mortality with an area under the receiver operating characteristic curve of 0.71 [9]. Our findings further support the potential value of machine learning methods such as RSF for long-term prognostic prediction in CAD patients. These approaches may complement traditional risk stratification strategies by capturing complex nonlinear relationships among clinical variables. As an extension of the random forest method for time-to-event data, the RSF method can capture complex nonlinear relationships and interactions without relying on strict parametric assumptions [18, 19]. In our cohort, the RSF model demonstrated good predictive performance, with a C-index of 0.710 and a Brier score of 0.143 in the validation cohort, indicating acceptable discrimination and calibration. The observed reduction in model performance from the training cohort to the validation cohort should be interpreted with caution. This difference may reflect the expected variability in internal validation settings, including differences in baseline risk distribution and event timing between cohorts. In addition, performance estimates may also be influenced by sampling variability in the validation cohort. To evaluate clinical utility, we performed DCA on the RSF model. The analysis revealed that the model provides positive net benefit over a wide range of threshold probabilities (10–75% 5-year MACE risk), indicating that the predicted risk scores could meaningfully guide secondary prevention strategies. Although the proposed model demonstrated favourable discrimination and clinical utility, a comparison with the ABC-CHD model was performed in this study as a reference. The RSF model showed greater discrimination than the ABC-CHD score did in both the training and validation cohorts; however, these findings should be interpreted cautiously given the differences in model structure, predictors, and development strategies. Importantly, SHAP analysis was applied to improve model interpretability by quantifying the contribution of each predictor to the model output. These values reflect feature attribution within the prediction model and should not be interpreted as causal effects or clinically validated thresholds. Accordingly, SHAP-derived patterns should be viewed as data-driven representations of the model rather than mechanistic explanations. An apparent nonlinear association between LVEF and predicted 5-year MACE risk was observed, with higher model-predicted risk at both lower LVEF values (< 50%) and at the upper distribution range (> 75%) [20, 21]. Given the limited number of patients with supranormal LVEF, this pattern should be interpreted cautiously and may represent a data-driven feature of the model rather than a definitive physiological relationship. Age was identified as one of the most influential predictors in the model, which is consistent with its well-established association with adverse cardiovascular outcomes [22]. Ageing is associated with progressive vascular remodelling, endothelial dysfunction, and cumulative exposure to cardiometabolic risk factors, all of which contribute to increased cardiovascular risk in patients with coronary artery disease [23]. The number of diseased coronary vessels is also an important predictor, reflecting the extent of anatomical coronary atherosclerosis [24]. Patients with multivessel disease generally have a greater ischaemic burden and more diffuse coronary pathology, which is associated with worse long-term prognosis [25]. NT-proBNP emerged as another key predictor in the model, likely reflecting increased myocardial wall stress and haemodynamic burden related to ischaemia or ventricular dysfunction. High NT-proBNP levels (> 1100 pg/ml in this cohort) were associated with increased predicted risk, which is consistent with its established prognostic role in cardiovascular disease [26, 27]. Differences in absolute NT-proBNP values across studies may be influenced by patient characteristics, disease severity, assay methods, and follow-up duration, which should be considered when comparing results across populations [28, 29]. A history of stroke was also associated with a higher predicted risk in the model, potentially reflecting a greater burden of systemic atherosclerosis and shared vascular risk factors [30]. Patients with prior cerebrovascular disease often have more advanced and diffuse vascular pathology, which may contribute to worse long-term cardiovascular outcomes [31]. Beyond improved discrimination, the RSF model provides additional clinical value by enabling individualized 5-year risk estimation on the basis of complex nonlinear relationships and interactions among routinely available clinical variables. Unlike traditional regression-based models, which assume linear and additive effects, the RSF approach can capture heterogeneous risk patterns across patient subgroups, thereby improving risk stratification granularity. In addition, the integration of SHAP-based interpretation allows for patient-level explanations of predicted risk, which may enhance clinical interpretability and support decision-making in secondary prevention. This study has several limitations. First, although 221 events are generally adequate for the final set of 11 predictors, the initial modelling process considered 50 candidate variables and multiple algorithms, which may increase the risk of overfitting. We applied LASSO regression for variable selection and cross-validation to mitigate this issue. The predominance of cardiac rehospitalization in terms of the composite outcome may reflect the chronic and recurrent nature of coronary artery disease management, where symptom recurrence or clinical instability often leads to hospitalization even in the absence of hard events. Second, this was a single-centre study, which may limit the generalizability of the findings to other health care settings and populations. Third, although we compared the RSF model with the ABC-CHD model, differences in model structure, predictor composition, and development strategies may limit the strict comparability of their performance. Therefore, the observed differences should be interpreted as preliminary and hypothesis-generating rather than definitive evidence of superiority. External validation in independent cohorts is needed to further assess the incremental value of machine learning-based models over established risk scores. In addition, variations in laboratory assays, differences in NT-proBNP measurement methods and threshold definitions, and regional differences in clinical practice patterns and treatment strategies may influence model performance when applied to external populations. Therefore, external validation in multicentre cohorts with diverse patient populations is necessary to confirm the robustness and transportability of the proposed model before clinical implementation. To address the limitations of single-centre data, we plan to perform external validation in multicentre cohorts with diverse patient populations. Data collection will include standardized laboratory assays, NT-proBNP measurement protocols, and comprehensive biomarker panels to enable potential comparisons with established cardiovascular risk scores such as the ABC-CHD model and the GRACE. These efforts aim to confirm the clinical utility of the model and facilitate its potential implementation in broader patient populations. Finally, while SHAP analysis improves transparency by quantifying the contribution of each predictor to the model predictions, it does not fully resolve the inherent “black box” nature of ensemble machine learning models, nor does it imply causal relationships between predictors and outcomes. Overall, the model should be considered exploratory, and further studies are warranted before clinical implementation. In addition, it should be noted that our patient cohort was enrolled between October 2017 and January 2018. Since that time, secondary prevention strategies for coronary artery disease have evolved significantly [32]. This includes the widespread adoption of sodium–glucose cotransporter 2 inhibitors and glucagon-like peptide-1 receptor agonists [33]. Concurrently, lipid-lowering strategies have become more intensive, with contemporary guidelines advocating for stricter LDL-C targets and earlier use of combination therapy [34]. These interventions have been shown to reduce the risk of future MACEs. As a result, the absolute risk of long-term events may be lower in contemporary populations than in our cohort. Consequently, while our model demonstrates robust discrimination and calibration under the treatment patterns present during data collection, its direct application to patients receiving modern therapies may overestimate event probabilities. This limitation also underscores the need for external validation in more recent, multicentre cohorts to ensure accurate risk prediction in the current clinical context. Conclusion In this prospective cohort study of hospitalized CAD patients, we developed and validated ML-based models for predicting 5-year MACEs, with the RSF model demonstrating comparatively favourable performance across discrimination, calibration, and clinical utility. By incorporating routinely available clinical, laboratory, and psychosocial variables, our models achieved accurate long-term risk stratification and enhanced interpretability through SHAP analysis. These findings suggest that ML-based approaches may support individualized risk stratification in CAD patients, although further external validation is needed before routine clinical application. Supplementary Information Supplementary Material 1. Supplementary Material 1.