Machine learning models for predicting survival in patients of hepatocellular carcinoma with second primary malignancy
Original Article

Machine learning models for predicting survival in patients of hepatocellular carcinoma with second primary malignancy

Yu Nie1#, Lu Nie2#, Boyu Li3, Yuanyuan Wang4, Liyuan Wang4, Xingyan Lv4, Runjie Sun4, Mengting Xia4, Ruiyang Wang4*, Xing Cui4*

1Radiotherapy Department, Shandong Second Provincial General Hospital, Jinan, China; 2Department of Oncology, The First Affiliated Hospital of Jinzhou Medical University, Jinzhou, China; 3Department of General Surgery, The Second Affiliated Hospital of Shandong University of Traditional Chinese Medicine, Jinan, China; 4Department of Oncology and Hematology, The Second Affiliated Hospital of Shandong University of Traditional Chinese Medicine, Jinan, China

Contributions: (I) Conception and design: Y Nie, L Nie; (II) Administrative support: R Wang, X Cui; (III) Provision of study materials or patients: B Li, Y Wang; (IV) Collection and assembly of data: L Wang, X Lv; (V) Data analysis and interpretation: R Sun, M Xia; (VI) Manuscript writing: All authors; (VII) Final approval of manuscript: All authors.

#These authors contributed equally to this work as co-first authors.

*These authors contributed equally to this work.

Correspondence to: Ruiyang Wang, MD. Department of Oncology and Hematology, The Second Affiliated Hospital of Shandong University of Traditional Chinese Medicine, No. 1 Jingba Road, Lixia District, Jinan 250001, China. Email: ruiyang@126.com.

Background: Hepatocellular carcinoma (HCC) is a major cause of cancer mortality, and an increasing number of long-term survivors develop second primary malignancies (SPMs). Reliable risk prediction in this heterogeneous population remains challenging, and it is unclear whether modern machine learning methods can offer superior prognostic accuracy. This study aimed to develop and validate machine learning models to improve prognostic prediction for HCC survivors.

Methods: A total of 1,580 HCC patients with second primary cancer were extracted from the Surveillance, Epidemiology, and End Results (SEER) database and randomly divided into a training group and a test group at a ratio of 7:3. Prognostic prediction models were developed using random survival forest (RSF), DeepSurv, and the COX proportional hazards (COXPH) model. The performance of each model was assessed using the concordance index (C-index) to measure discrimination ability. Additionally, the models’ discriminative power, calibration, and clinical utility at 1-, 2- and 3-year intervals were evaluated using the area under the receiver operating characteristic curve (AUROC), calibration plots, and decision curve analysis (DCA). The optimal model was identified by comparing the overall performance of each model, and risk stratification of patients was performed using the risk scores generated by the selected model. The best-performing model was further interpreted with global Shapley Additive exPlanation (SHAP) plots, while individual patient prognosis and interpretation were carried out using local SHAP plots and personalized survival curves.

Results: Among the three models, the RSF model demonstrated the highest performance with a C-index of 0.730. It also surpassed the other two models in terms of calibration and clinical applicability. Based on the RSF model, patients were categorized into high-risk (risk score >86.17), intermediate-risk (56.32≤ risk score ≤86.17), and low-risk (risk score <56.32) groups. The SHAP analysis of the RSF model identified surgery as the most significant variable, followed by age, tumor (T) stage, tumor size, and SPM. For individual prognosis prediction, three patients were randomly selected, and the local SHAP plots aligned with the predictions for each patient.

Conclusions: The RSF model is superior to the COXPH model and DeepSurv model in predicting the prognosis of HCC patients with second primary cancer, and can provide individualized prediction and interpretation, which facilitates personalized medicine.

Keywords: Hepatocellular carcinoma (HCC); second primary malignancy (SPM); prognostic model; Shapley Additive exPlanation (SHAP); shiny application


Submitted Mar 16, 2025. Accepted for publication Jun 22, 2025. Published online Oct 29, 2025.

doi: 10.21037/tcr-2025-589


Highlight box

Key findings

• The random survival forest (RSF) model is superior to the COX proportional hazards (COXPH) model and DeepSurv model in predicting the prognosis of hepatocellular carcinoma (HCC) patients with second primary cancer, and can provide individualized prediction and interpretation, which facilitates personalized medicine.

What is known and what is new?

• Several clinical prediction models for HCC patient survival have already been developed. We used COXPH regression to construct a prognostic model for patients with primary non-cirrhotic liver cancer, and the effect was better than the traditional American Joint Committee on Cancer staging system.

• However, there are few prognostic studies on patients with HCC-second primary malignancy (HCC-SPM) and high-performance predictive models are lacking. This study developed a prediction model for the prognosis prediction of HCC-SPM patients using the RSF model.

