Exploring prognostic factors in breast cancer: development and selection of optimal machine learning models Authors: Meiying Shen, Yulei Wang, Zongyuan Wu, Lifei Chen, Shaofeng Wu, Huawen Pan, Bo Xu Published: 2026 ABSTRACT ObjectiveTo investigate prognostic factors for breast cancer recurrence and metastasis, and to systematically compare multiple machine learning models to develop an optimal predictive tool.MethodsWe retrospectively analyzed data from 1,056 breast cancer patients diagnosed between January 2012 and June 2021 at a single center. Patients were randomly divided into a training (n=740) and a validation (n=316) set. Univariate and multivariate Cox proportional hazards regression analyses were performed to identify independent prognostic factors. Seven machine learning algorithms (Cox regression, LASSO, Elastic-Net, Decision Tree, Random Forest, XGBoost, and GBM) were employed. All models were implemented using survival-specific adaptations. A rigorous 5-fold cross-validation framework was used for model training and hyperparameter tuning. Model performance was evaluated using time-dependent Area Under the Curve (AUC), Brier scores, calibration curves, calibration-in-the-large, calibration slopes, and Decision Curve Analysis (DCA). SHAP values were employed for model interpretation.ResultsMultivariate Cox regression revealed that tumor size (cm) (HR = 1.025, 95%CI: 1.013-1.037), lymph node dissection (HR = 0.278, 95%CI: 0.199-0.389), ER% (HR = 1.006, 95%CI: 1.003-1.009), PR% (HR = 1.005, 95%CI: 1.002-1.008), Ki-67% (HR = 1.012, 95%CI: 1.007-1.016), and HER2 status (HR = 1.195, 95%CI: 1.098-1.301) were independently associated with disease-free survival. Random Forest and XGBoost demonstrated superior and stable predictive performance, with Random Forest achieving time-dependent AUCs of 0.851 (95%CI: 0.802-0.900, 1-year), 0.763 (95%CI: 0.702-0.824, 3-year), and 0.826 (95%CI: 0.766-0.886, 5-year) in the validation set. The Brier scores for Random Forest were consistently low, and calibration metrics confirmed excellent calibration. DCA indicated a positive net benefit across a wide range of threshold probabilities.ConclusionThis single-center study identifies key prognostic factors for breast cancer and demonstrates that ensemble machine learning models, particularly Random Forest, offer superior predictive power. The integration of SHAP interpretation provides a methodological framework for potential clinical application. However, all predictive models require external, multi-center validation before clinical consideration. These findings provide a promising methodological basis, but caution is warranted against overinterpretation until independent verification is complete. Introduction Breast cancer is the most commonly diagnosed malignancy and the leading cause of cancer-related death among women worldwide (1, 2). Despite significant advances in early detection and treatment modalities, considerable heterogeneity exists in patient outcomes, with recurrence and metastasis remaining major challenges in clinical management (3, 4). Accurate prognostic assessment is essential for individualized treatment planning and improving patient survival. Traditional prognostic factors for breast cancer include tumor size, lymph node status, histological grade, molecular subtypes (ER, PR, HER2, Ki-67), and lymphovascular invasion (5–7). While these factors provide valuable prognostic information, their predictive accuracy is limited when considered in isolation or through conventional statistical methods (8). The complex interplay between clinical, pathological, and immunological factors necessitates more sophisticated analytical approaches. In recent years, inflammation-based prognostic indicators have garnered increasing attention in oncology research (9, 10). Biomarkers such as Neutrophil-to-lymphocyte ratio (NLR), Platelet-to-lymphocyte ratio (PLR), and Systemic Immune-Inflammation Index (SII) reflect the tumor microenvironment’s inflammatory status and have been identified as independent prognostic factors in various malignancies, including breast cancer (11, 12). These indicators capture the complex interactions between tumor cells and the host immune system, potentially offering additional prognostic value beyond traditional clinicopathological parameters (13). Machine learning algorithms have emerged as powerful tools for integrating multidimensional data and capturing complex non-linear relationships in medical research (14, 15). Unlike conventional regression models that assume linear relationships and limited interactions, machine learning methods can automatically identify patterns, handle high-dimensional data, and improve prediction accuracy (16, 17). Algorithms such as Random Forest, XGBoost, and Support Vector Machines have shown promise in cancer prognosis prediction, often outperforming traditional statistical methods (18, 19). However, several challenges remain in applying machine learning to breast cancer prognosis. First, most existing models focus on a limited set of predictors or single algorithmic approaches (20, 21). Second, model interpretability remains a significant barrier to clinical adoption, as clinicians require understanding of how predictions are generated (22). Third, external validation and comparison of multiple algorithms in the same cohort are relatively scarce (23). To address these gaps, this study aims to: (1) comprehensively investigate prognostic factors for breast cancer recurrence and metastasis, including traditional clinicopathological features and inflammatory markers; (2) systematically compare seven machine learning algorithms for prognostic prediction; (3) develop and internally validate optimal prediction models for 1-year, 3-year, and 5-year outcomes; and (4) enhance model interpretability using SHAP (SHapley Additive exPlanations) values to facilitate clinical translation. By integrating multi-modal data and advanced analytical methods, we propose a promising methodological framework that may support future individualized risk stratification research in breast cancer, pending external validation. Methods Study population Patient selection This retrospective study consecutively enrolled 1,056 patients diagnosed with breast cancer at the Department of Breast Surgery, Maoming People’s Hospital between January 2012 and June 2021. The study protocol was approved by the Clinical Database Committee of Maoming People’s Hospital, and a data confidentiality agreement was signed. All personal identifying information was removed prior to analysis. The study was conducted in accordance with the Declaration of Helsinki. Inclusion criteria Histopathologically confirmed unilateral primary breast cancer without distant metastasis. Histopathologically confirmed unilateral primary breast cancer without distant metastasis. Received treatment at our institution. Received treatment at our institution. Underwent breast surgery. Underwent breast surgery. Underwent breast tumor color Doppler ultrasound within 2 weeks before surgery. Underwent breast tumor color Doppler ultrasound within 2 weeks before surgery. Completed peripheral blood laboratory examination within 2 days before surgery. Completed peripheral blood laboratory examination within 2 days before surgery. Complete clinical data without significant missing values. Complete clinical data without significant missing values. Exclusion criteria No surgical pathology results. No surgical pathology results. Poor quality of grayscale ultrasound, color Doppler, or elastography images. Poor quality of grayscale ultrasound, color Doppler, or elastography images. Diagnosis of other malignancies within the past 3 months or inflammatory diseases within the past 2 weeks. Diagnosis of other malignancies within the past 3 months or inflammatory diseases within the past 2 weeks. Follow-up duration less than 6 months or lost to follow-up. Follow-up duration less than 6 months or lost to follow-up. Concurrent other malignant tumors. Concurrent other malignant tumors. Comorbid immune or hematological disorders. Comorbid immune or hematological disorders. Recent infectious or traumatic conditions. Recent infectious or traumatic conditions. Pregnant or lactating patients. Pregnant or lactating patients. Incomplete clinical or pathological data. Incomplete clinical or pathological data. Study procedures Ultrasound examination All breast and axillary ultrasound examinations were performed by a single experienced ultrasound specialist with over 15 years of experience in breast ultrasound diagnosis. Ultrasound examinations were conducted using a HITACHI EUB-8500 system (Hitachi Medical Corporation, Tokyo, Japan) with a probe frequency of 7.5–13 MHz. Clinical and pathological data collection Data were extracted from inpatient electronic medical records and outpatient visit systems, including: Patient characteristics: Age, menopausal status (premenopausal, perimenopausal, postmenopausal), family history of breast cancer. Patient characteristics: Age, menopausal status (premenopausal, perimenopausal, postmenopausal), family history of breast cancer. TNM staging: Based on AJCC 8th edition, including T stage and N stage information. TNM staging: Based on AJCC 8th edition, including T stage and N stage information. Axillary lymph node (ALN) metastasis classification: pN0 (no metastasis), pN1 (1–3 metastases), pN2 (4–9 metastases), pN3 (≥10 metastases). Axillary lymph node (ALN) metastasis classification: pN0 (no metastasis), pN1 (1–3 metastases), pN2 (4–9 metastases), pN3 (≥10 metastases). Surgical procedures: Radical mastectomy or breast-conserving surgery with sentinel lymph node biopsy and/or axillary lymph node dissection. Surgical procedures: Radical mastectomy or breast-conserving surgery with sentinel lymph node biopsy and/or axillary lymph node dissection. Pathological features: Pathological subtype, molecular subtype, tumor size, multifocality, lymphovascular invasion (LVI) status, histological grade, and ultrasound features (spiculation, aspect ratio, blood flow). Pathological features: Pathological subtype, molecular subtype, tumor size, multifocality, lymphovascular invasion (LVI) status, histological grade, and ultrasound features (spiculation, aspect ratio, blood flow). Laboratory indicators: Preoperative (within 3 days) platelet count, lymphocyte count, monocyte count, neutrophil count, and tumor markers. Laboratory indicators: Preoperative (within 3 days) platelet count, lymphocyte count, monocyte count, neutrophil count, and tumor markers. Inflammatory indices: NLR = Neutrophil count/Lymphocyte count; PLR = Platelet count/Lymphocyte count; LMR = Lymphocyte count/Monocyte count; SII = Platelet count × Neutrophil count/Lymphocyte count. Inflammatory indices: NLR = Neutrophil count/Lymphocyte count; PLR = Platelet count/Lymphocyte count; LMR = Lymphocyte count/Monocyte count; SII = Platelet count × Neutrophil count/Lymphocyte count. Tumor markers: CA199, CEA, CA725, CA724, CA125 (positive if any marker elevated). Tumor markers: CA199, CEA, CA725, CA724, CA125 (positive if any marker elevated). Pathological assessment All specimens were diagnosed by pathologists with over 5 years of experience. Pathological tumor size was measured on gross specimens. Immunohistochemical staining was performed to assess estrogen receptor (ER), progesterone receptor (PR), human epidermal growth factor receptor 2 (HER2), and Ki-67 expression. ER and PR negativity was defined as <1% nuclear staining in tumor cells. HER2 negativity was defined as IHC score 0 or 1+, or negative by fluorescence in situ hybridization (FISH). Breast cancer molecular subtypes were classified as Luminal A, Luminal B, HER2-enriched, and triple-negative breast cancer (TNBC). TNBC was defined as negative expression of ER, PR, and HER2. ER and PR positivity was defined as expression >1%. Ki-67 expression was dichotomized at the 14% cutoff. Androgen receptor (AR) positivity was defined as expression >1%. Follow-up Postoperative treatment regimens were determined based on surgical approach, molecular subtype, and axillary lymph node status, including: radiotherapy + chemotherapy + endocrine therapy, chemotherapy + endocrine therapy, chemotherapy + targeted therapy + endocrine therapy, and traditional Chinese medicine. Follow-up frequency and examinations followed the Chinese Anti-Cancer Association guidelines: every 3 months during the first 2 years post-surgery, every 6 months during years 3-5, and annually after 5 years. Monitoring included laboratory tests, breast and axillary ultrasound and/or mammography, abdominal and gynecological ultrasound, CT or MRI, bone scan, and whole-body PET-CT as indicated for distant metastasis surveillance. The final follow-up date was November 20, 2024. Recurrence was classified as local recurrence (confined to ipsilateral breast, chest wall, and/or axillary, infraclavicular, or supraclavicular lymph nodes), contralateral breast, or distant metastasis. The endpoint event was defined as recurrence or metastasis during postoperative follow-up. Disease-free survival (DFS) was defined as the time from initial surgical diagnosis to the first diagnosis of any site recurrence or metastasis, death from any cause, or last follow-up date, whichever occurred first. Statistical analysis Statistical analyses were performed using R software (version 4.2.1) and IBM SPSS Statistics 26.0. Data splitting and preprocessing The dataset was randomly divided into a training set (70%, n=740) and a validation set (30%, n=316). Stratified sampling based on the event indicator was used to maintain identical event proportions in both partitions, with the seed fixed at 2023 via the createDataPartition function of the caret package. All preprocessing steps, including missing data imputation, feature selection, and hyperparameter tuning, were performed exclusively within the training set and subsequently applied to the validation set. Missing values were handled using multiple imputation with the mice package, where the imputation model was estimated on the training set only. Within cross-validation loops, a simplified single imputation derived from the respective training fold was employed to maintain computational efficiency; the stability of imputed values across folds was confirmed. After imputation, continuous variables were standardized (z-score normalization) based on the training set mean and standard deviation. Normality of continuous variables was assessed using the Shapiro-Wilk test. Normally distributed data were expressed as mean ± standard deviation and compared using t-tests. Non-normally distributed data were expressed as median (interquartile range) and compared using Wilcoxon rank-sum tests. Categorical variables were expressed as frequencies (percentages) and compared using chi-square tests or Fisher’s exact tests. Predictor selection To maintain methodological consistency with the time-to-event outcome (DFS), we employed univariate and multivariate Cox proportional hazards regression analyses. Variables with P < 0.05 in the multivariate Cox analysis were identified as independent prognostic factors and subsequently used as input features for all seven machine learning models. Recognizing the inherent limitations of significance-based variable selection, we also performed a supplementary analysis using Cox LASSO with 10-fold cross-validation. LASSO selected the same six core variables with the addition of SII, but model performance did not improve appreciably (increase in C-index <0.01), and the ranking of variable importance remained similar. Therefore, the six clinically established and parsimonious variables were retained to ensure interpretability and comparability across models. The potential instability of P-value-based selection is acknowledged and addressed further in the Discussion. Model development and survival-specific implementations Seven machine learning algorithms were compared. Crucially, to ensure valid handling of censored time-to-event data, all models employed survival-adapted implementations, never reducing the endpoint to binary classification at fixed time points. The specific implementations were as follows: Cox proportional hazards model: Standard Cox regression as implemented in the survival R package. Cox proportional hazards model: Standard Cox regression as implemented in the survival R package. LASSO (Least Absolute Shrinkage and Selection Operator) Regression: Cox family in glmnet (via family = “cox”), which directly optimizes the penalized partial likelihood. LASSO (Least Absolute Shrinkage and Selection Operator) Regression: Cox family in glmnet (via family = “cox”), which directly optimizes the penalized partial likelihood. Elastic-Net: Also implemented via glmnet with family = “cox”, combining L1 and L2 penalties. Elastic-Net: Also implemented via glmnet with family = “cox”, combining L1 and L2 penalties. Decision Tree: Survival trees were constructed using conditional inference trees (partykit::ctree), with splitting based on the log-rank test statistic, inherently accommodating censored data. Decision Tree: Survival trees were constructed using conditional inference trees (partykit::ctree), with splitting based on the log-rank test statistic, inherently accommodating censored data. Random Forest: Random Survival Forest as implemented in the randomForestSRC package. Splits were guided by the log-rank statistic, and predictions were provided as ensemble survival functions, from which time-dependent probabilities can be derived. Random Forest: Random Survival Forest as implemented in the randomForestSRC package. Splits were guided by the log-rank statistic, and predictions were provided as ensemble survival functions, from which time-dependent probabilities can be derived. XGBoost (eXtreme Gradient Boosting): Trained with the objective function objective = “survival:cox” in the xgboost package, which optimizes the Cox partial likelihood. The model outputs the linear predictor and cumulative hazard, fully incorporating censored observations. XGBoost (eXtreme Gradient Boosting): Trained with the objective function objective = “survival:cox” in the xgboost package, which optimizes the Cox partial likelihood. The model outputs the linear predictor and cumulative hazard, fully incorporating censored observations. GBM (Gradient Boosting Machines): Implemented with distribution = “coxph” in the gbm package, likewise optimizing the Cox partial likelihood. GBM (Gradient Boosting Machines): Implemented with distribution = “coxph” in the gbm package, likewise optimizing the Cox partial likelihood. All models were supplied with the identical set of six predictor variables identified from the multivariate Cox regression. Hyperparameter tuning and internal validation An inner 5-fold cross-validation repeated 10 times (5×10 repeated CV) was performed exclusively on the training set to tune hyperparameters. The combination that maximized the time-dependent concordance index (C-index) was selected. After optimal hyperparameters were identified, the final model was refit on the complete training set and then evaluated once on the untouched validation set to yield unbiased performance estimates. All resampling procedures used a fixed random seed to guarantee full reproducibility. Model evaluation Model performance was assessed using the following metrics: Time-dependent Receiver Operating Characteristic (ROC) curves and Area Under the Curve (AUC): To assess discrimination at 1-year, 3-year, and 5-year time points. 95% confidence intervals for AUCs were computed via bootstrapping. Time-dependent Receiver Operating Characteristic (ROC) curves and Area Under the Curve (AUC): To assess discrimination at 1-year, 3-year, and 5-year time points. 95% confidence intervals for AUCs were computed via bootstrapping. Concordance index (C-index): To evaluate the overall discriminative ability of survival models. Concordance index (C-index): To evaluate the overall discriminative ability of survival models. Brier score: To assess the accuracy of probabilistic predictions (calibration), with lower scores indicating better calibration. Brier score: To assess the accuracy of probabilistic predictions (calibration), with lower scores indicating better calibration. Calibration curves: To visually evaluate prediction accuracy against observed outcomes at 1, 3, and 5 years. Additionally, calibration-in-the-large and calibration slope were calculated to provide numerical measures of calibration. Calibration curves: To visually evaluate prediction accuracy against observed outcomes at 1, 3, and 5 years. Additionally, calibration-in-the-large and calibration slope were calculated to provide numerical measures of calibration. Decision Curve Analysis (DCA): To quantify net benefit across decision thresholds and assess potential clinical utility. Decision Curve Analysis (DCA): To quantify net benefit across decision thresholds and assess potential clinical utility. Model interpretation Model interpretability was enhanced using SHAP (SHapley Additive exPlanations) values to identify the most influential variables and their direction of impact on model predictions. For survival models, SHAP values were derived from the predicted risk scores. Results General characteristics Comparison between training (n=740) and validation (n=316) sets revealed significant differences in 3 of 28 variables (p < 0.05), including PR (p = 0.009) and pathological tumor diameter (p < 0.001). No significant differences were observed for other variables such as diabetes, hyperlipidemia, biopsy status, or histological grade (p > 0.05) (Table 1). Table 1Comparison of clinical characteristics between training and validation sets.CharacteristicTrain (n=740)Validation (n=316)Total (n=1056)P valueAge, median (IQR)53 (46,60)52.5 (46,59)53 (46,59)0.353Diabetes0.22- No707 (95.5)307 (97.2)1014 (96)- Yes33 (4.5)9 (2.8)42 (4)Hyperlipidemia0.313- No715 (96.6)309 (97.8)1024 (97)- Yes25 (3.4)7 (2.2)32 (3)Hypertension0.21- No679 (91.8)297 (94)976 (92.4)- Yes61 (8.2)19 (6)80 (7.6)BMI, median (IQR)23.1 (21.3,25.3)23.4 (21.7,25.4)23.2 (21.5,25.3)0.084Prior tumor history0.672- No678 (91.6)287 (90.8)965 (91.4)- Yes62 (8.4)29 (9.2)91 (8.6)BI-RADS, median (IQR)4 (4,4)4 (4,4)4 (4,4)0.746Size (cm), median (IQR)2.6 (1.8,3.9)2.5 (1.6,4)2.5 (1.7,4)0.463Laterality0.375- Left326 (44.1)154 (48.7)480 (45.5)- Right354 (47.8)139 (44)493 (46.7)- Bilateral60 (8.1)23 (7.3)83 (7.9)Aspect ratio (>1 = 1/<1 = 0)0.725- 0583 (78.8)252 (79.7)835 (79.1)- 1157 (21.2)64 (20.3)221 (20.9)Spiculation0.631- No244 (33)109 (34.5)353 (33.4)- Yes496 (67)207 (65.5)703 (66.6)Blood flow0.67- No289 (39.1)119 (37.7)408 (38.6)- Yes451 (60.9)197 (62.3)648 (61.4)Axillary lymph nodes0.351- No460 (62.2)206 (65.2)666 (63.1)- Yes280 (37.8)110 (34.8)390 (36.9)Tumor location0.56- 05 (0.7)2 (0.6)7 (0.7)- Upper inner154 (20.8)55 (17.4)209 (19.8)- Upper outer434 (58.6)203 (64.2)637 (60.3)- Lower inner49 (6.6)19 (6)68 (6.4)- Lower outer98 (13.2)37 (11.7)135 (12.8)Biopsy (time)0.843- No403 (54.5)170 (53.8)573 (54.3)- Yes337 (45.5)146 (46.2)483 (45.7)Distant metastasis0.999- No644 (87)275 (87)919 (87)- Yes96 (13)41 (13)137 (13)Breast-conserving surgery0.288- No482 (65.1)195 (61.7)677 (64.1)- Yes258 (34.9)121 (38.3)379 (35.9)Lymph node dissection0.638- No629 (85)265 (83.9)894 (84.7)- Yes111 (15)51 (16.1)162 (15.3)Pathological tumor diameter (cm), median (IQR)1.9 (1.3,3)1.6 (0.9,2.5)1.8 (1.2,3)<0.001Histological grade0.431- 036 (4.9)18 (5.7)54 (5.1)- G1107 (14.5)50 (15.8)157 (14.9)- G2349 (47.2)161 (50.9)510 (48.3)- G3217 (29.3)75 (23.7)292 (27.7)- G431 (4.2)12 (3.8)43 (4.1)Lymph node status, median (IQR)0 (0,0.1)0 (0,0.2)0 (0,0.1)0.909Lymphovascular invasion0.1- No563 (76.1)255 (80.7)818 (77.5)- Yes177 (23.9)61 (19.3)238 (22.5)ER (%), median (IQR)80 (5,90)72.5 (0,90)80 (4.5,90)0.404PR (%), median (IQR)37.5 (0,80)22.5 (0,70)30 (0,80)0.009Ki-67 (%), median (IQR)35 (20,60)31.5 (20,60)35 (20,60)0.695HER20.618- 0280 (37.8)112 (35.4)392 (37.1)- 1139 (18.8)68 (21.5)207 (19.6)- 2128 (17.3)49 (15.5)177 (16.8)- 3193 (26.1)87 (27.5)280 (26.5)Adjuvant therapy0.696- No101 (13.6)46 (14.6)147 (13.9)- Yes639 (86.4)270 (85.4)909 (86.1)Palliative therapy0.535- No703 (95)303 (95.9)1006 (95.3)- Yes37 (5)13 (4.1)50 (4.7)Chemotherapy0.957- No219 (29.6)93 (29.4)312 (29.5)- Yes521 (70.4)223 (70.6)744 (70.5)Endocrine therapy0.438- No340 (45.9)137 (43.4)477 (45.2)- Yes400 (54.1)179 (56.6)579 (54.8)Targeted therapy0.592- No525 (70.9)219 (69.3)744 (70.5)- Yes215 (29.1)97 (30.7)312 (29.5)Immunotherapy0.811- No696 (94.1)296 (93.7)992 (93.9)- Yes44 (5.9)20 (6.3)64 (6.1)Pathological type0.169- Invasive ductal carcinoma668 (90.3)275 (87)943 (89.3)- Invasive lobular carcinoma9 (1.2)9 (2.8)18 (1.7)- Carcinoma in situ28 (3.8)17 (5.4)45 (4.3)- Other35 (4.7)15 (4.7)50 (4.7)Outcome0.096- Event-free329 (44.5)123 (38.9)452 (42.8)- Event411 (55.5)193 (61.1)604 (57.2) Comparison of clinical characteristics between training and validation sets. Baseline characteristics by outcome Comparison between event-free (n=452) and event (n=604) groups revealed significant differences in multiple variables. Prior tumor history was significantly higher in the event group (6.4% vs. 10.3%, P = 0.027). BI-RADS category showed significant differences between groups (P = 0.029). Ultrasound-measured tumor size was significantly smaller in the event group (median 2.3 cm vs. 2.8 cm, P = 0.007). This counterintuitive finding is likely attributable to differences in surgical and pathological assessment; the event group had a higher rate of breast-conserving surgery, and gross pathological measurement may systematically differ from preoperative imaging, particularly after neoadjuvant therapy or in multifocal disease which was subsequently pathologically confirmed. Pathological tumor diameter was also significantly smaller in the event group (median 1.5 cm vs. 2.5 cm, P<0.001). Additionally, significant differences were observed in lymphovascular invasion, HER2 status, adjuvant therapy, chemotherapy, and immunotherapy (P<0.05) (Table 2). Table 2Baseline characteristics by outcome status.CharacteristicEvent-free (n=452)Event (n=604)Total (n=1056)P valueAge, median (IQR)52 (46,59)53 (46,59.2)53 (46,59)0.374Diabetes0.529- No436 (96.5)578 (95.7)1014 (96)- Yes16 (3.5)26 (4.3)42 (4)Hyperlipidemia0.088- No443 (98)581 (96.2)1024 (97)- Yes9 (2)23 (3.8)32 (3)Hypertension0.377- No414 (91.6)562 (93)976 (92.4)- Yes38 (8.4)42 (7)42 (7.6)BMI, median (IQR)23.4 (21,25)23.1 (21.6,25.4)23.2 (21.5,25.3)0.081Prior tumor history0.027- No423 (93.6)542 (89.7)965 (91.4)- Yes29 (6.4)62 (10.3)91 (8.6)BI-RADS, median (IQR)4 (4,4)4 (4,4)4 (4,4)0.029Size (cm), median (IQR)2.8 (2,3.8)2.3 (1.5,4)2.5 (1.7,4)0.007Laterality0.663- Left207 (45.8)273 (45.2)480 (45.5)- Right206 (45.6)287 (47.5)493 (46.7)- Bilateral39 (8.6)44 (7.3)83 (7.9)Aspect ratio (>1 = 1/<1 = 0)0.928- 0358 (79.2)477 (79)835 (79.1)- 194 (20.8)127 (21)221 (20.9)Spiculation0.111- No139 (30.8)214 (35.4)353 (33.4)- Yes313 (69.2)390 (64.6)703 (66.6)Blood flow0.012- No155 (34.3)253 (41.9)408 (38.6)- Yes297 (65.7)351 (58.1)648 (61.4)Axillary lymph nodes0.362- No278 (61.5)388 (64.2)666 (63.1)- Yes174 (38.5)216 (35.8)390 (36.9)Tumor location0.214- 00 (0)7 (1.2)7 (0.7)- Upper inner93 (20.6)116 (19.2)209 (19.8)- Upper outer275 (60.8)362 (59.9)637 (60.3)- Lower inner27 (6)41 (6.8)68 (6.4)- Lower outer57 (12.6)78 (12.9)135 (12.8)Biopsy (time)0.641- No249 (55.1)324 (53.6)573 (54.3)- Yes203 (44.9)280 (46.4)483 (45.7)Distant metastasis0.157- No401 (88.7)518 (85.8)919 (87)- Yes51 (11.3)86 (14.2)137 (13)Breast-conserving surgery0.162- No279 (61.7)398 (65.9)677 (64.1)- Yes173 (38.3)206 (34.1)379 (35.9)Lymph node dissection<0.001- No362 (80.1)532 (88.1)894 (84.7)- Yes90 (19.9)72 (11.9)162 (15.3)Pathological tumor diameter (cm), median (IQR)2.5 (2,3.5)1.5 (0.7,1.8)1.8 (1.2,3)<0.001Histological grade0.032- 020 (4.4)34 (5.6)54 (5.1)- G165 (14.4)92 (15.2)157 (14.9)- G2202 (44.7)308 (51)510 (48.3)- G3148 (32.7)144 (23.8)292 (27.7)- G417 (3.8)26 (4.3)43 (4.1)Lymph node status, median (IQR)0 (0,0.1)0 (0,0.1)0 (0,0.1)0.274Lymphovascular invasion0.024- No335 (74.1)483 (80)818 (77.5)- Yes117 (25.9)121 (20)238 (22.5)ER (%), median (IQR)70 (0,90)80 (5,90)80 (4.5,90)0.098PR (%), median (IQR)20 (0,80)40 (0,80)30 (0,80)0.062Ki-67 (%), median (IQR)30 (20,60)40 (20,60)35 (20,60)0.567HER20.043- 0181 (40)211 (34.9)392 (37.1)- 198 (21.7)109 (18)207 (19.6)- 267 (14.8)110 (18.2)177 (16.8)- 3106 (23.5)174 (28.8)280 (26.5)Adjuvant therapy0.012- No49 (10.8)98 (16.2)147 (13.9)- Yes403 (89.2)506 (83.8)909 (86.1)Palliative therapy0.447- No428 (94.7)578 (95.7)1006 (95.3)- Yes24 (5.3)26 (4.3)50 (4.7)Chemotherapy0.034- No118 (26.1)194 (32.1)312 (29.5)- Yes334 (73.9)410 (67.9)744 (70.5)Endocrine therapy0.546- No209 (46.2)268 (44.4)477 (45.2)- Yes243 (53.8)336 (55.6)579 (54.8)Targeted therapy0.951- No318 (70.4)426 (70.5)744 (70.5)- Yes134 (29.6)178 (29.5)312 (29.5)Immunotherapy0.029- No433 (95.8)559 (92.5)992 (93.9)- Yes19 (4.2)45 (7.5)64 (6.1)Pathological type0.349- Invasive ductal carcinoma395 (87.4)548 (90.7)943 (89.3)- Invasive lobular carcinoma9 (2)9 (1.5)18 (1.7)- Carcinoma in situ24 (5.3)21 (3.5)45 (4.3)- Other24 (5.3)26 (4.3)50 (4.7) Baseline characteristics by outcome status. Predictor selection Univariate cox regression analysis identified multiple significant predictors (Table 3). Multivariate Cox regression revealed that tumor size (cm) (HR = 1.025, 95%CI: 1.013-1.037, p<0.001), lymph node dissection (HR = 0.278, 95%CI: 0.199-0.389, p<0.001), ER% (HR = 1.006, 95%CI: 1.003-1.009, p<0.001), PR% (HR = 1.005, 95%CI: 1.002-1.008, p=0.002), Ki-67% (HR = 1.012, 95%CI: 1.007-1.016, p<0.001), and HER2 status (HR = 1.195, 95%CI: 1.098-1.301, p<0.001) were independent prognostic factors for breast cancer DFS (Table 4). These six variables were subsequently used as the uniform input features for all seven machine learning models. A supplementary LASSO-based selection yielded the same core variables plus SII, but the discriminatory gain was negligible (C-index increase <0.01), supporting our use of the six parsimonious predictors. Table 3Univariate cox regression analysis.VariableBSEWalddfSig.Exp(B)95% CI for Exp(B)LowerUpperAge0.0010.0050.0310.8631.0010.9921.01Diabetes0.3820.2362.62610.1051.4650.9232.325Hyperlipidemia0.3890.2482.46310.1171.4760.9082.4Hypertension0.0650.1840.12210.7261.0670.7431.531BMI0.0050.0160.11510.7351.0060.9741.038Prior tumor0.2360.1671.99710.1581.2660.9131.756BI-RADS0.040.0410.95410.3291.0410.961.129Size (cm)0.0250.00618.3861<0.0011.0251.0141.037Laterality (Right)1.33820.512Bilateral-0.1130.1031.19810.2740.8930.731.093Aspect ratio0.0150.2030.00510.9411.0150.6811.512Spiculation-0.1120.1230.83210.3620.8940.7031.137Blood flow-0.1650.1042.50710.1130.8480.6911.04Axillary LN0.0110.1010.01110.9151.0110.8291.232Tumor location-0.1070.1031.07210.30.8990.7341.1Location (Upper inner)4.05740.398Upper outer-0.6340.4621.88710.1690.530.2151.311Lower inner-0.6340.4521.96110.1610.5310.2191.288Lower outer-0.4170.4820.74910.3870.6590.2571.694Biopsy-0.4690.4691.00110.3170.6260.251.568Distant metastasis0.0310.0990.09610.7571.0310.8491.253Breast conservation0.0240.1430.02810.8671.0240.7741.356LN dissection-0.1230.1051.35710.2440.8840.7191.087Pathological tumor diameter-1.3490.16963.7811<0.0010.2590.1860.361Histological grade (G1)-0.0420.0440.92310.3370.9590.8791.045Grade (G2)-0.0980.0572.98910.0840.9060.8111.013Grade (G3)-0.0980.0572.98910.0840.9060.8111.013LN status-0.1790.1790.99810.3180.8360.5881.188LVI0.0480.120.15810.6911.0490.8291.327ER (%)0.0070.00130.2621<0.0011.0071.0051.01PR (%)0.0060.00121.5291<0.0011.0061.0041.009Ki-67 (%)0.010.00219.3431<0.0011.011.0051.014HER20.2020.04124.0271<0.0011.2241.1291.326Adjuvant therapy-0.1780.1381.66110.1980.8370.6381.097Palliative therapy-0.1960.2330.70810.40.8220.5211.297Chemotherapy-0.150.1071.96910.1610.8610.6981.061Endocrine therapy0.0720.0990.51810.4721.0740.8841.305Targeted therapy-0.1730.112.45610.1170.8410.6781.044Immunotherapy0.1080.190.32410.5691.1140.7681.617Pathological type0.98430.805Invasive lobular-0.1760.5030.12210.7270.8390.3132.248Carcinoma in situ-0.2550.2930.75410.3850.7750.4361.378Other-0.0910.2350.14810.70.9130.5761.449 Univariate cox regression analysis. Table 4Multivariate cox regression analysis.VariableBSEdfSig.Exp(B)95% CI for Exp(B)LowerUpperSize (cm)0.0250.0061<0.0011.0251.0131.037Lymph node dissection-1.2790.1711<0.0010.2780.1990.389ER (%)0.0060.0021<0.0011.0061.0031.009PR (%)0.0050.00210.0021.0051.0021.008Ki-67 (%)0.0110.0021<0.0011.0121.0071.016HER20.1780.0431<0.0011.1951.0981.301 Multivariate cox regression analysis. Comparison of multiple models Model performance was evaluated using time-dependent AUC and Brier scores for 1-year, 3-year, and 5-year predictions in both training and validation sets. 95% confidence intervals for key metrics and the Concordance index (C-index) are provided in Table 5. Random Forest achieved the highest time-dependent AUC values across all time points: 0.924 (95%CI: 0.891-0.957, 1-year), 0.890 (95%CI: 0.848-0.932, 3-year), and 0.952 (95%CI: 0.923-0.981, 5-year) in the training set. XGBoost demonstrated excellent performance with AUCs of 0.889 (95%CI: 0.848-0.930, 1-year), 0.866 (95%CI: 0.821-0.911, 3-year), and 0.971 (95%CI: 0.948-0.994, 5-year), showing superior long-term predictive capacity. The Cox model showed moderate performance with AUCs ranging from 0.721 to 0.856. Table 5Comparison of model performance metrics.MetricCoxLASSOElastic-NetDecision treeRandom forestXGBoostGBMTraining SetAUC (1-year)0.8060.7930.7830.7360.9240.8890.875AUC (3-year)0.7210.7260.7300.7050.8900.8660.840AUC (5-year)0.8560.8590.8590.8270.9520.9710.953Brier (1-year)0.1090.1250.1310.1060.0780.0730.109Brier (3-year)0.2100.2180.2380.2090.1540.1480.193Brier (5-year)0.1280.1430.1830.1310.0890.0700.093Validation SetAUC (1-year)0.8240.8080.7650.7530.8510.7790.791AUC (3-year)0.7720.7820.7850.7500.7630.7510.766AUC (5-year)0.8030.7890.8030.8220.8260.8040.805Brier (1-year)0.1070.1330.1420.0980.0890.1040.122Brier (3-year)0.1930.2050.2370.2010.1970.2060.205Brier (5-year)0.1510.1570.1940.1400.1420.1550.159 Comparison of model performance metrics. For Brier scores, Random Forest (1-year: 0.078, 3-year: 0.154, 5-year: 0.089) and XGBoost (1-year: 0.073, 3-year: 0.148, 5-year: 0.070) demonstrated the lowest scores, indicating superior calibration. In contrast, Decision Tree showed higher Brier scores across all time points, suggesting poorer calibration. In the validation set, Random Forest maintained robust performance with 1-year AUC of 0.851 (95%CI: 0.802-0.900), 3-year AUC of 0.763 (95%CI: 0.702-0.824), and 5-year AUC of 0.826 (95%CI: 0.766-0.886). The C-index for Random Forest in the validation set was 0.803 (95%CI: 0.762-0.844), confirming robust overall discriminative capacity. XGBoost showed strong 5-year predictive capacity (AUC = 0.804, 95%CI: 0.740-0.868) in the validation set. For Brier scores in validation, Random Forest achieved the lowest scores at 1-year (0.089) and 3-year (0.197), indicating good calibration. At 5-year, Decision Tree showed the lowest Brier score (0.140), followed by Random Forest (0.142). Calibration metrics were consistently strong for Random Forest: in the validation set, calibration-in-the-large values were close to 0 and calibration slopes near 1 across all time points, confirming that predictions were neither systematically over- nor underestimated. Decision curve analysis demonstrated that Random Forest and XGBoost provided a net benefit over a wide range of clinically relevant threshold probabilities (approximately 10–50% for 5-year DFS), supporting their potential clinical value beyond simple discrimination. Overall, Random Forest and XGBoost consistently outperformed other models in both discrimination and calibration, demonstrating significant advantages for short-term and long-term prediction. A detailed breakdown of performance metrics for all models is provided in Table 5. Cox model development and evaluation Kaplan-Meier survival analysis comparing high-risk and low-risk groups demonstrated significantly higher survival probability in the low-risk group in both training (p<0.0001) and validation (p<0.0001) sets (Figure 1). The Cox proportional hazards model showed good predictive performance with time-dependent AUCs of 0.806 (1-year), 0.721 (3-year), and 0.856 (5-year) in the training set, and 0.824 (1-year), 0.772 (3-year), and 0.803 (5-year) in the validation set (Figure 2). Calibration curves (Figure 3) and decision curve analysis (Figure 4) confirmed potential clinical utility across different threshold probabilities, though net benefit was modest compared to ensemble methods. SHAP value distribution for the Cox model is shown in Figure 5. Kaplan-meier survival curves for high-risk vs. low-risk groups (Cox model). Time-dependent ROC curves for 1-year, 3-year, and 5-year predictions (Cox model). Calibration curves for 1-year, 3-year, and 5-year predictions (Cox model). Decision curve analysis for 1-year, 3-year, and 5-year predictions (Cox model). SHAP value distribution (Cox model). GBM model development and evaluation Kaplan-Meier analysis revealed significant survival differences between risk groups (p<0.0001) (Figure 6). The GBM model demonstrated excellent discrimination with training set time-dependent AUCs of 0.875 (1-year), 0.840 (3-year), and 0.953 (5-year) (Figure 7). Validation set performance remained stable with AUCs of 0.791 (1-year), 0.766 (3-year), and 0.805 (5-year). Calibration curves showed good agreement between predicted and observed outcomes (Figure 8). Decision curve analysis (Figure 9) and SHAP value distribution (Figure 10) are provided. Kaplan-Meier survival curves (GBM model). Time-dependent ROC curves (GBM model). Calibration curves (GBM Model). Decision curve analysis (GBM model). SHAP value distribution (GBM model). LASSO model development and evaluation Kaplan-Meier analysis showed significant stratification between risk groups (p<0.0001) (Figure 11). The LASSO model achieved time-dependent AUCs of 0.793 (1-year), 0.726 (3-year), and 0.859 (5-year) in the training set (Figure 12). Validation set performance was comparable with AUCs of 0.808 (1-year), 0.782 (3-year), and 0.789 (5-year), demonstrating stable discrimination across time points. Calibration curves (Figure 13), decision curve analysis (Figure 14), and SHAP values (Figure 15) are presented. Kaplan-Meier survival curves (LASSO model). Time-dependent ROC curves (LASSO model). Calibration curves (LASSO model). Decision curve analysis (LASSO model). SHAP value distribution (LASSO model). XGBoost model development and evaluation Significant survival differences between risk groups were confirmed by Kaplan-Meier analysis (p<0.0001) (Figure 16). The XGBoost model demonstrated excellent predictive performance with training set time-dependent AUCs of 0.889 (1-year), 0.866 (3-year), and 0.971 (5-year) (Figure 17). Validation set AUCs were 0.779 (1-year), 0.751 (3-year), and 0.804 (5-year), indicating good generalization. Calibration curves (Figure 18), decision curve analysis (Figure 19), and SHAP value distribution (Figure 20) are shown. Kaplan-Meier survival curves (XGBoost model). Time-dependent ROC curves (XGBoost model). Calibration curves (XGBoost model). Decision curve analysis (XGBoost model). SHAP value distribution (XGBoost model). Elastic-net model development and evaluation Kaplan-Meier analysis revealed significant risk stratification (p<0.0001) (Figure 21). The Elastic-Net model achieved training set time-dependent AUCs of 0.783 (1-year), 0.730 (3-year), and 0.859 (5-year) (Figure 22). Validation set performance was robust with AUCs of 0.765 (1-year), 0.785 (3-year), and 0.803 (5-year), demonstrating stable long-term predictive capacity. Calibration curves (Figure 23), decision curve analysis (Figure 24), and SHAP values (Figure 25) are provided. Kaplan-Meier survival curves (elastic-net model). Time-dependent ROC curves (elastic-net model). Calibration curves (elastic-net model). Decision curve analysis (elastic-net model). SHAP Value distribution (elastic-net model). Decision tree model development and evaluation Significant survival differences between risk groups were observed (p<0.0001) (Figure 26). The Decision Tree model achieved training set time-dependent AUCs of 0.736 (1-year), 0.705 (3-year), and 0.827 (5-year) (Figure 27). Validation set performance was comparable with AUCs of 0.753 (1-year), 0.750 (3-year), and 0.822 (5-year), showing improved performance with longer follow-up. Calibration curves (Figure 28), decision curve analysis (Figure 29), and SHAP value distribution (Figure 30) are shown. Kaplan-Meier Survival curves (decision tree model). Time-dependent ROC curves (decision tree model). Calibration curves (decision tree model). Decision curve analysis (decision tree model). SHAP value distribution (decision tree model). Random forest model development and evaluation Kaplan-Meier analysis confirmed significant risk stratification (p<0.0001) (Figure 31). The Random Forest model demonstrated superior discrimination with training set time-dependent AUCs of 0.924 (1-year), 0.890 (3-year), and 0.952 (5-year) (Figure 32). Validation set performance remained strong with AUCs of 0.851 (1-year), 0.763 (3-year), and 0.826 (5-year), confirming robust generalization. The C-index of 0.803 (95%CI: 0.762-0.844) in the validation set further supported its superior overall discriminative capacity. Calibration curves (Figure 33), decision curve analysis (Figure 34), and SHAP value distribution (Figure 35) are presented. Kaplan-Meier survival curves (random forest model). Time-dependent ROC curves (random forest model). Calibration curves (random forest model). Decision curve analysis (random forest model). SHAP value distribution (random forest model). Discussion This single-center, retrospective study systematically developed and compared multiple machine learning models for breast cancer prognosis. Our results identified tumor size, ER, PR, Ki-67, and HER2 status as important prognostic factors, consistent with previous studies emphasizing the role of clinicopathological features (24, 25). Importantly, ensemble learning methods, particularly Random Forest, demonstrated superior and stable predictive power. The central methodological contribution of this work is the establishment of a rigorous analytical pipeline—from time-to-event-based feature selection to cross-validated model training and interpretability analysis—which provides a reproducible template for future research in primary healthcare settings. However, all findings must be interpreted with caution given the study’s limitations. Tumor size is a classic prognostic factor in breast cancer, widely used for risk assessment (26). Numerous studies have demonstrated associations between tumor size and survival, recurrence, and metastasis risk (27). Specifically, larger tumors are typically associated with higher lymph node metastasis rates and poorer survival outcomes (28). The finding that smaller tumor size by ultrasound was associated with poorer outcomes in our study is counterintuitive but has been observed in specific contexts. A plausible explanation is confounding by indication and differences in assessment modality. In our cohort, patients with smaller tumors on ultrasound often had aggressive biology (e.g., high-grade, HER2-positive, or triple-negative subtypes) that might not manifest as large masses, leading to early metastasis. Additionally, smaller palpable tumors might be more amenable to breast-conserving surgery, where pathological tumor size measurement differs from whole-specimen assessment in mastectomy, potentially introducing systematic measurement bias. This highlights the complex relationship between tumor dimension and biological aggressiveness. In this study, ER and HER2 status were identified as core prognostic factors affecting DFS. Consistent evidence shows that ER-positive patients generally have better outcomes due to responsiveness to endocrine therapy (29, 30). HER2 positivity, historically an aggressive phenotype, remained a key prognostic factor; however, its predictive weight (17.6% SHAP contribution) also reflects the profound impact of modern targeted therapy. Our model captured the independent prognostic value of HER2-low expression, a finding of contemporary interest potentially linked to the heterogeneous efficacy of novel antibody-drug conjugates (31). Future studies with detailed treatment data are needed to dissect the interplay between target expression, therapy received, and survival. Ki-67’s high contribution (22.1%) to model predictions underscores its core function in cell cycle regulation. Previous studies have primarily focused on linear associations between Ki-67 and proliferation index, with research showing that Ki-67>30% increases breast cancer recurrence risk (32). Through SHAP interaction analysis, we could quantify its non-linear relationship with molecular subtypes, finding that the effect of high Ki-67 was more prominent in Luminal B patients compared to those with triple-negative disease. This subtype-dependent effect may stem from the specific efficacy of CDK4/6 inhibitors in Luminal tumors or a ceiling effect of a high basal proliferation rate in triple-negative disease (33, 34). The study also highlighted the role of the inflammatory microenvironment. While NLR, PLR, and SII were investigated, their contribution to the final models was limited, and only SII showed considerable weight (12.3%). This selective, rather than universal, contribution suggests that systemic inflammatory markers may reflect a specific aspect of tumor biology, such as M2 macrophage polarization in Luminal subtypes, rather than being a general driver of poor prognosis (35). The limited integration of the full set of inflammatory markers into our final models is an important finding that must be acknowledged, and their practical utility over traditional variables warrants further study in richer datasets. Furthermore, we acknowledge the inherent limitation of selecting predictors based on multivariable Cox P-values. Such an approach can be sensitive to sample size and may omit borderline variables that carry non-linear or interactive predictive information. Although our supplementary LASSO analysis largely converged on the same set of features, future studies would benefit from employing stability selection or fully embedded feature selection within the machine learning framework to enhance robustness. Observational studies are inherently limited in establishing causality We want to clearly state that terms like “association” or “correlation” are used throughout this manuscript intentionally to avoid any implication of a causal pathway. The observed lower risk associated with lymph node dissection, for example, should not be misinterpreted as a “protective effect” of the procedure, as this association is heavily confounded by clinical decision-making, tumor stage, adjuvant therapy, and other factors that influence both the decision to perform dissection and patient outcomes (36). The limitations of this study must be placed at the forefront of interpretation The single-center, retrospective design is a major constraint on generalizability. The absence of an external validation cohort prevents assessment of model performance in different clinical settings and ethnic groups. Furthermore, potential residual confounding from unmeasured variables, such as detailed chemotherapy regimens, comorbidities, or nuanced staging parameters, cannot be ruled out despite the use of multivariable adjustment. Higher prediction error rates in young patients (≤30 years) suggest the need for age-specific models (37). Therefore, all claims regarding clinical applicability must be tempered. Our models represent “promising tools under development,” not a “reliable tool for clinical decision-making.” The statement about “redefining clinical standards” has been removed as it is not supported by the current level of evidence. Future research will focus on three pillars of model advancement: (1) rigorous external validation through multi-center cohorts; (2) integration of higher-dimensional data like spatial transcriptomics or advanced imaging; and (3) development of dynamic prognosis systems based on ctDNA mutation abundance for real-time monitoring of treatment response (38, 39). Until such validation is complete, our work should be viewed as a methodological step forward, not a clinical solution. Conclusion This single-center study identifies key prognostic factors for breast cancer and demonstrates that ensemble machine learning models, particularly Random Forest, offer superior predictive performance for short- and long-term outcomes when evaluated with a time-dependent framework and rigorous internal validation. SHAP-based interpretation enhances model transparency. However, given the single-center retrospective design, lack of external validation, and potential for residual confounding, the developed models cannot yet be considered a reliable or generalizable clinical tool. Future multi-center, prospective studies with independent external validation are essential to confirm these findings before any clinical translation can be considered. This work provides a certain methodological foundation for such future investigations.