Etiology-Specific Nomograms for Predicting First Variceal Bleeding in Decompensated HBV- and HCV-Related Cirrhosis Authors: Meixia Du, Tao Li, Huai Li, Xiaochun Zhang, Binqing Xiao, Mengni Zhen, Yongzhong Li, Yi Ouyang Published: 2026 ABSTRACT ObjectivePatients with decompensated hepatitis B virus (HBV)- and hepatitis C virus (HCV)-related cirrhosis are at high risk of first variceal bleeding, yet etiology-specific and stage-specific prediction models remain limited. This study aimed to develop and internally validate nomogram models for predicting the risk of first variceal bleeding in this population.MethodsThis retrospective cohort study included 451 patients with decompensated HBV- or HCV-related cirrhosis (331 HBV-related and 120 HCV-related), of whom 230 experienced first variceal bleeding. Random Forest and XGBoost algorithms were used for feature selection, followed by multivariable logistic regression to develop etiology-specific nomogram models. Internal validation was performed using a training-testing split. Model discrimination, calibration, and clinical utility were assessed using the area under the receiver operating characteristic curve (AUC), bootstrap resampling, and decision curve analysis, respectively. Partial Dependence Plots (PDPs) midpoint risk (≈0.5) set clinical thresholds.ResultsSeven predictors were retained for HBV (Hemoglobin, Ascites Depth, Total Protein, Prothrombin Activity [PTA], Total Bile Acid [TBA], D-dimer, and White Blood Cell Count [WBC]) and three for HCV (Hemoglobin, PTA, and TBA), with an AUC of 0.9239 (95% CI 0.8941–0.9537) and 0.9127 (95% CI 0.8646–0.9609), respectively. The models showed good calibration and clinical utility on decision curve analysis. PDPs indicated 0.5-risk thresholds at 96.12 g/L (Hemoglobin), 60.75 g/L (Total Protein), 30.58 mm (Ascites Depth), 49.2% (PTA), 25.78 µmol/L (TBA), 2.24 mg/L (D-dimer), and 5.33×109/L (WBC) for HBV, and 46.81% (PTA), 82.4 g/L (Hemoglobin), 47.51 µmol/L (TBA) for HCV.ConclusionEtiology-specific nomogram models were developed to predict first variceal bleeding in patients with decompensated HBV- and HCV-related cirrhosis. The models showed good discriminative performance in internal validation and may assist in risk stratification. However, further prospective multicenter studies with external validation are needed before clinical implementation. Introduction Hepatitis B virus (HBV) and hepatitis C virus (HCV) infections remain major global health burdens. According to the World Health Organization, approximately 254 million people were living with chronic HBV infection and 50 million with chronic HCV infection in 2022.1 These viral infections are among the leading causes of liver cirrhosis, which can progress to decompensating events, most notably gastroesophageal variceal bleeding.2 Gastroesophageal varices is common in patients with cirrhosis, with an overall prevalence of approximately 50%.3 The prevalence ranges from 30–40% in compensated cirrhosis but increases markedly in decompensated cirrhosis, reaching up to 85% of patients; variceal hemorrhage occurs at a rate around 10–15% per year.3 Current international guidelines, including the Baveno VII consensus,4 AASLD Practice Guidance,5 and EASL guidelines,6 strongly recommend risk stratification and primary prophylaxis to prevent first variceal bleeding in patients with cirrhosis. However, the majority of existing prediction models for variceal bleeding in cirrhosis have been derived from heterogeneous populations combining compensated and decompensated disease, without differentiating between HBV- and HCV-related cirrhosis.7 Few studies have focused on decompensated cirrhosis despite its high risk of first variceal bleeding. Existing tools therefore lack the capacity for accurate etiology-specific (HBV vs HCV) and stage-specific risk stratification, highlighting the need for models specifically designed for this population. Machine learning techniques, such as Random Forest (RF) and XGBoost, have demonstrated strong capability in identifying key predictors,8 while Logistic Regression provides interpretable results suitable for clinical application.9 Furthermore, RF-based partial dependence plots (PDPs) and nomograms can enhance model transparency and clinical utility by visualizing non-linear relationships and individualized risk profiles.10 Therefore, this study aimed to develop etiology-specific and stage-specific nomogram models to predict the first episode of gastroesophageal variceal bleeding in patients with decompensated HBV- and HCV-related cirrhosis. Using Random Forest and XGBoost for feature selection followed by multivariable logistic regression, we aimed to construct clinically useful tools for risk stratification. We hypothesized that focusing on decompensated patients and distinguishing between viral etiologies could help overcome some limitations of previous mixed-cohort models. Materials and Methods Ethical Statement and Study Population This was a retrospective cohort study conducted at Hunan University of Medicine General Hospital between July 2019 and May 2025. This study was approved by the Institutional Ethics Committee of Hunan University of Medicine General Hospital [KY-2025030401] and was in accord with the Helsinki declaration. Consecutive patients with decompensated HBV- or HCV-related cirrhosis who were admitted during the study period were screened for eligibility. Inclusion Criteria: Patients with HBV-related decompensated liver cirrhosis were included if they were HBsAg-positive and met the diagnostic criteria for liver cirrhosis,11 confirmed by clinical findings, laboratory tests, imaging (eg, ultrasonography, CT, or MRI showing nodular liver surface), or liver biopsy (if performed) confirmed cirrhosis (eg, METAVIR F4 or equivalent pathological findings), followed by evidence of decompensation as defined by the presence of at least one of the following: ascites, gastroesophageal variceal bleeding, hepatic encephalopathy, or jaundice, in accordance with the EASL guidelines.12 Gastroesophageal variceal bleeding was identified by clinical symptoms including hematemesis, melena, or hematochezia, and confirmed by endoscopic evidence of esophageal or gastric varices with active bleeding or signs of recent hemorrhage. Similarly, patients with HCV-related decompensated liver cirrhosis were included if they tested positive for HCV (anti-HCV antibody and/or HCV RNA)13 and fulfilled the same criteria for decompensated liver cirrhosis and gastroesophageal variceal bleeding. Exclusion Criteria: Patients were excluded if they met any of the following conditions: (1) co-infection with other viral hepatitis (eg, hepatitis A or D); (2) a history of hepatocellular carcinoma (HCC) or other malignancies; (3) severe comorbidities affecting liver function, such as septicemia, uremia, or autoimmune hepatitis; (4) incomplete medical records; (5) prior liver transplantation; (6) portal hypertension due to other causes, including Budd-Chiari syndrome or parasitic infections; (7) gastrointestinal bleeding caused by other conditions, such as gastric ulcers; (8) any previous episode of variceal bleeding or gastrointestinal bleeding; Or (9) decompensated liver cirrhosis with co-infection of HBV and HCV. Eligible patients were divided into two groups: (1) Bleeding group: Patients who experienced their first episode of esophagogastric variceal bleeding confirmed by endoscopy. (2) Non-bleeding group (Control group): Consecutive patients with decompensated HBV- or HCV-related cirrhosis who had no history of variceal bleeding and no clinical evidence of active gastrointestinal bleeding during hospitalization. We initially identified 487 consecutive patients with decompensated cirrhosis. After applying the inclusion and exclusion criteria, a total of 451 patients were finally enrolled in this retrospective cohort study. The HBV cohort comprised 331 patients with HBV-related decompensated cirrhosis (167 without bleeding [Group 1], 164 with bleeding [Group 2]), aged 31 to 83 years. The HCV cohort included 120 patients with HCV-related decompensated cirrhosis (54 without bleeding [Group 1], 66 with bleeding [Group 2]), aged 36 to 80 years. All laboratory and clinical measurements were obtained from the first test results within 24 hours of patient admission. Both datasets collected the following features: Age, alanine aminotransferase (ALT), aspartate aminotransferase (AST), alkaline phosphatase (ALP), gamma-glutamyl transferase (GGT), Total Protein (TP), Albumin, Globulin, Total Bilirubin (TB), Direct Bilirubin (DB), Total Bile Acid (TBA), White Blood Cell Count (WBC), Hemoglobin (HGB), Platelet Count (PLT), C-Reactive Protein (CRP), Prothrombin Time (PT), Prothrombin Activity (PTA), International Normalized Ratio (INR), D-dimer, Viral Load, Spleen Size, Portal Vein Diameter (PVD), and Ascites Depth, along with the categorical features, Gender (1=male, 2=female), Complications (1 = ascites, 2 = hepatic encephalopathy [HE], 3 = both ascites and HE, 0 = no ascites or HE). Data Preprocessing and Univariate Analysis The study workflow, encompassing patient selection, data processing, feature selection, and model development, was illustrated in Figure 1. Figure 1Flowchart of the Research Process.The study examines HBV/HCV patients with decompensated cirrhosis, split into Group 1 (no bleeding) and Group 2 (bleeding). HBV patients total 331, with 167 in Group 1 and 164 in Group 2. HCV patients total 120, with 54 in Group 1 and 66 in Group 2. Data includes demographics, liver function tests, blood counts and complications. Step 1 identifies differing factors between groups. For HBV, key factors are gender, age, AST, ALP, TP, globulin, TB, DB, TBA, WBC, HGB, PT, PTA, INR, D-dimer, complications, viral load, spleen size and ascites depth. For HCV, they are TP, HGB, PTA, TBA, PT, viral load, ALP, GGT and complications. Step 2 develops models using RF/XGBoost and logistic regression, excluding P > 0.05. Important features for HBV are HGB, ascites depth, TP, PTA, TBA, D-dimer and WBC; for HCV, they are HGB, PTA and TBA. The study concludes with model evaluation, calibration, nomograms, partial dependence analysis, breakpoint identification and decision curve analysis.Study flowchart: HBV/HCV patients with decompensated cirrhosis, group classification (bleeding vs non-bleeding), data collection, feature selection, and predictive model development.Notes: Complications included ascites and/or hepatic encephalopathy (HE). Schematic illustration of gastroesophageal varices in patients with and without bleeding were created with the assistance of an AI image generation tool.Abbreviations: VIF, variance inflation factor; ALT, Alanine Aminotransferase; AST, Aspartate Aminotransferase; ALP, Alkaline Phosphatase; GGT, Gamma-Glutamyl Transferase; TP, Total Protein; TB, Total Bilirubin; DB, Direct Bilirubin; TBA, Total Bile Acid; WBC, White Blood Cell Count; HGB, Hemoglobin; PLT, Platelet Count; CRP, C-Reactive Protein; PT, Prothrombin Time; PTA, Prothrombin Activity; INR, International Normalized Ratio; PVD, Portal Vein Diameter. Flowchart of the Research Process. Univariate analysis was performed to identify factors significantly associated with bleeding risk in patients with decompensated liver cirrhosis, with significance defined at P < 0.05. For the HBV cohort (n=331), significant variables were directly utilized for modeling. The HBV data were divided at an 80:20 ratio into a training set (n=265) and a test set (n=66), stratified by Group to ensure balanced representation of bleeding status. For the HCV cohort (n=120), due to its smaller sample size, collinearity diagnostics were conducted, excluding variables with a variance inflation factor (VIF) > 5 to address multicollinearity. The HCV data were similarly split at an 80:20 ratio into a training set (n=96) and a test set (n=24), stratified by Group. Two binary variables were derived to capture clinically relevant states: Spleen Removed (1 if Spleen Size = 0, indicating spleen removal; 0 otherwise) and Viral Load IsZero (1 if Viral Load = 0, indicating undetectable viral load; 0 otherwise). These were included alongside their original numerical counterparts (Spleen Size and Viral Load) to enable models to capture both continuous and binary effects. Model Training and Feature Selection Categorical variables were transformed into dummy variables using the caret package (version 7.0.1) in R, dropping one level to avoid multicollinearity. RF and XGBoost models were trained using the randomForest (version 4.7.1.2) and xgboost (version 1.7.10.1) packages, respectively, via caret for RF. Both models employed 10-fold cross-validation to tune hyperparameters. For RF, the number of predictors sampled at each split (mtry) ranged from 2 to the square root of the total features (approximately 4 for HBV, 3 for HCV), with 2000 trees (ntree = 2000). For XGBoost, the optimal number of boosting rounds (nrounds, up to 300) was determined with early stopping after 20 rounds if validation area under the curve (AUC) did not improve. HBV cohort parameters included: learning rate (eta) = 0.1, maximum depth (max_depth) = 6, and no L1/L2 regularization (lambda = 1, alpha = 0). For HCV, to prevent overfitting, max_depth = 4, lambda = 2, and alpha = 1 were used, with other parameters unchanged. Models used binary Logistic Regression as the objective, with AUC as the evaluation metric. A watchlist monitored training and test set performance during final XGBoost training to ensure robustness against overfitting. Feature importance was assessed using MeanDecreaseGini for RF and Gain for XGBoost. Model performance was compared using AUC on the test sets, calculated with the pROC package (version 1.18.5). To ensure internal validity and mitigate overfitting, 10-fold cross-validation was employed throughout model training, hyperparameter tuning, and performance evaluation, with the full dataset serving as both training and internal validation source. No external validation cohort was available in this single-center retrospective study. Data for XGBoost were preprocessed into xgb.DMatrix format, with the outcome variable (Group) encoded as binary (0 for Group 1, non-bleeding; 1 for Group 2, bleeding). Calibration and Nomogram For the HBV cohort, a multivariable Logistic Regression model was built using the rms package (version 8.0.0) with 10 features: HGB, Globulin, Ascites Depth, TP, ALP, D-dimer, PTA, TBA, WBC, and Spleen Size. Non-significant variables (P > 0.05) were removed, retaining seven significant predictors (HGB, Ascites Depth, TP, PTA, TBA, WBC, D-dimer) for a refined model. The initial and refined models were compared based on AUC using the pROC package and accuracy, sensitivity, and specificity derived from confusion matrices at a 0.5 threshold using the caret package, to select the most appropriate model for nomogram development based on comprehensive evaluation. A nomogram was developed based on the refined model to predict bleeding risk, with probabilities transformed via the plogis function and an x-axis fraction of 0.4 for readability. Calibration of the refined model was assessed using 1000 bootstrap resamples with the rms::calibrate function. For the HCV cohort, a Logistic Regression model was built using the top 5 intersecting RF and XGBoost features (PTA, HGB, ALP, TP, TBA), retaining three significant predictors (HGB, PTA, TBA) after non-significant variables being excluded. A nomogram and calibration curves were generated following the same procedure as HBV, with performance and calibration assessed identically. Non-Linear Effects and Clinical Thresholds PDPs were used to explore the non-linear effects of the seven significant predictors (HGB, Ascites Depth, TP, PTA, TBA, WBC, D-dimer) for the HBV cohort and three significant predictors (HGB, PTA, TBA) for the HCV cohort on bleeding risk, using the RF model. RF was selected for its robust interpretability, as its feature importance and effect estimates, derived from averaging multiple decision trees, provide more stable and interpretable patterns compared to XGBoost’s gradient boosting approach. Thresholds were identified at points where the predicted probability reached 0.5, validating the consistency of these predictors with the nomograms developed from the refined Logistic Regression models for both cohorts. RF thresholds (probability ≈ 0.5) were annotated as potential clinical thresholds to guide risk assessment. Decision Curve Analysis Decision curve analysis (DCA) was performed using the rmda package (version 1.6) to evaluate the clinical utility of the RF, XGBoost, and refined Logistic Regression models in predicting gastroesophageal variceal bleeding risk for the HBV and HCV cohorts. Net benefit curves were generated across a threshold probability range of 0.01 to 0.99, with 95% confidence intervals (CI) calculated using nonparametric bootstrapping (default in rmda) to assess model uncertainty. The net benefits of each model were compared against default strategies of treating all patients or none. Statistical Analysis Preliminary statistical analysis for single-variable screening was performed using SPSS (version 22.0), with model building and subsequent analyses conducted in R (version 4.4.1). Sample size was determined by the availability of consecutive eligible patients during the study period. The events-per-variable ratios were 23.4:1 in the HBV model (7 predictors) and 22:1 in the HCV model (3 predictors), both exceeding the recommended threshold of 10:1. Missing values in continuous variables were imputed using group-specific medians (stratified by bleeding status), while missing values in categorical variables were assigned to an “Unknown” category. Normality of continuous variables was assessed using the Shapiro–Wilk test. Normally distributed variables were presented as means ± standard deviations and compared using independent t-tests, while non-normally distributed variables were presented as medians with interquartile ranges and compared using the Mann–Whitney U-test. Categorical variables were presented as frequencies with percentages and compared using the chi-square test or Fisher’s exact test. VIF analysis for collinearity diagnostics in the HCV cohort was performed using the car package (version 3.1.3). Significance was defined as a two-tailed P-value < 0.05 for all analyses. Data manipulation was supported by dplyr (version 1.1.4). Visualizations, including feature importance plots, ROC curves, nomograms, calibration curves, bar plots, and PDPs, were generated using randomForest, pROC, rms, ggplot2 (version 3.5.2), and pdp packages (version 0.8.2). Results Univariate Analysis Univariate analysis identified significant differences between Group 1 (non-bleeding) and Group 2 (bleeding) in both HBV and HCV cohorts. For the HBV cohort, the final feature set, after univariate screening (P < 0.05), included Gender, Age, AST, ALP, TP, Globulin, TB, DB, TBA, WBC, HGB, PT, PTA, INR, D-dimer, Complications, Viral Load, Spleen Size, and Ascites Depth. Univariate analysis results for all included factors were detailed in Table 1 for HBV.Table 1Univariate Analysis Results for HBV PatientsVariableGroup 1(DLC, Non-Bleeding)Group 2(DLC, Bleeding)P-valueAge (year)59.25 ± 10.0558.88 ± 10.760.009ALT (U/L)27.50 (23.00)24.00 (15.00)0.075AST (U/L)43.00 (36.00)29.50 (28.00)<0.001ALP (U/L)120.50 (82.00)87.50 (66.00)<0.001GGT (U/L)34.00 (81.00)38.00 (55.00)0.921TP (g/L)66.61 ± 7.6158.88 ± 8.65<0.001Albumin (g/L)30.64 ± 6.4730.80 ± 4.770.361Globulin (g/L)35.98 ± 7.6728.08 ± 6.41<0.001TB (µmol/L)27.95 (25.60)24.90 (22.40)0.011DB (µmol/L)13.60 (14.10)11.55 (11.50)0.039TBA (µmol/L)34.45 (74.88)16.25 (19.28)<0.001WBC (109/L)4.05 (2.70)4.95 (3.50)<0.001HGB (g/L)106.00 (27.00)78.00 (29.00)<0.001PLT (109/L)56.00 (46.25)59.50 (41.25)0.257CRP (mg/L)5.84 (14.01)2.81 (6.22)0.079PT (s)15.95 (2.70)16.70 (4.30)0.001PTA (%)59.65 (26.70)38.50 (7.70)<0.001INR1.31 (0.24)1.35 (0.37)0.006D-dimer (mg/L)2.50 (5.00)1.08 (3.00)0.002Viral Load (IU/mL)10.00 (8560.00)0.00 (10.00)<0.001Spleen Size (mm)138.50 (46.00)149.00 (53.00)0.011PVD (mm)14.00 (3.00)14.00 (1.00)0.246Ascites Depth (mm)35.00 (65.00)19.00 (38.00)0.002Gender1: 111 (66.5%)2: 56 (33.5%)1: 142 (86.6%)2: 22 (13.4%)<0.001Complications0: 25 (15.0%)1: 138 (82.6%)2: 1 (0.6%)3: 3 (1.8%)0: 60 (36.6%)1: 89 (54.3%)2: 11 (6.7%)3: 4 (2.4%)<0.001Notes: Data are presented as Mean ± SD for normally distributed variables, Median (IQR) for non-normally distributed variables, and Frequency (%) for categorical variables. P-values were calculated using t-test (normal variables), Mann–Whitney U-test (non-normal variables), or Chi-square test (categorical variables). Group 1: Decompensated Liver Cirrhosis (DLC), may or may not have varices, no bleeding; Group 2: DLC with ruptured and bleeding varices. Complications: 1 = ascites, 2 = hepatic encephalopathy (HE), 0 = no ascites or HE, 3 = both ascites and HE. Gender: 1 = male, 2 = female.Abbreviations: ALT, Alanine Aminotransferase; AST, Aspartate Aminotransferase; ALP, Alkaline Phosphatase; GGT, Gamma-Glutamyl Transferase; TP, Total Protein; TB, Total Bilirubin; DB, Direct Bilirubin; TBA, Total Bile Acid; WBC, White Blood Cell Count; HGB, Hemoglobin; PLT, Platelet Count; CRP, C-Reactive Protein; PT, Prothrombin Time; PTA, Prothrombin Activity; INR, International Normalized Ratio; PVD, Portal Vein Diameter. Table 1Univariate Analysis Results for HBV PatientsVariableGroup 1(DLC, Non-Bleeding)Group 2(DLC, Bleeding)P-valueAge (year)59.25 ± 10.0558.88 ± 10.760.009ALT (U/L)27.50 (23.00)24.00 (15.00)0.075AST (U/L)43.00 (36.00)29.50 (28.00)<0.001ALP (U/L)120.50 (82.00)87.50 (66.00)<0.001GGT (U/L)34.00 (81.00)38.00 (55.00)0.921TP (g/L)66.61 ± 7.6158.88 ± 8.65<0.001Albumin (g/L)30.64 ± 6.4730.80 ± 4.770.361Globulin (g/L)35.98 ± 7.6728.08 ± 6.41<0.001TB (µmol/L)27.95 (25.60)24.90 (22.40)0.011DB (µmol/L)13.60 (14.10)11.55 (11.50)0.039TBA (µmol/L)34.45 (74.88)16.25 (19.28)<0.001WBC (109/L)4.05 (2.70)4.95 (3.50)<0.001HGB (g/L)106.00 (27.00)78.00 (29.00)<0.001PLT (109/L)56.00 (46.25)59.50 (41.25)0.257CRP (mg/L)5.84 (14.01)2.81 (6.22)0.079PT (s)15.95 (2.70)16.70 (4.30)0.001PTA (%)59.65 (26.70)38.50 (7.70)<0.001INR1.31 (0.24)1.35 (0.37)0.006D-dimer (mg/L)2.50 (5.00)1.08 (3.00)0.002Viral Load (IU/mL)10.00 (8560.00)0.00 (10.00)<0.001Spleen Size (mm)138.50 (46.00)149.00 (53.00)0.011PVD (mm)14.00 (3.00)14.00 (1.00)0.246Ascites Depth (mm)35.00 (65.00)19.00 (38.00)0.002Gender1: 111 (66.5%)2: 56 (33.5%)1: 142 (86.6%)2: 22 (13.4%)<0.001Complications0: 25 (15.0%)1: 138 (82.6%)2: 1 (0.6%)3: 3 (1.8%)0: 60 (36.6%)1: 89 (54.3%)2: 11 (6.7%)3: 4 (2.4%)<0.001Notes: Data are presented as Mean ± SD for normally distributed variables, Median (IQR) for non-normally distributed variables, and Frequency (%) for categorical variables. P-values were calculated using t-test (normal variables), Mann–Whitney U-test (non-normal variables), or Chi-square test (categorical variables). Group 1: Decompensated Liver Cirrhosis (DLC), may or may not have varices, no bleeding; Group 2: DLC with ruptured and bleeding varices. Complications: 1 = ascites, 2 = hepatic encephalopathy (HE), 0 = no ascites or HE, 3 = both ascites and HE. Gender: 1 = male, 2 = female.Abbreviations: ALT, Alanine Aminotransferase; AST, Aspartate Aminotransferase; ALP, Alkaline Phosphatase; GGT, Gamma-Glutamyl Transferase; TP, Total Protein; TB, Total Bilirubin; DB, Direct Bilirubin; TBA, Total Bile Acid; WBC, White Blood Cell Count; HGB, Hemoglobin; PLT, Platelet Count; CRP, C-Reactive Protein; PT, Prothrombin Time; PTA, Prothrombin Activity; INR, International Normalized Ratio; PVD, Portal Vein Diameter. Univariate Analysis Results for HBV Patients Notes: Data are presented as Mean ± SD for normally distributed variables, Median (IQR) for non-normally distributed variables, and Frequency (%) for categorical variables. P-values were calculated using t-test (normal variables), Mann–Whitney U-test (non-normal variables), or Chi-square test (categorical variables). Group 1: Decompensated Liver Cirrhosis (DLC), may or may not have varices, no bleeding; Group 2: DLC with ruptured and bleeding varices. Complications: 1 = ascites, 2 = hepatic encephalopathy (HE), 0 = no ascites or HE, 3 = both ascites and HE. Gender: 1 = male, 2 = female. Abbreviations: ALT, Alanine Aminotransferase; AST, Aspartate Aminotransferase; ALP, Alkaline Phosphatase; GGT, Gamma-Glutamyl Transferase; TP, Total Protein; TB, Total Bilirubin; DB, Direct Bilirubin; TBA, Total Bile Acid; WBC, White Blood Cell Count; HGB, Hemoglobin; PLT, Platelet Count; CRP, C-Reactive Protein; PT, Prothrombin Time; PTA, Prothrombin Activity; INR, International Normalized Ratio; PVD, Portal Vein Diameter. For the HCV cohort, the final feature set, after excluding variables with VIF > 5, comprised TP, HGB, PTA, TBA, PT, Viral Load, ALP, GGT, and Complications. Univariate analysis results for all included factors are detailed in Table 2 for HCV.Table 2Univariate Analysis Results for HCV PatientsVariableGroup 1(DLC, Non-Bleeding)Group 2(DLC, Bleeding)P-valueAge (year)60.57 ± 10.0356.87 ± 6.560.138ALT (U/L)32.00 (26.00)19.00 (17.00)0.020AST (U/L)48.00 (44.00)32.00 (29.00)0.023ALP (U/L)116.00 (71.00)70.00 (70.00)0.001GGT (U/L)37.00 (37.00)25.00 (69.00)0.036TP (g/L)67.11 ± 8.9361.49 ± 10.74<0.001Albumin (g/L)31.40 (5.50)29.40 (8.40)1.000Globulin (g/L)36.08 ± 7.5330.25 ± 9.07<0.001TB (µmol/L)24.60 (23.10)22.90 (22.20)0.679DB (µmol/L)10.20 (12.80)10.90 (18.80)0.868TBA (µmol/L)29.30 (46.55)9.60 (17.50)<0.001WBC (109/L)4.66 ± 2.335.31 ± 2.940.073HGB (g/L)101.23 ± 28.6669.48 ± 26.52<0.001PLT (109/L)82.40 ± 51.3672.48 ± 32.070.133CRP (mg/L)4.71 (9.76)5.20 (14.40)0.135PT (s)15.60 (3.70)16.50 (6.50)0.002PTA (%)66.60 ± 17.4039.35 ± 8.41<0.001INR1.26 (0.35)1.32 (0.60)0.006D-dimer (mg/L)2.00 (4.00)1.16 (4.00)0.384Viral Load (IU/mL)0.00 (5852.00)0.00 (0.00)0.006Spleen Size (mm)145.51 ± 34.25165.96 ± 29.200.074PVD (mm)13.47 ± 2.7514.35 ± 2.480.135Ascites Depth (mm)30.00 (69.00)20.00 (49.00)0.083Gender1: 26 (48.1%)2: 28 (51.9%)1: 34 (51.5%)2: 32 (48.5%)0.714Complications0: 0 (0.0%)1: 53 (98.1%)2: 0 (0.0%)3: 1 (1.9%)0: 23 (34.8%)1: 38 (57.6%)2: 1 (1.5%)3: 4 (6.1%)<0.001Note: Data are presented as Mean ± SD for normally distributed variables, Median (IQR) for non-normally distributed variables, and Frequency (%) for categorical variables. P-values were calculated using t-test (normal variables), Mann–Whitney U-test (non-normal variables), or Chi-square test (categorical variables). Group 1: Decompensated Liver Cirrhosis (DLC), may or may not have varices, no bleeding; Group 2: DLC with ruptured and bleeding varices. Complications: 1 = ascites, 2 = hepatic encephalopathy (HE), 0 = no ascites or HE, 3 = both ascites and HE. Gender: 1 = male, 2 = female.Abbreviations: ALT, Alanine Aminotransferase; AST, Aspartate Aminotransferase; ALP, Alkaline Phosphatase; GGT, Gamma-Glutamyl Transferase; TP, Total Protein; TB, Total Bilirubin; DB, Direct Bilirubin; TBA, Total Bile Acid; WBC, White Blood Cell Count; HGB, Hemoglobin; PLT, Platelet Count; CRP, C-Reactive Protein; PT, Prothrombin Time; PTA, Prothrombin Activity; INR, International Normalized Ratio; PVD, Portal Vein Diameter. Table 2Univariate Analysis Results for HCV PatientsVariableGroup 1(DLC, Non-Bleeding)Group 2(DLC, Bleeding)P-valueAge (year)60.57 ± 10.0356.87 ± 6.560.138ALT (U/L)32.00 (26.00)19.00 (17.00)0.020AST (U/L)48.00 (44.00)32.00 (29.00)0.023ALP (U/L)116.00 (71.00)70.00 (70.00)0.001GGT (U/L)37.00 (37.00)25.00 (69.00)0.036TP (g/L)67.11 ± 8.9361.49 ± 10.74<0.001Albumin (g/L)31.40 (5.50)29.40 (8.40)1.000Globulin (g/L)36.08 ± 7.5330.25 ± 9.07<0.001TB (µmol/L)24.60 (23.10)22.90 (22.20)0.679DB (µmol/L)10.20 (12.80)10.90 (18.80)0.868TBA (µmol/L)29.30 (46.55)9.60 (17.50)<0.001WBC (109/L)4.66 ± 2.335.31 ± 2.940.073HGB (g/L)101.23 ± 28.6669.48 ± 26.52<0.001PLT (109/L)82.40 ± 51.3672.48 ± 32.070.133CRP (mg/L)4.71 (9.76)5.20 (14.40)0.135PT (s)15.60 (3.70)16.50 (6.50)0.002PTA (%)66.60 ± 17.4039.35 ± 8.41<0.001INR1.26 (0.35)1.32 (0.60)0.006D-dimer (mg/L)2.00 (4.00)1.16 (4.00)0.384Viral Load (IU/mL)0.00 (5852.00)0.00 (0.00)0.006Spleen Size (mm)145.51 ± 34.25165.96 ± 29.200.074PVD (mm)13.47 ± 2.7514.35 ± 2.480.135Ascites Depth (mm)30.00 (69.00)20.00 (49.00)0.083Gender1: 26 (48.1%)2: 28 (51.9%)1: 34 (51.5%)2: 32 (48.5%)0.714Complications0: 0 (0.0%)1: 53 (98.1%)2: 0 (0.0%)3: 1 (1.9%)0: 23 (34.8%)1: 38 (57.6%)2: 1 (1.5%)3: 4 (6.1%)<0.001Note: Data are presented as Mean ± SD for normally distributed variables, Median (IQR) for non-normally distributed variables, and Frequency (%) for categorical variables. P-values were calculated using t-test (normal variables), Mann–Whitney U-test (non-normal variables), or Chi-square test (categorical variables). Group 1: Decompensated Liver Cirrhosis (DLC), may or may not have varices, no bleeding; Group 2: DLC with ruptured and bleeding varices. Complications: 1 = ascites, 2 = hepatic encephalopathy (HE), 0 = no ascites or HE, 3 = both ascites and HE. Gender: 1 = male, 2 = female.Abbreviations: ALT, Alanine Aminotransferase; AST, Aspartate Aminotransferase; ALP, Alkaline Phosphatase; GGT, Gamma-Glutamyl Transferase; TP, Total Protein; TB, Total Bilirubin; DB, Direct Bilirubin; TBA, Total Bile Acid; WBC, White Blood Cell Count; HGB, Hemoglobin; PLT, Platelet Count; CRP, C-Reactive Protein; PT, Prothrombin Time; PTA, Prothrombin Activity; INR, International Normalized Ratio; PVD, Portal Vein Diameter. Univariate Analysis Results for HCV Patients Note: Data are presented as Mean ± SD for normally distributed variables, Median (IQR) for non-normally distributed variables, and Frequency (%) for categorical variables. P-values were calculated using t-test (normal variables), Mann–Whitney U-test (non-normal variables), or Chi-square test (categorical variables). Group 1: Decompensated Liver Cirrhosis (DLC), may or may not have varices, no bleeding; Group 2: DLC with ruptured and bleeding varices. Complications: 1 = ascites, 2 = hepatic encephalopathy (HE), 0 = no ascites or HE, 3 = both ascites and HE. Gender: 1 = male, 2 = female. Abbreviations: ALT, Alanine Aminotransferase; AST, Aspartate Aminotransferase; ALP, Alkaline Phosphatase; GGT, Gamma-Glutamyl Transferase; TP, Total Protein; TB, Total Bilirubin; DB, Direct Bilirubin; TBA, Total Bile Acid; WBC, White Blood Cell Count; HGB, Hemoglobin; PLT, Platelet Count; CRP, C-Reactive Protein; PT, Prothrombin Time; PTA, Prothrombin Activity; INR, International Normalized Ratio; PVD, Portal Vein Diameter. Feature Selection and Model Performance RF and XGBoost models were employed to mutually validate the reliability of predictive features for HBV and HCV classification, with their performance assessed via receiver operating characteristic (ROC) curves. For HBV, XGBoost achieved an AUC of 0.9271, slightly outperforming RF’s AUC of 0.9266 (Figure 2a). For HCV, RF and XGBoost yielded AUCs of 0.9846 and 0.9769, respectively (Figure 2b). Figure 2ROC Curves and Feature Importance Rankings for RF and XGBoost Models of HBV and HCV cohorts.Images A and B present ROC curves comparing Random Forest and XGBoost models, with Specificity on the x-axis and Sensitivity on the y-axis. In Image A, XGBoost slightly outperforms Random Forest with an AUC of 0.9271 versus 0.9266. In Image B, Random Forest has a higher AUC of 0.9846 compared to XGBoost′s 0.9769. Both models perform well above the diagonal reference line. Images C and D display feature importance rankings. Image C ranks features by MeanDecreaseAccuracy and MeanDecreaseGini, highlighting TP, HGB, Ascites.Depth, Globulin and TBA. Image D ranks features similarly, with PTA, Complications.1, HGB, TP and PT as top features. Images E and F show feature Gain using horizontal bar charts. In Image E, HGB, Globulin and Ascites.Depth have the longest bars, while in Image F, PTA, HGB and TP lead. Images A and B focus on model performance, whereas C to F emphasize feature importance.A multi-panel figure comparing ROC curves and feature importance rankings for Random Forest and XGBoost models of the HBV and HCV cohorts.Notes: (a) ROC Curves for RF (AUC 0.9266) and XGBoost (AUC 0.9271) Models of HBV cohort; (b) ROC Curves for RF (AUC 0.9846) and XGBoost (AUC 0.9769) Models of HCV cohort; (c) Feature Importance Rankings for the RF Model of HBV cohort; (d) Feature Importance Rankings for the RF Model of HCV cohort; (e) Feature Importance Rankings for the XGBoost Model of HBV cohort; (f) Feature Importance Rankings for the XGBoost Model of HCV cohort; Complications: 1 = ascites, 2 = hepatic encephalopathy (HE), 3 = both ascites and HE, 0 = no ascites or HE. Gender: 1 = male, 2 = female. Spleen Removed = Spleen Removal Status (1 = Removed, 0 = Not Removed), Viral Load IsZero = Viral Load Status (1 = Undetectable, 0 = Detectable).Abbreviations: AST, Aspartate Aminotransferase; ALP, Alkaline Phosphatase; GGT, Gamma-Glutamyl Transferase; TP, Total Protein; TB, Total Bilirubin; DB, Direct Bilirubin; TBA, Total Bile Acid; WBC, White Blood Cell Count; HGB, Hemoglobin; PT, Prothrombin Time; PTA, Prothrombin Activity; INR, International Normalized Ratio; ROC; Receiver Operating Characteristic. ROC Curves and Feature Importance Rankings for RF and XGBoost Models of HBV and HCV cohorts. HBV’s RF and XGBoost factor rankings are shown in Figure 2c and e, and HCV’s RF and XGBoost factor rankings are shown in Figure 2d and f. Feature selection identified the top 10 features for HBV (HGB, Globulin, Ascites Depth, TP, ALP, D-dimer, PTA, TBA, WBC, Spleen Size) from the union of RF and XGBoost rankings, sorted by MeanDecreaseGini. For HCV, the top 5 intersecting features were PTA, HGB, ALP, TP, and TBA. Approximately 80% of selected features overlapped between RF and XGBoost in both cohorts, enhancing confidence in the rankings. This high overlap underscores the robustness of the selected features, which were subsequently used to construct the Logistic Regression model. Detailed metrics of RF and XGBoost for HBV and HCV, including accuracy, sensitivity, and specificity, are presented in Figure 3a. Figure 3Performance Metrics of Machine Learning Models for HBV and HCV.Image A heatmap compares HBV and HCV models using Random Forest and XGBoost across metrics: AUC, Accuracy, Sensitivity, Specificity. HBV Random Forest: AUC 0.9266, Accuracy 0.8769, Sensitivity 0.9394, Specificity 0.8125. HBV XGBoost: AUC 0.9271, Accuracy 0.8308, Sensitivity 0.8788, Specificity 0.7812. HCV Random Forest: AUC 0.9846, Accuracy 0.8696, Sensitivity 0.8000, Specificity 0.9231. HCV XGBoost: AUC 0.9769, Accuracy 0.8696, Sensitivity 0.9000, Specificity 0.8462. Legend: 0.8 to 0.95. Image B heatmap evaluates HBV and HCV models with initial and refined features. HBV Initial (10 features): AUC 0.9267, Accuracy 0.8640, Sensitivity 0.8683, Specificity 0.8598. HBV Refined (7 predictors): AUC 0.9239, Accuracy 0.8489, Sensitivity 0.8563, Specificity 0.8415. HCV Initial (5 features): AUC 0.9285, Accuracy 0.8500, Sensitivity 0.7963, Specificity 0.8939. HCV Refined (3 predictors): AUC 0.9127, Accuracy 0.8250, Sensitivity 0.7963, Specificity 0.8485. Legend: 0.8 to 0.92.A multi-panel heatmap figure showing performance metrics (AUC, Accuracy, Sensitivity, Specificity) of Random Forest, XGBoost, and Logistic Regression models for HBV and HCV cohorts.Notes: (a) Performance Metrics of Random Forest and XGBoost models for HBV and HCV; (b) Performance Metrics of Logistic Regression models for HBV and HCV.Abbreviation: AUC, Area Under the Curve. Performance Metrics of Machine Learning Models for HBV and HCV. For HBV, a Logistic Regression model with the top 10 features achieved an AUC of 0.9267. After excluding non-significant variables (P > 0.05), seven predictors (HGB, Ascites Depth, TP, PTA, TBA, D-dimer, WBC) were retained, yielding an AUC of 0.9239 (95% CI: 0.8941–0.9537), with 84.89% accuracy, 85.63% sensitivity, and 84.15% specificity (Figure 3b). For HCV, a Logistic Regression model with the top 5 features achieved an AUC of 0.9285. After excluding non-significant variables, three predictors (HGB, PTA, TBA) were retained, yielding an AUC of 0.9127 (95% CI: 0.8646–0.9609), with 82.50% accuracy, 79.63% sensitivity, and 84.85% specificity (Figure 3b). In the HBV-related decompensated cirrhosis cohort, several variables, including Spleen Size, showed significant associations with first variceal bleeding in univariate analysis (Table 1) but did not remain independent predictors in the multivariable logistic regression model and were therefore excluded from the final nomogram. In contrast, Spleen Size was not significantly different between bleeding and non-bleeding groups even in the univariate analysis among patients with HCV-related decompensated cirrhosis (Table 2). Similar patterns of differential variable significance between the two etiologies were observed for several other candidate predictors. The adjusted odds ratios (ORs) with 95% CIs for each predictor in the final models are presented in Table 3 and Table 4. Each refined model was selected for the simplicity and comparable performance. AUCs of Logistic Regression models for HBV and HCV were depicted in Figure 4, with the final Logistic Regression formulas provided in File S1 (HBV) and File S2 (HCV).Table 3Multivariable Logistic Regression Analysis for Predictors of First Variceal Bleeding in Patients with HBV-Related Decompensated CirrhosisVariableOR (95% CI)P-valueHGB0.961 (0.947–0.974)<0.001Ascites Depth0.973 (0.959–0.986)<0.001TP0.912 (0.871–0.952)<0.001PTA0.949 (0.928–0.969)<0.001TBA0.986 (0.977–0.994)0.001D-dimer0.877 (0.769–0.981)0.037WBC1.312 (1.158–1.504)<0.001Note: Seven variables were retained in the final model after excluding non-significant predictors (P > 0.05).Abbreviations: OR, Odds Ratio; CI, Confidence Interval. Table 4Multivariable Logistic Regression Analysis for Predictors of First Variceal Bleeding in Patients with HCV-Related Decompensated CirrhosisVariableOR (95% CI)P-valuePTA0.909 (0.872–0.94)<0.001HGB0.969 (0.947–0.989)0.004TBA0.984 (0.966–0.997)0.041Note: Variables with P < 0.05 were retained in the final model.Abbreviations: OR, Odds Ratio; CI, Confidence Interval. Figure 4ROC Curves and AUC values of initial and refined Logistic Regression models for HBV and HCV.Image A and B depict receiver operating characteristic graphs. Both have Sensitivity on the y-axis (0.0 to 1.0) and Specificity on the x-axis (1.2 to -0.2). A diagonal reference line runs from (1.0, 0.0) to (0.0, 1.0). Image A′s legend shows: Initial Model (10 Features) AUC = 0.9267; Refined Model (7 Features) AUC = 0.9239. Image B′s legend shows: Initial Model (5 Features) AUC = 0.9285; Refined Model (3 Predictors) AUC = 0.9127. Both images feature step-like curves without labeled numeric coordinates.Two side-by-side ROC plots show step-like curves comparing initial and refined logistic regression models. Image A displays HBV models and image B shows HCV models, each with differently colored curves, a diagonal reference line, and legends listing AUC values.Notes: (a) ROC Curves and AUC values of initial and refined Logistic Regression models for HBV; (b) ROC Curves and AUC values of initial and refined Logistic Regression models for HCV.Abbreviations: AUC, Area Under the Curve; ROC, Receiver Operating Characteristic. Table 3Multivariable Logistic Regression Analysis for Predictors of First Variceal Bleeding in Patients with HBV-Related Decompensated CirrhosisVariableOR (95% CI)P-valueHGB0.961 (0.947–0.974)<0.001Ascites Depth0.973 (0.959–0.986)<0.001TP0.912 (0.871–0.952)<0.001PTA0.949 (0.928–0.969)<0.001TBA0.986 (0.977–0.994)0.001D-dimer0.877 (0.769–0.981)0.037WBC1.312 (1.158–1.504)<0.001Note: Seven variables were retained in the final model after excluding non-significant predictors (P > 0.05).Abbreviations: OR, Odds Ratio; CI, Confidence Interval. Multivariable Logistic Regression Analysis for Predictors of First Variceal Bleeding in Patients with HBV-Related Decompensated Cirrhosis Note: Seven variables were retained in the final model after excluding non-significant predictors (P > 0.05). Abbreviations: OR, Odds Ratio; CI, Confidence Interval. Table 4Multivariable Logistic Regression Analysis for Predictors of First Variceal Bleeding in Patients with HCV-Related Decompensated CirrhosisVariableOR (95% CI)P-valuePTA0.909 (0.872–0.94)<0.001HGB0.969 (0.947–0.989)0.004TBA0.984 (0.966–0.997)0.041Note: Variables with P < 0.05 were retained in the final model.Abbreviations: OR, Odds Ratio; CI, Confidence Interval. Multivariable Logistic Regression Analysis for Predictors of First Variceal Bleeding in Patients with HCV-Related Decompensated Cirrhosis Note: Variables with P < 0.05 were retained in the final model. Abbreviations: OR, Odds Ratio; CI, Confidence Interval. ROC Curves and AUC values of initial and refined Logistic Regression models for HBV and HCV. Sensitivity Analysis To assess the robustness of the final models with respect to parameters potentially influenced by acute bleeding, we performed sensitivity analyses by excluding HGB alone and by excluding both HGB and WBC simultaneously. In the HBV cohort, removal of HGB alone resulted in a modest decline in discriminative performance (AUC decreased from 0.9239 to 0.8968 [95% CI: 0.8621–0.9315]). When both HGB and WBC were excluded, the AUC further decreased to 0.8875 (95% CI: 0.8513–0.9237). Despite these reductions, the models retained acceptable predictive ability. Due to the relatively small sample size of the HCV cohort, a separate sensitivity analysis was not performed in this group. Comparison with Child-Pugh Score We further compared our nomograms with the Child-Pugh score. In the HBV cohort, the Child-Pugh score demonstrated only modest discriminative ability (AUC = 0.5778, 95% CI: 0.5172–0.6385). In contrast, our final nomogram showed significantly superior performance compared with the Child-Pugh score (DeLong test, P < 0.001). Similarly, in the HCV cohort, the Child-Pugh score yielded an AUC of 0.5798 (95% CI: 0.4698–0.6898), whereas our nomogram demonstrated significantly better performance (DeLong test, P < 0.001). Calibration and Nomograms The final nomogram models incorporated seven significant predictors for HBV-related decompensated cirrhosis (HGB, Ascites Depth, TP, PTA, TBA, WBC, and D-dimer) and three predictors for HCV-related decompensated cirrhosis (PTA, HGB, and TBA). These nomograms were constructed based on multivariable logistic regression to visualize individualized bleeding risk (Figures 5a and 6a). Figure 5Nomogram and calibration plot for Gastroesophageal Variceal Bleeding Risk in HBV Cohort.Image A displays a nomogram with scales for Points (0-100), HGB (160-20), TP (95-30), Ascites Depth (140-0), PTA (100-10), TBA (260-20), D-dimer (60-0), WBC (0-20), Total Points (0-450), Linear Predictor (-12 to 8) and Risk of Bleeding (0.05-0.95). Image B presents a calibration graph with Predicted Probability of Bleeding (X-axis, 0.0-1.0) and Observed Proportion of Bleeding (Y-axis, 0.0-1.0). Errors: mean absolute (0.022), mean squared (0.00067) and 0.9 quantile of absolute error (0.045). Legend includes Apparent, Bias-corrected and Ideal lines. The ideal diagonal runs from (0.0, 0.0) to (1.0, 1.0). Apparent and bias-corrected curves are close to the diagonal, lying slightly above it at low predicted probabilities, below it across much of the middle range, and slightly above it at the upper end. Bottom text mentions bootstrap calibration with 1000 resamples.The figure comprises two panels. Image A shows how seven clinical variables contribute to a total score and estimated bleeding risk. Image B compares the apparent and bootstrap bias-corrected calibration curves with the ideal line, showing generally good agreement between predicted and observed risks.Notes: (a) Nomogram for Gastroesophageal Variceal Bleeding Risk in HBV Cohort; (b) Calibration plot for Gastroesophageal Variceal Bleeding Risk in HBV Cohort.Abbreviations: TP, Total Protein; TBA, Total Bile Acid; WBC, White Blood Cell Count; HGB, Hemoglobin; PTA, Prothrombin Activity. Figure 6Nomogram and calibration plot for Gastroesophageal Variceal Bleeding Risk in HCV Cohort.Image A displays a nomogram with scales: Points (0-100), PTA (130-20), HGB (180-20), TBA (220-20), Total Points (0-180), Linear Predictor (-8 to 5) and Risk of Bleeding (0.05-0.95). Image B shows a calibration graph with mean absolute error of 0.025, mean squared error of 0.00068 and 0.9 quantile of absolute error of 0.036. The x-axis is Predicted Probability of Bleeding (0.0-1.0) and the y-axis is Observed Proportion of Bleeding (0.0-1.0). The legend includes Apparent, Bias-corrected and Ideal. The apparent and bias-corrected curves closely follow the ideal diagonal, lying slightly above it at low-to-moderate predicted probabilities, below it across much of the higher range, and converging with it near 1.0. Bottom text notes Bootstrap calibration with 1000 resamples.The figure comprises two panels. Image A shows how three clinical variables contribute to a total score and estimated bleeding risk. Image B compares the apparent and bootstrap bias-corrected calibration curves with the ideal line, showing generally good agreement between predicted and observed risks.Notes: (a) Nomogram for Gastroesophageal Variceal Bleeding Risk in HCV Cohort; (b) Calibration plot for Gastroesophageal Variceal Bleeding Risk in HCV Cohort.Abbreviations: TBA, Total Bile Acid; HGB, Hemoglobin; PTA, Prothrombin Activity. Nomogram and calibration plot for Gastroesophageal Variceal Bleeding Risk in HBV Cohort. Nomogram and calibration plot for Gastroesophageal Variceal Bleeding Risk in HCV Cohort. Calibration curves validated the reliability of the nomograms’ predicted probabilities, demonstrating high concordance with observed probabilities, with a mean absolute error (MAE) of 0.022 for HBV and 0.025 for HCV (Figures 5b and 6b). Partial Dependence Analysis and Breakpoint Identification PDPs from the RF model validated non-linear relationships between nomogram predictors and cirrhosis-related decompensated gastroesophageal variceal bleeding. Specifically, seven PDPs were generated for HBV and three for HCV, corresponding to the predictors incorporated in each nomogram. The key predictors identified in the Logistic Regression model demonstrated similar risk trajectories in the RF model, indicating strong consistency in predictive behavior (Figure 7). For HBV patients, the predicted probability of bleeding reached 0.5 at breakpoints of 96.12 g/L for HGB, 60.75 g/L for TP, 30.58 mm for Ascites Depth, 49.2% for PTA, 25.78 µmol/L for TBA, 2.24mg/L for D-dimer, and 5.33×109/L for WBC. For HCV patients, the 0.5-risk threshold occurred at 46.81% for PTA, at 82.4 g/L for HGB, and at 47.51 µmol/L for TBA. Figure 7Partial Dependence Plots for Selected Features in HBV and HCV Cohorts.The image A showing a line graph of predicted probability (Bleeding Risk) versus HGB (g/L). The x-axis ranges from 40 to 160. The y-axis ranges from 0.0 to 1.0. The curve stays around 0.55 to 0.56 from about 40 to about 80, then drops steeply, crossing 0.5 at 96.12 and approaches about 0.39 by 140. The image B showing a line graph of predicted probability (Bleeding Risk) versus TP (g/L). The x-axis ranges from 40 to 80. The y-axis ranges from 0.0 to 1.0. The curve remains around 0.58 from about 40 to about 55, then declines sharply, crossing 0.5 at 60.75, reaching about 0.43 near 70 and slightly rising toward about 0.435 by 80. The image C showing a line graph of predicted probability (Bleeding Risk) versus Ascites Depth (mm). The x-axis ranges from 0 to 100. The y-axis ranges from 0.0 to 1.0. The curve rises to a peak of approximately 0.55 around the low x values, then drops sharply, crossing 0.5 at 30.58 and remains around 0.44 to 0.45 from about 35 to 80. The image D showing a line graph of predicted probability (Bleeding Risk) versus PTA (percent). The x-axis ranges from 20 to 80. The y-axis ranges from 0.0 to 1.0. The curve declines gradually from near 0.53 at about 20 to about 0.51 near 45, then drops steeply, crossing 0.5 at 49.2 and flattens near about 0.42 from about 60 to 80. The image E showing a line graph of predicted probability (Bleeding Risk) versus TBA (micromol/L). The x-axis ranges from 0 to 250. The y-axis ranges from 0.0 to 1.0. The curve starts near 0.55 at low values, decreases steadily, crosses 0.5 at 25.78, approaches about 0.43 by around 100, stays near 0.42 to 0.43 through about 220, then slightly increases near the far right. The image F showing a line graph of predicted probability (Bleeding Risk) versus D-dimer (mg/L). The x-axis ranges from 0 to 50. The y-axis ranges from 0.0 to 1.0. The curve is near 0.54 at very low values, drops sharply, crosses 0.5 at 2.24 and then stays near about 0.46 to 0.47 from about 10 to 50. The image G showing a line graph of predicted probability (Bleeding Risk) versus WBC (10 to the power 9 per L). The x-axis ranges from 0 to 15. The y-axis ranges from 0.0 to 1.0. The curve increases from about 0.47 at low values, rises through 0.5 at 5.33, then continues upward and plateaus near about 0.54 to 0.55 from roughly 9 to 15. The image H showing a line graph of predicted probability (Bleeding Risk) versus PTA (percent). The x-axis ranges from 20 to 80. The y-axis ranges from 0.0 to 1.0. The curve stays high near about 0.7 to 0.75 at lower values, then drops steeply, crossing 0.5 at 46.81 and flattens near about 0.42 from about 55 to 80. The image I showing a line graph of predicted probability (Bleeding Risk) versus HGB (g/L). The x-axis ranges from 40 to 120. The y-axis ranges from 0.0 to 1.0. The curve is near 0.65 at the left, then declines in steps, crossing 0.5 at 82.4 and approaches about 0.45 to 0.47 by about 100 to 120. The image J showing a line graph of predicted probability (Bleeding Risk) versus TBA (micromol/L). The x-axis ranges from 0 to 200. The y-axis ranges from 0.0 to 1.0. The curve starts high near 0.62 at low values, decreases rapidly, crosses 0.5 at 47.51 and then remains low near about 0.47 to 0.48 from about 80 to 200.A multi-panel figure showing partial dependence plots of selected features for gastroesophageal variceal bleeding risk prediction using Random Forest models in HBV and HCV cohorts.Note: Partial Dependence Plots for Selected Features in HBV Cohort: (a) HGB, (b) TP, (c) Ascites Depth, (d) PTA, (e) TBA, (f) D-dimer, (g) WBC; Partial Dependence Plots for Selected Features in HCV Cohort: (h) PTA, (i) HGB, (j) TBA; Partial Dependence Plots (PDPs) illustrate the non-linear effects of selected features on gastroesophageal variceal bleeding risk using Random Forest models, with breakpoints marked at a predicted probability of 0.5. Group 1: decompensated liver cirrhosis with or without varices, no bleeding; Group 2: decompensated liver cirrhosis with variceal rupture and bleeding.Abbreviations: TP, Total Protein; TBA, Total Bile Acid; WBC, White Blood Cell Count; HGB, Hemoglobin; PTA, Prothrombin Activity. Partial Dependence Plots for Selected Features in HBV and HCV Cohorts. Decision Curve Analysis Results Logistic Regression models demonstrated strong overall performance, significantly outperforming RF and XGBoost in predicting gastroesophageal variceal bleeding risk in hepatitis B- and C-related decompensated liver cirrhosis across specific threshold ranges, as evaluated by DCA (Figure 8). Its superior net benefits, interpretability, and consistent performance, particularly in moderate thresholds, made it the preferred model for clinical utility, with all models (RF, XGBoost, and Logistic Regression) outperforming “Treat All” and “Treat None” strategies above thresholds of 0.14 for HBV and 0.17 for HCV. Figure 8Decision Curve Analysis for Gastroesophageal variceal bleeding Risk Prediction in HBV and HCV.Image A and B both depict line graphs with y-axis labeled Net Benefit (0.0 to 1.0) and x-axis labeled Threshold Probability (0.0 to 1.0). A secondary x-axis shows Cost:Benefit Ratio with ticks at 1:100, 1:4, 2:3, 3:2, 4:1, 100:1. Legends include Random Forest, XGBoost, Logistic Regression, All, None. The None line remains at net benefit 0 across all threshold probabilities. The All curve slopes downward. Random Forest, XGBoost and Logistic Regression curves begin near (0.0, 1.0) and generally decline towards threshold probability 1.0, showing fluctuations. In both images, these curves approach net benefit near 0 as threshold probability nears 1.0.A multi-panel figure showing decision curve analysis net benefit plots for Random Forest, XGBoost, and Logistic Regression models in HBV and HCV cohorts.Notes: (a) Decision Curve Analysis for Gastroesophageal variceal bleeding Risk Prediction in HBV; (b) Decision Curve Analysis for Gastroesophageal variceal bleeding Risk Prediction in HCV; Net benefit curves are shown for Random Forest (blue), XGBoost (dark green), and Logistic Regression (red), with 95% confidence intervals represented by finer lines of the same color, alongside “Treat All” (light gray) and “Treat None” (black) strategies. (a) For hepatitis B-related decompensated liver cirrhosis, Logistic Regression performed best in 0.22–0.45 (highest net benefits, eg, 0.4232 at 0.23), 0.69–0.8, and 0.89–0.91. Random Forest performed best at specific thresholds in 0.0–0.15 (eg, 0.05 and 0.15, but not 0.10) and at 0.5. XGBoost performed best at 0.09–0.10. All models outperformed both “Treat All” and “Treat None” in the threshold from 0.14. (b) For hepatitis C-related outcomes, Logistic Regression performed best in 0.30–0.49 (highest net benefits, eg, 0.4746 at 0.31). Random Forest performed best in 0.0–0.24 (eg, 0.5158 at 0.18) and 0.84–0.91, and was competitive in 0.65–0.83, particularly at 0.70–0.72. XGBoost performed best in 0.51–0.64 (eg, 0.3215 at 0.55) and 0.73–0.82. All models outperformed both “Treat All” and “Treat None” in the threshold from 0.17. Decision Curve Analysis for Gastroesophageal variceal bleeding Risk Prediction in HBV and HCV. Discussion This study developed etiology-specific nomogram models to predict the risk of first variceal bleeding in patients with decompensated HBV- and HCV-related cirrhosis, deliberately excluding patients with compensated cirrhosis to improve analytical precision and clinical relevance. We employed a multi-step approach involving univariate screening, feature ranking using RF and XGBoost, and multivariable Logistic Regression to identify key predictors. RF-based PDPs were used to determine predictor values corresponding to a 50% bleeding risk, providing clinically actionable thresholds. The final models were visualized as nomograms and validated through calibration curves and DCA. Notably, while the significant predictors differed between the HBV and HCV cohorts, PTA, HGB, and TBA emerged as common predictors. Several machine learning and nomogram-based models have been developed to predict gastroesophageal variceal bleeding in patients with liver cirrhosis. A recent meta-analysis by Lian et al of 21 studies reported pooled validation c-indices of 0.85–0.89 for gastroesophageal variceal bleeding prediction.7 Most included studies used mixed compensated and decompensated cohorts with heterogeneous etiologies and did not perform etiology- or stage-specific modeling. We developed etiology-stratified nomograms specifically for patients with decompensated HBV- and HCV-related cirrhosis and our model achieved AUCs of 0.9239 (HBV) and 0.9127 (HCV). Hou et al constructed an artificial neural network (ANN) model that achieved excellent predictive performance (AUC 0.959) for 1-year gastroesophageal variceal bleeding risk.14 However, as a typical “black-box” model, its limited interpretability may restrict widespread clinical adoption. Notably, Spleen Size and related parameters have been identified as candidate predictors in several previous studies focusing on HBV-related cirrhosis.15,16 Consistent with these reports, we observed a significantly larger Spleen Size in the bleeding group compared with the non-bleeding group among patients with HBV-related decompensated cirrhosis. However, in the multivariable logistic regression analysis, Spleen Size did not remain an independent predictor after adjustment for other variables. It was therefore not included in the final nomogram. Interestingly, no significant difference in Spleen Size was found between the bleeding and non-bleeding groups in patients with HCV-related decompensated cirrhosis. These differential findings between HBV- and HCV-related cirrhosis further support the rationale for developing etiology-specific prediction models. In patients with HBV- or HCV-related decompensated liver cirrhosis and gastroesophageal variceal bleeding, HGB, PTA, and TBA levels were significantly lower compared to those without variceal bleeding. Both groups showed significantly reduced PTA due to impaired hepatic synthesis of clotting factors, while the bleeding group exhibiting a more pronounced decline. This difference likely indicates more advanced hepatic decompensation and poorer liver synthetic function in the bleeding group.17 Additionally, patients with variceal bleeding in this study exhibited lower HGB. HGB was identified as a common predictor in both the HBV and HCV models. Sensitivity analyses demonstrated that exclusion of HGB, either alone or in combination with WBC, resulted in only a modest decline in model performance. These findings suggest that our nomograms do not overly rely on these parameters that may be influenced by acute bleeding. Although a separate sensitivity analysis was not performed in the HCV cohort due to its limited sample size, the results support the relative stability of the models. HGB has been reported as an independent predictor of first decompensation in cirrhosis in previous study.18 In patients with decompensated cirrhosis, anemia is common and its severity correlates with increased portal pressure.19 Anemia may induce a hyperdynamic circulatory state through increased cardiac output,20 which can enhance splanchnic blood flow and further elevate portal hypertension, thereby increasing the risk of variceal bleeding.21 PDPs’ thresholds showed that HGB levels below 96.12 g/L (HBV) and 82.4 g/L (HCV), PTA below 49.2% (HBV) and 46.81% (HCV) were associated with a greater than 50% probability of gastroesophageal variceal bleeding. Previous studies have linked anemia and coagulation abnormalities to an increased risk of variceal bleeding in cirrhosiss.22 Our findings are consistent with these observations. Although TBA levels were elevated in both bleeding and non-bleeding patients with decompensated cirrhosis—likely reflecting impaired hepatic clearance23 and portosystemic shunting24—bleeding patients exhibited significantly lower TBA levels than non-bleeding patients. The lower TBA levels in bleeding patients may reflect more advanced cirrhosis and metabolic dysregulation.23–25 Higher TBA levels may exert protective effects against variceal bleeding through FXR (farnesoid X receptor)- and TGR5 (takeda G-protein associated receptor)-mediated pathways that enhance vascular stability and attenuate inflammation.24,26 PDPs showed that TBA levels below 25.78 µmol/L in HBV patients and 47.51 µmol/L in HCV patients were associated with a >50% probability of gastroesophageal variceal bleeding. These distinct TBA thresholds may reflect disease-specific metabolic alterations, as patient profiles vary significantly by the underlying cause of chronic liver disease.27 Whether TBA can serve as a reliable biomarker for bleeding risk in decompensated cirrhosis warrants further investigation. An interesting finding of this study is the difference in predictor profiles between the HBV- and HCV-related decompensated cirrhosis models. While HGB, Ascites Depth, TP, PTA, TBA, D-dimer, and WBC were retained in the HBV model, only HGB, PTA, and TBA remained significant in the HCV model. These differences may reflect distinct pathophysiological mechanisms between HBV- and HCV-related decompensated cirrhosis. Previous studies have demonstrated that HBV and HCV differ in their immune evasion strategies, patterns of T cell exhaustion, and the regulatory roles of NK cells in liver inflammation and fibrogenesis.28 Also, HBV and HCV have been shown to induce distinct alterations in gut microbiota composition and cytokine profiles.29 These may result in different dominant pathways contributing to decompensation and variceal bleeding risk in each etiology. However, it should be noted that the HCV cohort was relatively small, which may have limited the statistical power to identify additional predictors and affected the stability of variable selection. PDPs revealed that in HBV-related decompensated liver cirrhosis, patients with Ascites Depth below 30.58 mm had a >50% probability of gastroesophageal variceal bleeding. Liang et al also identified ascites as a potential protective factor against gastroesophageal variceal bleeding in cirrhosis.30 The reason might be moderate ascites could mitigate portal vein hemodynamic instability, a key driver of variceal bleeding.31 Although previous studies have found ascites to be protective, little focused on the amount of ascites that should be maintained. Ascites depth should not be below 30.58 mm suggests that complete elimination of ascites may not be necessary in these patients. Excessively pursuing its reduction or elimination (eg, through high-dose diuretics or large-volume paracentesis) may lead to reduced effective blood volume, hemodynamic instability, and systemic vasoconstriction,32 thereby exacerbating portal hypertension and increasing the risk of gastric and esophageal variceal bleeding.33 Although D-dimer levels were elevated in both bleeding and non-bleeding patients with decompensated cirrhosis—likely due to impaired hepatic clearance34—bleeding patients exhibited significantly lower D-dimer levels. This difference may be partly attributed to the reduced Ascites Depth in the bleeding group, consistent with previous reports that D-dimer levels increase with ascites severity.35 Additionally, ascites can promote systemic fibrinolysis by facilitating the circulation of fibrin degradation products, including D-dimer, through lymphatic drainage and the thoracic duct.36 Therefore, the reduced ascites burden observed in bleeding patients may contribute to relatively lower circulating D-dimer levels. However, D-dimer levels are influenced by multiple factors, and interpretation in the setting of acute bleeding should be made with caution.34 PDPs further revealed that patients with D-dimer <2.24 mg/L had a >50% probability of gastroesophageal variceal bleeding. Future studies should analyze ascites severity, hemodynamic parameters (eg, portal pressure), and coagulation profiles to confirm these mechanisms. PDPs revealed that patients with TP levels <60.75 g/L and WBC >5.33×109/L face a >50% risk of gastroesophageal variceal bleeding. Low TP reflects impaired hepatic synthetic capacity and is usually accompanied by hypoalbuminemia, is associated with more severe decompensation and may contribute to increased systemic inflammation and higher risk of variceal bleeding.37 Elevated WBC, a marker of systemic inflammation or infection, is known to precipitate variceal bleeding in patients with decompensated cirrhosis through exacerbation of portal hypertension, hemostatic dysfunction, and endothelial activation.38–40 This aligns with Liang et al who linked higher WBC to elevated variceal bleeding risk.30 In decompensated cirrhosis, a WBC count >5.33×109/L is significant despite being lower than typical leukocytosis in healthy individuals (>10–11×109/L). This reflects cirrhosis-associated immune dysfunction, characterized by immune suppression and systemic inflammation.41 Bacterial translocation occurs early in cirrhosis and triggers a systemic inflammatory response.42 Portal hypertension-induced hypersplenism further lowers baseline WBC levels by sequestering cells in the spleen.43 Consequently, an increase in WBC count to >5.33×109/L may serve as a sensitive marker of significant inflammation and elevated bleeding risk in decompensated cirrhosis. Nomograms were constructed to facilitate individualized risk estimation for first variceal bleeding in decompensated cirrhosis. DCA suggested potential clinical utility of the underlying logistic regression models by demonstrating favorable net benefit. However, further validation in larger and prospective cohorts is needed to establish their reliability for clinical use. This study has several limitations. First, as a retrospective single-center study, the risk of selection bias cannot be excluded, and the generalizability of the findings may be limited. Second, the number of patients with HCV-related decompensated cirrhosis was relatively small, which may have affected the stability of variable selection and model performance in the HCV cohort. Third, laboratory parameters such as HGB were measured at the time of hospital admission and may have been influenced by acute blood loss in patients presenting with bleeding. Although a sensitivity analysis showed only a modest reduction in model performance after excluding HGB and WBC count, this temporal aspect should be considered when interpreting the results. Fourth, endoscopic parameters, including variceal diameter and red wale signs, were not included in the analysis. Endoscopic parameters were not included for the following reasons. The primary aim of this study was to develop non-invasive prediction models that can be applied when timely endoscopy is not feasible. Furthermore, in patients who had already experienced variceal bleeding, endoscopic findings obtained after the bleeding episode may not reliably reflect the pre-bleeding status due to changes in portal pressure and variceal wall tension. Fifth, although internal validation was performed using a training-testing split, external validation was not conducted, which limits the assessment of the models’ generalizability. Despite these limitations, the nomograms developed in this study have the potential to serve as auxiliary decision-support tools for risk stratification in patients with decompensated cirrhosis, particularly in settings where timely endoscopic evaluation is not feasible. However, before these models can be considered for routine clinical use, several steps are required. These include external validation in independent multicenter cohorts, development of user-friendly interfaces (such as web-based calculators or integration into electronic medical record systems), and prospective studies to evaluate their actual impact on clinical decision-making and patient outcomes. Until such validation is completed, the nomograms should currently be regarded as research tools rather than ready-to-use clinical instruments. Conclusions Etiology-specific nomogram models were developed for predicting first variceal bleeding in decompensated HBV- and HCV-related cirrhosis. The models demonstrated good discriminative performance internally and may assist in risk stratification. However, external validation through prospective multicenter studies is required before clinical implementation.