What is the implication, and what should change now?

• The RSF model enables accurate prediction of individual patient survival, supporting personalized medicine.


Introduction

Hepatocellular carcinoma (HCC) ranks as the sixth most prevalent cancer and the fourth leading cause of cancer-related deaths globally (1,2). With the advancement of medical technology and the development of various new anticancer drugs, the number of HCC survivors is gradually increasing. Due to the cancer constitution of patients with HCC, it is necessary to be alert to the occurrence of second primary cancer. Second primary malignancies (SPMs), refers to the same patient suffering from two primary malignant tumors at the same time or successively (3), each of which is malignant, and histopathologically independent, except for recurrence or metastasis. A study based on a large database showed (4) that eight types of first primary cancers including HCC have a higher risk of developing second primary cancers, so sufficient attention should be paid to the occurrence of second primary cancers of patients with HCC.

In this context, an effective prognostic model for patients with HCC and a second primary malignancy (HCC-SPM) is valuable for the clinical management of these cases. Several clinical prediction models for HCC patient survival have already been developed. Cao et al. (5) used COX proportional hazards (COXPH) regression to construct a prognostic model for patients with primary non-cirrhotic liver cancer, and the effect was better than the traditional American Joint Committee on Cancer (AJCC) staging system. Liu et al. (6) used COXPH regression to construct a model of the prognosis of patients with primary liver cancer from previous thyroid cancer. However, there are few prognostic studies on patients with HCC-SPM and high-performance predictive models are lacking.

Random survival forest (RSF) (7) is a non-parametric algorithm for analyzing right-truncated survival data. Due to its high performance and interpretability, RSF is being widely accepted. DeepSurv, a novel method devised by Katzman and colleagues (8), employs deep learning to incorporate COXPH proportional hazards into survival analysis. This approach leverages the capabilities of deep neural networks to improve the modeling of survival data by understanding complex relationships within the data.

In this research, our objective was to utilize data from the Surveillance, Epidemiology, and End Results (SEER) database to develop the most accurate and clinically applicable prognostic model for HCC-SPM patients using COXPH regression, RSF, and DeepSurv algorithms for improving the management of HCC-SPM patients. By comparing these models, we aimed to identify the most effective one, providing a predictive tool for physicians and patients to evaluate risk stratification and individual prognosis. We present this article in accordance with the TRIPOD reporting checklist (available at https://tcr.amegroups.com/article/view/10.21037/tcr-2025-589/rc).


Methods

Data sources

Patients diagnosed with HCC-SPM from 2010 to 2021 were selected from the SEER database (https://seer.cancer.gov/), a comprehensive U.S. cancer registry that encompasses approximately 30% of the population across 17 cancer treatment centers. Since the SEER database provides publicly accessible data with anonymized patient details, neither ethical approval nor patient consent was necessary for this study. This study was conducted in accordance with the Declaration of Helsinki and its subsequent amendments. The methodologies employed adhered to the SEER database’s published research protocols.

Methods of identifying HCC-SPM cases

The patient’s initial diagnosis must be HCC and the HCC must be their first primary cancer. Screening for confirmatory criteria for HCC was performed using the International Classification of Diseases for Oncology, Third Edition (ICD-O-3). All selected patients with HCC were further screened to confirm the presence of an SPM. SPM is defined as an SPM of a different type that occurs in a patient on top of an HCC. The SEER database records the diagnostic information and chronological order of all primary tumors, and can therefore come to confirm the presence of an SPM.

Research variable

This study incorporated variables such as demographic details (sex, age, race, marital status), tumor attributes [grade, tumor (T) stage, node (N) stage, metastasis (M) stage, tumor size, type of second primary cancer], and treatment modalities (surgery, radiotherapy, chemotherapy), alongside survival status, cause of death, and duration of survival. Inclusion criteria: patients with HCC diagnosed in 2010–2021. Exclusion criteria: (I) HCC was not the initial primary cancer; (II) HCC is not the first primary cancer; (III) non-pathologic diagnosis confirmed; (IV) patients with deletions in each variable except grade; (V) survival time <1 month or survival time unknown. The process of data screening is illustrated in Figure 1.

Figure 1 Flowchart for data screening. SEER, Surveillance, Epidemiology, and End Results.

Methods of model construction and validation

Patients were randomly allocated into training and validation sets at a 7:3 ratio. Initially, COXPH regression models were built by selecting variables via univariate regression, followed by multivariate COXPH regression models. The other two models, RSF and DeepSurv, underwent hyperparameter tuning on the training set through a grid search technique to identify optimal hyperparameters for each model.

The efficacy of each model was assessed on the validation set using specific metrics: the concordance index (C-index) and the area under the receiver operating characteristic curve (AUROC) for 1, 2, and 3 years to evaluate their discriminative capacities. Model calibration was examined using calibration curves at 1, 2, and 3 years. Additionally, decision curve analysis (DCA) for the same time intervals was employed to determine the clinical net benefit of each model.

Risk stratification, interpretation, and individual prediction for optimal modeling

The optimal model derived from the comparison of the individual models allows for the calculation of a risk score for each patient. Patients were grouped based on their risk scores. Survival outcomes were analyzed using Kaplan-Meier curves, with differences evaluated using the log-rank test.

Shapley Additive exPlanation (SHAP) can be used for the interpretation of machine learning models (9-11), in a SHAP plot, the position of each variable along the horizontal axis reflects its impact on the outcome, while the color of the dots indicates the magnitude of the variable’s contribution.

Individual predictions include survival probability plots and local SHAP plots, which offer detailed forecasts regarding survival expectations and risk factors for each person. Survival probabilities are determined using nonparametric estimates. The local SHAP plot, a localized interpretation of SHAP, illustrates the impact of variables on an individual’s prognosis. This analysis helps establish a correlation between risk factors and individual outcomes.

Ultimately, we created a web-based calculator using the optimal model to forecast the prognosis for patients with liver cancer who have a secondary primary cancer, facilitating personalized predictions.

Statistical analysis

The R language CatPredi package (12) was used for discretization of continuous variables such as age, tumor size and risk score. Categorical variables across the training and validation sets were analyzed using the χ2 test or Fisher’s exact test. A bilateral P value below 0.05 was deemed statistically significant. The mlr3proba package (13) for R (version 0.4.13) was used to construct each of the five survival machine learning models, with the DeepSurv model relying on the Pycox module. Interpretation of the survival machine learning model was done using Python’s shap module (version 0.37.0). A web-based calculator for the optimal prediction model was developed using Shiny (https://www.shinyapps.io).


Results

Clinical characteristics of patients with HCC-SPM

A total of 1,580 HCC-SPM patients were enrolled in the study. Age was divided into two categories with 65 years old as the dividing point, and tumor size is divided into three categories with 2.2 and 4.2 cm as the dividing points, respectively. The division results are detailed in Figure S1. The demographic and clinical details of the patients in the training and validation sets are presented in Table 1.

Table 1

The information for HCC-SPM patients in the training set and the validation set

Variables Total (n=1,580) Training set (n=1,106) Validation set (n=474) P
SPM 0.45
   Liver 175 (11.08) 130 (11.75) 45 (9.49)
   Lung and bronchus 191 (12.09) 127 (11.48) 64 (13.50)
   Prostate 126 (7.98) 88 (7.96) 38 (8.02)
   Other 1,088 (68.86) 761 (68.81) 327 (68.99)
Sex 0.57
   Female 363 (22.98) 259 (23.42) 104 (21.94)
   Male 1,217 (77.03) 847 (76.58) 370 (78.06)
Age (years) 0.57
   <65 771 (48.80) 534 (48.28) 237 (50.00)
   ≥65 809 (51.20) 572 (51.72) 237 (50.00)
Marital 0.95
   Unmarried 258 (16.33) 179 (16.18) 79 (16.67)
   Married 925 (58.54) 647 (58.50) 278 (58.65)
   SDWU 397 (25.13) 280 (25.32) 117 (24.68)
Race 0.95
   White 1,081 (68.42) 754 (68.17) 327 (68.99)
   Black 182 (11.52) 128 (11.57) 54 (11.39)
   Other 317 (20.06) 224 (20.25) 93 (19.62)
Grade 0.36
   I 337 (21.33) 226 (20.43) 111 (23.42)
   II 495 (31.33) 353 (31.92) 142 (29.96)
   III/IV 159 (10.06) 106 (9.58) 53 (11.18)
   Unknown 589 (37.28) 421 (38.07) 168 (35.44)
Tumor size (cm) 0.32
   <2.2 303 (19.18) 213 (19.26) 90 (18.99)
   2.2–4.2 641 (40.57) 436 (39.42) 205 (43.25)
   >4.2 636 (40.25) 457 (41.32) 179 (37.76)
T stage 0.08
   T1 984 (62.28) 687 (62.12) 297 (62.66)
   T2 380 (24.05) 255 (23.06) 125 (26.37)
   T3 176 (11.14) 137 (12.39) 39 (8.23)
   T4 40 (2.53) 27 (2.44) 13 (2.74)
N stage 0.53
   N0 1,539 (97.41) 1,075 (97.20) 464 (97.89)
   N1 41 (2.60) 31 (2.80) 10 (2.11)
M stage 0.61
   M0 1,524 (96.46) 1,069 (96.66) 455 (95.99)
   M1 56 (3.54) 37 (3.35) 19 (4.01)
Surgery 0.99
   No 589 (37.28) 412 (37.25) 177 (37.34)
   Yes 991 (62.72) 694 (62.75) 297 (62.66)
Chemotherapy 0.49
   No/unknown 1,035 (65.51) 731 (66.09) 304 (64.14)
   Yes 545 (34.49) 375 (33.91) 170 (35.87)
Radiation 0.38
   No/unknown 1,384 (87.60) 963 (87.07) 421 (88.82)
   Yes 196 (12.41) 143 (12.93) 53 (11.18)

HCC-SPM, hepatocellular carcinoma and a second primary malignancy; M, metastasis; N, node; SDWU, separated, divorced, widowed, or unknown; SPM, second primary malignancy; T, tumor.

Building 5 survival machine learning models

According to the TIMER database, numerous tumor types, particularly LUAD, exhibit significantly elevated PRSS3 mRNA expression (Figure 2A). We next assessed PRSS3 expression in LUAD through the UALCAN database (Figure 2B). We analyzed the downloaded LUAD data with the R package tidyverse (version 2.0.0). Compared with those in tumor samples, PRSS3 mRNA transcript levels were lower in normal samples (Figure 2C).

Figure 2 ROC curves for 3 models in the training set: (A) the time point is 1 year; (B) the time point is 2 years; (C) the time point is 3 years. ROC curves for 3 models in the validation set: (D) the time point is 1 year; (E) the time point is 2 years; (F) the time point is 3 years. AUC, area under the curve; CI, confidence interval; ROC, receiver operating characteristic; RSF, random survival forest.

RSF model: modeling was performed directly using all variables, using grid search, and 10-fold cross-validation was used to determine the optimal combination of hyperparameters for the model, including a ntree of 500, a mtry of 2, a nodesize of 4, a nodedepth of 4, and the rest of the hyperparameters at their default values.

COXPH model: univariate COXPH regression analysis identified significant variables such as SPM, sex, age, marital status, race, grade, tumor size, T stage, N stage, M stage, surgery, chemotherapy, and radiation. The multivariate COXPH regression analysis highlighted SPM, sex, age, marital status, grade, tumor size, T stage, N stage, and surgery as key prognostic factors for HCC-SPM patients. Details from both univariate and multivariate analyses are displayed in Table 2.

Table 2

Univariate and multivariate COXPH regression analysis for OS in training set

Variables Univariate Multivariate
HR 95% CI P HR 95% CI P
SPM
   Liver Ref Ref
   Lung and bronchus 2.371 1.688–3.331 <0.001 2.371 1.676–3.355 <0.001
   Prostate 0.758 0.482–1.191 0.23 0.703 0.441–1.120 0.14
   Other 1.913 1.441–2.539 <0.001 1.668 1.248–2.228 0.001
Sex
   Female Ref Ref
   Male 1.400 1.143–1.716 0.001 1.522 1.229–1.883 <0.001
Age
   <65 Ref Ref
   ≥65 1.771 1.506–2.083 <0.001 1.562 1.312–1.861 <0.001
Marital
   Unmarried Ref Ref
   Married 0.788 0.632–0.983 0.04 0.752 0.597–0.948 0.02
   SDWU 1.002 0.783–1.281 0.99 0.830 0.640–1.077 0.16
Race
   White Ref Ref
   Black 1.027 0.791–1.333 0.84 1.138 0.869–1.489 0.35
   Other 0.783 0.636–0.965 0.02 0.837 0.674–1.040 0.11
Grade
   I Ref Ref
   II 1.152 0.914–1.451 0.23 1.289 1.018–1.633 0.04
   III/IV 1.742 1.289–2.355 <0.001 1.768 1.285–2.432 <0.001
   Unknown 1.324 1.056–1.660 0.02 1.145 0.910–1.441 0.25
Tumor size
   <2.2 Ref Ref
   2.2–4.2 1.270 0.999–1.614 0.051 1.377 1.073–1.767 0.01
   >4.2 2.035 1.612–2.568 <0.001 1.613 1.239–2.098 <0.001
T stage
   T1 Ref Ref
   T2 1.229 1.013–1.491 0.04 1.281 1.052–1.561 0.01
   T3 2.231 1.781–2.794 <0.001 1.349 1.044–1.744 0.02
   T4 2.378 1.460–3.873 <0.001 1.312 0.784–2.197 0.30
N stage
   N0 Ref Ref
   N1 4.638 3.069–7.011 <0.001 3.158 1.999–4.989 <0.001
M stage
   M0 Ref Ref
   M1 3.694 2.523–5.409 <0.001 1.287 0.833–1.987 0.26
Surgery
   No Ref Ref
   Yes 0.328 0.279–0.386 <0.001 0.345 0.282–0.421 <0.001
Chemotherapy
   No/unknown Ref Ref
   Yes 1.271 1.081–1.496 0.004 0.925 0.769–1.114 0.41
Radiation
   No/unknown Ref Ref
   Yes 1.495 1.177–1.898 0.001 0.879 0.678–1.140 0.33

CI, confidence interval; COXPH, COX proportional hazards; HR, hazard ratio; M, metastasis; N, node; OS, overall survival; SDWU, separated, divorced, widowed, or unknown; T, tumor.

DeepSurv model: the modeling was performed directly using all variables, using a grid search with 10-fold cross-validation to determine the optimal combination of hyperparameters for the model, including an alpha of 0.6, a learning rate of 0.02, and the remaining hyperparameters at their default values.

Evaluation and interpretation of models

Comparing the differentiation performance C-index of each model in the training set, the RSF model had the highest C-index of 0.746, followed by the COXPH model (0.738), and the worst was the DeepSurv model (0.681). While, in the validation set, the RSF model had the highest C-index of 0.730, followed by the COXPH model (0.713), and the worst was the DeepSurv model (0.685).

Comparing the ROC curves for 1, 2, and 3 years predictions of each model in the training set (Figure 2A-2C), the RSF model demonstrated the best differentiation among the three models and the same was observed in the validation set (Figure 2D-2F).

Comparing the calibration curves for 1, 2, and 3 years predictions of each model in the training set (Figure 3A-3C), the RSF model performed the best among the three models in terms of prediction consistency, While in the validation set, the consistency of the RSF model also performs well (Figure 3D-3F).

Figure 3 Calibration curves for 3 models in the training set: (A) the time point is 1 year; (B) the time point is 2 years; (C) the time point is 3 years. Calibration curves for 3 models in the validation set: (D) the time point is 1 year; (E) the time point is 2 years; (F) the time point is 3 years. RSF, random survival forest.

Comparing the DCA curves for 1, 2, and 3 years predictions of each model in the training set (Figure 4A-4C), the RSF model showed better clinical net benefit among the three models and the same was observed in the validation set (Figure 4D-4F).

Figure 4 DCA curves for 3 models in the training set: (A) the time point is 1 year; (B) the time point is 2 years; (C) the time point is 3 years. DCA curves for 3 models in the validation set: (D) the time point is 1 year; (E) the time point is 2 years; (F) the time point is 3 years. DCA, decision curve analysis; RSF, random survival forest.

Additionally, the RSF model was visualized and interpreted using a SHAP plot (Figure 5), where variables were ranked by importance. Surgery emerged as the most significant variable, followed by age, T stage, tumor size, and SPM, among others.

Figure 5 SHAP diagram of the RSF model. M, metastasis; N, node; RSF, random survival forest; SHAP, Shapley Additive exPlanation; SPM, second primary malignancy; T, tumor.

Risk of RSF stratification in HCC-SPM patients

Patients in the training and validation sets were divided into high-risk (risk score >86.17), intermediate-risk (56.32≤ risk score ≤86.17), and low-risk (risk score <56.32) groups. Kaplan-Meier analysis and log-rank tests for these groups are depicted in Figure 6A,6B, showing statistically significant differences among them.

Figure 6 Risk stratification of RSF models in training set (A) and validation set (B). RSF, random survival forest.

Prediction of individual prognosis for HCC-SPM

Three patients were randomly selected and sequentially numbered for individual prognostic prediction arguments. Figure 7A shows the individual predicted survival rates. It can be seen that the 3rd patient has a relatively good survival rate, while the 1st patient has a poor survival rate. The local SHAP plot elucidates each patient’s prognosis by detailing the impact of various variables, where red bars indicate risk factors associated with a poorer prognosis, and blue bars represent protective factors.

  • Patient 1: the local SHAP plot (Figure 7B) showed that of the first five most important variables, age, T stage, and chemotherapy were prognostic protective factors, while surgery and SPM were a risk factor for promoting a poor prognosis.
  • Patient 2: the local SHAP plot (Figure 7C) showed that of the first 5 most important variables, surgery, SPM, and age were prognostic protective factors, while tumor size and grade were a risk factor for promoting a poor prognosis.
  • Patient 3: the local SHAP plot (Figure 7D) showed that of the first 5 most important variables, surgery, age, sex, T stage, and race were all prognostic protective factors.
Figure 7 Prediction of individual HCC-SPM patients. (A) Survival curves of individual patients. (B) Localized SHAP plot of patient 1. (C) Localized SHAP plot of patient 2. (D) Localized SHAP plot for patient 3. HCC-SPM, hepatocellular carcinoma and a second primary malignancy; M, metastasis; N, node; SHAP, Shapley Additive exPlanation; SPM, second primary malignancy; T, tumor.

Web application for predicting the prognosis of HCC-SPM patients

This study established and validated 3 models, concluding that the RSF model is the best for HCC-SPM patients. To further disseminate our findings, we developed a web application (https://pre-model.shinyapps.io/RSF-Model/) based on Shiny to predict the prognosis risk of HCC-SPM patients, aiming to assist doctors in clinical prognosis evaluation.


Discussion

In this study, prognostic models for HCC-SPM patients were developed based on SEER database using 3 machine learning methods. RSF model had better discrimination, calibration and clinical applicability in predicting OS at 1, 2 and 3 years in HCC-SPM patients, followed by COXPH model and the worst was the DeepSurv model. Interpretation of the RSF model based on SHAP showed that surgery was the most important risk factor, followed by age, T stage, tumor size, and SPM, etc. In addition, patient risk stratification was performed based on the RSF model, and there was a significant difference in survival among different stratified populations. For the prediction of individual prognosis, localized SHAP maps showed potential in clinical practice.

The traditional COXPH model is widely used in the field of survival analysis, however, there are some limitations of this model. First, the effect of covariates on survival cannot vary over time (14). Second, the sample size for positive outcomes is greater than 10 times the number of variables in the COXPH model (15). Third, the impact of nonlinear factors on patient survival outcomes cannot be considered. Because of their nonparametric structure, machine learning methods do not suffer from these limitations and are increasingly used in clinical research. The RSF model (16,17) proposed in 2008 and characterized by a balance between model fitting and interpretation, is increasingly being used in prognostic prediction models, as evidenced by the construction of the RSF model and the SHAP-based interpretation in this study. In addition, the DeepSurv model has performed well in previous studies, especially those related to imaging data (18,19), however, this study does not reflect the advantages of the DeepSurv model, which may be related to the low data complexity of this study.

The RSF model of this study ranked the importance of the influential factors affecting the prognosis of patients with HCC-SPM in order to help clinicians to identify the important factors affecting the prognosis. Surgery was considered to be the most important variable in terms of prognosis, i.e., the adoption of surgical treatments significantly improved the prognostic outcomes of patients with HCC-SPM. Previous studies (20-22) related to HCC have also demonstrated more clinical benefit in HCC patients who underwent surgery. Ge et al. (23) constructed a prognostic model for risk factors of HCC using COXPH regression model and RSF model, respectively, where the importance of the variables in the RSF model showed that surgery was the most important variable, which is consistent with the findings of this study. The traditional T stage and N stage can provide a rough assessment of the prognosis of patients with HCC, and a number of studies (24-26) have confirmed the importance of these AJCC staging. The significance of the variables in this study also suggests that T stage, N stage and M stage are factors that have a greater impact on prognosis. This study shows that tumor size has a significant impact on the prognosis of HCC. However, Zhang et al. (27) conducted age-stratified COXPH regression on patients with isolated HCC without vascular infiltration and found that, after the age of 65 years, tumor size was no longer an independent risk factor for the prognosis of isolated HCC without vascular invasion. Xie et al. (28) used PSM to confirm that there was no significant difference between tumor size and prognosis in patients with distant metastatic HCC. This study also showed that different types of SPM are also more important influences on the prognosis of HCC. According to our knowledge, this has not been reported in previous studies. In addition, the prognostic impact of marital, sex, chemotherapy, race, and radiation sequentially appeared to be less important in patients with HCC-SPM.

The classification of patients into high, intermediate and low risk groups based on the risk scores of the predictive nomogram is one of the more popular methods used in a large number of COXPH regression models (29-32) and has been widely applied. For the RSF model, risk scores can be obtained directly, and therefore patients can also be categorized into high, medium, and low risk groups. This study has modeled survival differences between high, intermediate, and low risk populations classified based on the RSF model, which can help clinicians identify those at high risk of death among HCC-SPM patients in a timely manner and take timely interventions. More surprisingly, the RSF model also outputs survival curves for individual HCC-SPM patients, which enable more accurate prediction of individual prognosis. This compensates for the fact that nomogram based on COXPH regression can only predict prognosis at certain specified time points. More importantly, the local SHAP plot of the RSF model visually explains the impact of risk factors on individual survival outcomes, which may be a new trend for future clinical prediction models.

There are some limitations in this study. First, the retrospective study data may have some selection bias. Second, both the training and validation sets are homologous data from the SEER database, which lacks external validation to confirm the generalization ability of the model. Third, limited by the SEER database, some clinical indicators and treatment protocols could not be included in the study.


Conclusions

This study developed a prediction model for the prognosis prediction of HCC-SPM patients using the RSF model. Patients were categorized into high-, intermediate-, and low-risk groups, aiding clinicians in identifying those at higher risk. Additionally, the RSF model enables accurate prediction of individual patient survival, supporting personalized medicine.


Acknowledgments

None.


Footnote

Reporting Checklist: The authors have completed the TRIPOD reporting checklist. Available at https://tcr.amegroups.com/article/view/10.21037/tcr-2025-589/rc

Peer Review File: Available at https://tcr.amegroups.com/article/view/10.21037/tcr-2025-589/prf

Funding: None.

Conflicts of Interest: All authors have completed the ICMJE uniform disclosure form (available at https://tcr.amegroups.com/article/view/10.21037/tcr-2025-589/coif). The authors have no conflicts of interest to declare.

Ethical Statement: The authors are accountable for all aspects of the work in ensuring that questions related to the accuracy or integrity of any part of the work are appropriately investigated and resolved. This study was conducted in accordance with the Declaration of Helsinki and its subsequent amendments.

Open Access Statement: This is an Open Access article distributed in accordance with the Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International License (CC BY-NC-ND 4.0), which permits the non-commercial replication and distribution of the article with the strict proviso that no changes or edits are made and the original work is properly cited (including links to both the formal publication through the relevant DOI and the license). See: https://creativecommons.org/licenses/by-nc-nd/4.0/.


References

  1. Rumgay H, Arnold M, Ferlay J, et al. Global burden of primary liver cancer in 2020 and predictions to 2040. J Hepatol 2022;77:1598-606. [Crossref] [PubMed]
  2. Ganesan P, Kulik LM. Hepatocellular Carcinoma: New Developments. Clin Liver Dis 2023;27:85-102. [Crossref] [PubMed]
  3. Halámková J, Bohovicová L, Pehalová L, et al. Use of Hypolipidemic Drugs and the Risk of Second Primary Malignancy in Colorectal Cancer Patients. Cancers (Basel) 2022;14:1699. [Crossref] [PubMed]
  4. Xiong S, Liang H, Liang P, et al. Predilection site and risk factor of second primary cancer: A pan-cancer analysis based on the SEER database. Chin Med J (Engl) 2023;136:1500-2. [Crossref] [PubMed]
  5. Cao R, Jiang H, Liang G, et al. SEER-based risk stratification system for patients with primary non-cirrhotic liver cancer. J Cancer Res Clin Oncol 2023;149:12033-45. [Crossref] [PubMed]
  6. Liu H, Heng X, Tian Y, et al. Effect of prior thyroid cancer on survival of primary liver cancer: a study based on the SEER database. Sci Rep 2022;12:13887. [Crossref] [PubMed]
  7. Jaeger BC, Welden S, Lenoir K, et al. Accelerated and Interpretable Oblique Random Survival Forests. J Comput Graph Stat 2024;33:192-207. [Crossref] [PubMed]
  8. Katzman JL, Shaham U, Cloninger A, et al. DeepSurv: personalized treatment recommender system using a Cox proportional hazards deep neural network. BMC Med Res Methodol 2018;18:24. [Crossref] [PubMed]
  9. Greener JG, Kandathil SM, Moffat L, et al. A guide to machine learning for biologists. Nat Rev Mol Cell Biol 2022;23:40-55. [Crossref] [PubMed]
  10. Lundberg SM, Nair B, Vavilala MS, et al. Explainable machine-learning predictions for the prevention of hypoxaemia during surgery. Nat Biomed Eng 2018;2:749-60. [Crossref] [PubMed]
  11. Lundberg SM, Erion G, Chen H, et al. From Local Explanations to Global Understanding with Explainable AI for Trees. Nat Mach Intell 2020;2:56-67. [Crossref] [PubMed]
  12. Wang H, Chen G, Sun D, et al. The threshold effect of triglyceride glucose index on diabetic kidney disease risk in patients with type 2 diabetes: unveiling a non-linear association. Front Endocrinol (Lausanne) 2024;15:1411486. [Crossref] [PubMed]
  13. Sonabend R, Király FJ, Bender A, et al. mlr3proba: an R package for machine learning in survival analysis. Bioinformatics 2021;37:2789-91. [Crossref] [PubMed]
  14. Kleinbaum DG, Klein M. Evaluating the Proportional Hazards Assumption. In: Kleinbaum DG, Klein M, editors. Survival Analysis: A Self-Learning Text. New York, NY: Springer New York; 2012:161-200.
  15. Wynants L, Bouwmeester W, Moons KG, et al. A simulation study of sample size demonstrated the importance of the number of events per variable to develop prediction models in clustered data. J Clin Epidemiol 2015;68:1406-14. [Crossref] [PubMed]
  16. Wang H, Zhou L. Random survival forest with space extensions for censored data. Artif Intell Med 2017;79:52-61. [Crossref] [PubMed]
  17. Dietrich S, Floegel A, Troll M, et al. Random Survival Forest in practice: a method for modelling complex metabolomics data in time to event analysis. Int J Epidemiol 2016;45:1406-20. [Crossref] [PubMed]
  18. Kong SH, Lee JW, Bae BU, et al. Development of a Spine X-Ray-Based Fracture Prediction Model Using a Deep Learning Algorithm. Endocrinol Metab (Seoul) 2022;37:674-83. [Crossref] [PubMed]
  19. Hao D, Li Q, Feng QX, et al. SurvivalCNN: A deep learning-based method for gastric cancer survival prediction using radiological imaging data and clinicopathological variables. Artif Intell Med 2022;134:102424. [Crossref] [PubMed]
  20. Ding Q, Wang K, Li Y, et al. Clinical Characteristics and Survival Analysis of Patients With Second Primary Malignancies After Hepatocellular Carcinoma Liver Transplantation: A SEER-based Analysis. Am J Clin Oncol 2023;46:284-92. [Crossref] [PubMed]
  21. Xie Q, Yang Y, Qu B, et al. Comparison of surgical resection and radiofrequency ablation for stages I and II elderly hepatocellular carcinoma patients (≥ 65 years): A SEER population-based propensity score matching's study. Front Oncol 2022;12:903231. [Crossref] [PubMed]
  22. Shen J, Zhou Y, Yu B, et al. Construction and validation of a nomogram for patients with multiple hepatocellular carcinoma: A SEER-based study. Eur J Surg Oncol 2023;49:106966. [Crossref] [PubMed]
  23. Ge XY, Sun MC, Wang TY, et al. Analysis of risk factors of hepatocellular carcinoma and establishment of a clinical prognosis model. Front Oncol 2023;13:1067353. [Crossref] [PubMed]
  24. He Z, She X, Liu Z, et al. Advances in post-operative prognostic models for hepatocellular carcinoma. J Zhejiang Univ Sci B 2023;24:191-206. [Crossref] [PubMed]
  25. Fu Y, Si A, Wei X, et al. Combining a machine-learning derived 4-lncRNA signature with AFP and TNM stages in predicting early recurrence of hepatocellular carcinoma. BMC Genomics 2023;24:89. [Crossref] [PubMed]
  26. Yan T, Huang C, Lei J, et al. Development and Validation of a nomogram for forecasting survival of alcohol related hepatocellular carcinoma patients. Front Oncol 2022;12:976445. [Crossref] [PubMed]
  27. Zhang Y, Zhang JG, Yu W, et al. Prognostic impact of tumor size on isolated hepatocellular carcinoma without vascular invasion may have age variance. Front Surg 2022;9:988484. [Crossref] [PubMed]
  28. Xie J, Zheng C, Xie J, et al. No significant relationship exists between tumor size and prognosis in distant metastatic hepatocellular carcinoma: a propensity score matching analysis based on SEER database. BMC Gastroenterol 2022;22:274. [Crossref] [PubMed]
  29. Shao G, Zhi Y, Fan Z, et al. Development and validation of a diagnostic and prognostic model for lung metastasis of hepatocellular carcinoma: a study based on the SEER database. Front Med (Lausanne) 2023;10:1171023. [Crossref] [PubMed]
  30. Huang G, Lin Q, Yin P, et al. Development and validation of web-based prognostic nomograms for massive hepatocellular carcinoma (≥10 cm): A retrospective study based on the SEER database. Cancer Med 2023;12:13167-81. [Crossref] [PubMed]
  31. Yang D, Su Y, Zhao F, et al. Low-grade hepatocellular carcinoma characteristics, a practical nomogram and risk stratification system: a SEER population-based study. Expert Rev Gastroenterol Hepatol 2022;16:1115-23. [Crossref] [PubMed]
  32. Wang Q, Qiao W, Zhang H, et al. Nomogram established on account of Lasso-Cox regression for predicting recurrence in patients with early-stage hepatocellular carcinoma. Front Immunol 2022;13:1019638. [Crossref] [PubMed]
Cite this article as: Nie Y, Nie L, Li B, Wang Y, Wang L, Lv X, Sun R, Xia M, Wang R, Cui X. Machine learning models for predicting survival in patients of hepatocellular carcinoma with second primary malignancy. Transl Cancer Res 2025;14(10):6709-6722. doi: 10.21037/tcr-2025-589

Download Citation