Abstract
Objectives: This study aimed to develop and validate a machine learning model based on routine clinical data to provide real-time, accurate decision support for distinguishing malignant pericardial effusion (MPE) from benign pericardial effusion (BPE). Methods: In total, 296 patients were retrospectively enrolled, comprising 168 with BPE and 128 with MPE. The dataset was randomly divided into training and test sets in a 7:3 ratio. Six machine learning algorithms were trained to construct predictive models, with their predictive accuracy assessed using the Area Under the Curve (AUC) and Decision Curve Analysis (DCA). Furthermore, SHapley Additive exPlanations (SHAP) analysis was utilized to interpret model outputs and identify key predictive variables. Results: All six machine learning models achieved favorable diagnostic performance. Among them, the LightGBM (LGB) model demonstrated the highest predictive accuracy; the LGB test set under the receiver operating characteristic curve (AUC) was 0.930 (95% CI 0.871–0.979), with a sensitivity of 86.8%, a specificity of 94.0%, and an accuracy of 90.9%. XGBoost (XGB) had a lower score than LGB (0.111 versus 0.142). LGB calibration intercept and slope were 0.246 and 3.328. The combined serum D-dimer/carbohydrate antigen 125 (CA125) model had AUC 0.876; its difference from LGB was uncertain (ΔAUC 0.054, 95% CI −0.011 to 0.125; Holm-adjusted p = 0.382). Mean LGB out-of-fold AUC was 0.888 (SD 0.008). Fluid lactate dehydrogenase had the highest SHAP importance. Conclusions: This study developed and validated an interpretable machine learning model incorporating five readily available clinical indicators that enables accurate and rapid differentiation between MPE and BPE, enhancing diagnostic decision-making for pericardial effusion.
Keywords: machine learning model, malignant pericardial effusion, benign pericardial effusion
1. Introduction
Advancements in imaging technologies and diagnostic techniques have led to an increase in the detection and diagnosis of malignant pericardial effusion (MPE). Given its typically abrupt onset and rapid progression, a subset of patients may develop life-threatening cardiac tamponade. Early detection and accurate diagnosis are crucial for formulating individualized treatment strategies and improving prognosis.
Malignant tumor-related pericardial effusion accounts for up to 19.7% of pericardial effusion (PE) cases, commonly resulting from metastasis of solid or hematological tumors such as lung cancer, breast cancer, and lymphoma [1,2,3,4]. Tumor invasion increases pericardial capillary permeability, leading to rapid accumulation of pericardial effusion PE [5,6]. Between 15% and 65% of patients with MPE experience pericardial tamponade, which carries a 1-year mortality rate ranging from 68% to 89% [7].
Current cytopathology-based diagnostic approaches for MPE demonstrate a specificity exceeding 92.1% [8]. Nevertheless, due to factors such as low tumor cell shedding, spatial heterogeneity, and timeliness of detection, approximately two-thirds of malignant cases fail to yield definite cytological evidence at the first pericardiocentesis [9]. Additionally, certain rare malignancies, such as fluid overload-associated large B-cell lymphoma (FO-LBCL), may initially manifest as massive pericardial effusion, further complicating prompt and accurate diagnosis. Therefore, developing an adjunctive diagnostic approach based on routinely available clinical data to distinguish MPE from BPE is of considerable clinical significance. This approach may be particularly valuable for patients who have undergone pericardiocentesis and drainage but whose initial pericardial fluid cytology is negative for malignant cells, despite persistent clinical suspicion of malignant pericardial involvement. By integrating multidimensional clinical information, such an approach may provide complementary evidence for malignancy risk stratification and subsequent diagnostic decision-making, potentially reducing diagnostic delays and supporting the timely formulation of individualized treatment strategies.
By integrating multi-dimensional clinical data, machine learning technology transcends the constraints of single-variable and linear assumptions, effectively capturing complex non-linear associations that traditional statistical methods often fail to identify, thereby enhancing diagnostic sensitivity [10]. In addition, SHapley Additive exPlanations (SHAP) offer a visual and interpretable evaluation of each predictor’s contribution, paving the way for a transparent and scalable diagnostic system [11].
This study aims to develop a machine learning-based diagnostic model that integrates multiple routinely available clinical variables to improve the discrimination between MPE and BPE. The model may be particularly valuable in providing complementary malignancy risk assessment and clinical decision support for patients who have undergone pericardiocentesis and drainage but whose initial pericardial fluid cytology is negative for malignant cells, despite persistent clinical suspicion of malignant pericardial involvement. In this context, the model may help inform further diagnostic evaluation and the formulation of individualized treatment strategies.
2. Methods
2.1. Study Population
We retrospectively reviewed patients with a history of PE who underwent pericardiocentesis at Peking University People’s Hospital between March 2011 and May 2024. Inclusion criteria were (1) PE confirmed by echocardiography or chest computed tomography (CT) and (2) pericardiocentesis performed during the illness. Exclusion criteria were undetermined PE etiology after comprehensive evaluation or missing clinical data for ≥25% of variables to ensure analytic reliability.
2.2. Data Collection
Data collected for all included patients comprised (1) demographic and clinical characteristics—age, gender, disease course, pericardial effusion volume, and comorbidities; (2) blood laboratory parameters—complete blood count, D-dimer, liver and renal function tests, lactate dehydrogenase (LDH), adenosine deaminase (ADA), tumor markers, cardiac injury biomarkers, and B-type natriuretic peptide; and (3) pericardial effusion laboratory parameters—appearance, cell count and proportion, pH, glucose, protein characteristics, total protein, albumin, LDH, ADA, and tumor markers.
2.3. Diagnostic Criteria
MPE was diagnosed if at least one of the following criteria was met: (1) malignant cells identified by cytological examination of pericardial effusion (PE), or (2) malignant infiltration confirmed by histopathological examination of pericardial or epicardial tissue. In patients with a known malignancy but negative or inconclusive PE cytology, MPE was diagnosed only when the available clinical, imaging, pathological, and follow-up findings collectively supported malignant pericardial involvement according to the prespecified diagnostic criteria.
BPE was diagnosed when no evidence of malignant pericardial involvement was identified after comprehensive clinical evaluation, including PE cytology when available, relevant imaging and laboratory investigations, and clinical follow-up, and at least one of the following criteria was met: (1) a plausible non-malignant etiology was identified, with clinical or laboratory findings supporting the diagnosis; (2) the effusion improved or resolved following treatment directed at the underlying non-malignant condition, without other evidence of malignancy; or (3) no evidence of malignancy emerged during at least 12 months of follow-up.
To minimize potential diagnostic assessment bias, the final diagnoses were independently reviewed and adjudicated by two clinicians with experience in cardiovascular medicine and/or oncology, based on the available medical records and prespecified diagnostic criteria. Both assessors were blinded to the machine learning model predictions during the diagnostic assessment. In cases of disagreement, a senior cardiologist with extensive clinical experience conducted a further review and made the final determination.
2.4. Model Development and Validation
For model development and validation, the dataset was randomly divided into a training set (70%, n = 208) and a test set (30%, n = 88) using stratified sampling to preserve similar distributions of clinical features and outcomes across both subsets. The proportions of missing observations for individual variables were relatively low, ranging from 0.338% to 4.054%. Assuming that the data were missing at random, missing values were addressed using multiple imputation by chained equations (MICE) implemented with the mice package in R Statistical Software (v4.1.2; R Core Team, Vienna, Austria, 2021). Five imputed datasets were generated (m = 5), with five iterations per imputation (maxit = 5), and imputation methods were selected according to variable types. To minimize information leakage, imputation was performed separately within the training and test sets, with the imputation model for the training set developed using training data only and without incorporating outcome information from the test set. The first imputed dataset was selected for subsequent analyses. To reduce dimensionality and mitigate overfitting, the Least Absolute Shrinkage and Selection Operator (LASSO) was applied to the training set to select the most predictive variables for subsequent model development, with the regularization parameter optimized via 10-fold cross-validation.
Six machine learning algorithms were implemented to develop diagnostic models: Generalized Linear Model (GLM), Gradient Boosting Classifier (GBC), Random Forest (RF), AdaBoost (ABC), Light Gradient Boosting Machine (LGB), and eXtreme Gradient Boosting (XGB). Model performance was assessed using the area under the receiver operating characteristic curve (AUC) and decision curve analysis (DCA) on both the training and test sets. SHAP was employed to interpret the models by quantifying and visually representing the contribution of each input variable, thereby enhancing model transparency and clinical interpretability.
Hyperparameters were tuned using exhaustive grid search for GLM and AdaBoost, Latin hypercube-based space-filling sampling for hyperparameter search in GBC, RF, and LGB, and randomized search for XGB. All algorithms used the same outcome-stratified five-fold cross-validation partitions, with the procedure repeated five times within the training cohort. For each algorithm, the configuration with the highest mean ROC AUC across cross-validation folds was selected, and the model was refitted on the full training cohort. The test cohort was not used for tuning. Search spaces, candidate counts, sampling distributions, and fixed settings are provided in Table S1. A common random seed (3407) was used for data partitioning, hyperparameter sampling, and model initialization.
2.5. Statistical Analysis
Normality of continuous variables was assessed using the Shapiro–Wilk test or the Kolmogorov–Smirnov test. Normally distributed data are expressed as means ± standard deviation (SD) and compared between groups using the independent-samples t-test. Non-normally distributed variables are presented as medians with interquartile ranges (Q1–Q3) and compared using the Mann–Whitney U test. Categorical data are presented as frequencies (percentage, %) and compared using the chi-square test. Two-tailed p values < 0.05 were considered statistically significant. Statistical analyses were performed using SPSS version 26.0 (IBM Corp., Armonk, NY, USA), R Statistical Software (v4.1.2; R Core Team, Vienna, Austria, 2021), or Python (v3.9.12).
3. Results
3.1. Patient Characteristics
As illustrated in Figure 1, a total of 306 patients were initially diagnosed with PE. After excluding 10 patients who did not satisfy the inclusion criteria, 296 patients were included in the final analysis, comprising 168 with BPE and 128 with MPE. The cohort was randomly split into a training set (70%, n = 208) and a test set (30%, n = 88).
Figure 1.

Flow diagram of participant selection.
A significant difference in disease duration (acute (≤4 weeks), subacute (>4 weeks to 3 months), or chronic (>3 months)) was observed between the BPE and MPE groups (p < 0.001; Table 1). Notably, 54.7% of MPE patients presented with acute PE, whereas 39.3% of BPE patients had a chronic course, indicating that MPE tends to manifest more acutely. Regarding comorbidities, hypertension, coronary artery disease, and tuberculosis were significantly more prevalent in the BPE group. No significant differences were found between the two groups in terms of age, sex, pericardial effusion volume, or other non-malignant comorbidities, including autoimmune diseases, hepatic dysfunction, and renal insufficiency.
Table 1.
Baseline characteristics of all patients.
| All (n = 296) | BPE (n = 168) | MPE (n = 128) | p-Value | |
|---|---|---|---|---|
| Age | 66 (56.00, 74.00) | 65 (52.00, 74.25) | 68 (57.75, 73.25) | 0.257 |
| Gender | 0.379 | |||
| Male | 167 (56.4%) | 99 (58.9%) | 68 (53.1%) | |
| Female | 129 (43.6%) | 69 (41.1%) | 60 (46.9%) | |
| Disease Course | <0.001 | |||
| Chronic | 78 (26.4%) | 66 (39.3%) | 12 (9.4%) | |
| Subacute | 94 (31.8%) | 48 (28.6%) | 46 (35.9%) | |
| Acute | 124 (41.9%) | 54 (32.1%) | 70 (54.7%) | |
| Pericardial effusion volume | 0.250 | |||
| Small or medium | 79 (26.7%) | 40 (23.8%) | 39 (30.5%) | |
| Massive | 217 (73.3%) | 128 (76.2%) | 89 (69.5%) | |
| Blood Tests | ||||
| White Blood Cell | 6.10 (4.80, 7.80) | 6.26 (4.98, 8.03) | 5.80 (4.57, 7.49) | 0.142 |
| Hemoglobin | 115.46 (24.21) | 116.02 (24.29) | 114.73 (24.18) | 0.652 |
| D-dimer | 691.50 (280.50, 1733.50) | 409.50 (182.75, 888.75) | 1270.00 (624.00, 2799.50) | <0.001 |
| Aspartate Aminotransferase | 24.00 (18.00, 32.00) | 23.00 (17.00, 31.25) | 25.50 (19.00, 35.00) | 0.095 |
| Alanine Aminotransferase | 17.00 (12.00, 34.00) | 17.00 (12.00, 32.25) | 18.00 (12.00, 34.25) | 0.444 |
| Lactate Dehydrogenase | 222.11 (156.29, 312.67) | 201.12 (154.36, 288.56) | 246.86 (164.16, 390.10) | 0.018 |
| Carcinoembryonic Antigen | 2.28 (1.52, 4.14) | 1.82 (1.36, 3.22) | 3.00 (1.85, 4.67) | <0.001 |
| Cancer Antigen 125 | 30.20 (12.89, 74.00) | 17.30 (8.97, 39.95) | 53.37 (29.60, 127.00) | <0.001 |
| Cytokeratin 19 Fragment | 2.35 (1.55, 5.05) | 2.39 (1.51, 4.76) | 2.34 (1.64, 5.17) | 0.308 |
| Neuron-specific Enolase | 13.98 (10.40, 17.60) | 14.14 (10.69, 17.70) | 13.63 (10.17, 17.46) | 0.499 |
| Effusion Tests | ||||
| Total Protein | 47.95 (41.60, 54.12) | 48.85 (40.9, 54.68) | 47.45 (42.18, 53.3) | 0.766 |
| Albumin | 29.25 (24.67, 33.40) | 29.35 (24.58, 33.62) | 28.95 (24.7, 32.55) | 0.519 |
| Lactate Dehydrogenase | 484.00 (232.00, 1334.50) | 292.00 (169.75, 567.75) | 1093.50 (543.75, 1664.00) | <0.001 |
| Carcinoembryonic Antigen | 1.50 (0.64, 3.64) | 0.91 (0.48, 1.97) | 2.76 (1.26, 39.80) | <0.001 |
| Cancer Antigen 125 | 399.00 (267.20, 882.50) | 369.00 (213.00, 751.25) | 430.00 (328.00, 1314.00) | <0.001 |
| Cytokeratin 19 Fragment | 75.27 (36.48, 235.60) | 75.27 (38.00, 245.00) | 75.22 (32.72, 205.00) | 0.577 |
| Neuron-specific Enolase | 10.15 (3.60, 53.04) | 11.90 (3.69, 55.42) | 9.25 (3.37, 47.80) | 0.265 |
As anticipated, malignancies—primarily lung cancer and hematologic malignancies—were the predominant underlying causes of MPE. Among the 128 patients with MPE, lung cancer was the most prevalent primary malignancy, accounting for 61 cases (47.7%), followed by leukemia or lymphoma (27 cases, 21.1%) and breast cancer (7 cases, 5.5%). The remaining 33 cases (25.8%) involved other primary malignancies, including ovarian cancer, mesothelioma, thyroid cancer, gastrointestinal cancers, and malignancies of unknown primary origin.
In contrast, BPE was primarily attributed to idiopathic causes and infections like tuberculosis. Among the 168 patients with BPE, idiopathic pericardial effusion was the most common etiology, representing 78 cases (46.4%), followed by infectious or tuberculous pericardial effusion (47 cases, 28.0%). Additional causes included iatrogenic injury (22 cases, 13.1%), immunological disorders (16 cases, 9.5%), and heart failure or renal insufficiency (5 cases, 3.0%) (Figure 2).
Figure 2.

The distribution of etiologies of BPE and MPE.
Significant differences between the BPE and MPE groups were observed in blood laboratory parameters, including D-dimer, carbohydrate antigen 125 (CA125), LDH, and carcinoembryonic antigen (CEA), as well as in PE parameters, including LDH, and tumor markers (CEA, CA125) (Table 1).
To optimize the model’s predictive performance, LASSO regression was applied to 40 candidate clinical predictors, encompassing patient history and laboratory test results. Ultimately, five key variables were selected, namely disease duration, serum CA125, serum D-dimer, pericardial effusion CEA, and pericardial effusion LDH levels, which were subsequently used to construct the predictive model (Figure 3 and Figure 4).
Figure 3.

Selection of the optimal variables using LASSO regression analysis. LASSO coefficient trajectories for the 40 clinical predictors.
Figure 4.

Selection of the optimal variables using LASSO regression analysis. Selection of optimal variables via cross-validation.
3.2. Development and Validation of the Diagnostic Model
Six machine learning algorithms—XGB, GLM, GBC, RF, ABC, and LGB—were trained on the training set to construct diagnostic models. Among these, LGB’s apparent training AUC and accuracy were 0.925 and 86.5%, compared with 0.973 and 92.3% for XGB (Table 2; Figure 5).
Table 2.
Evaluation metrics of six machine learning models in the training set.
| Sensitivity, % | Specificity, % | Accuracy, % | Negative Predictive Value, % | Positive Predictive Value, % | F1 Score | AUC | |
|---|---|---|---|---|---|---|---|
| XGB | 96.7 | 89.0 | 92.3 | 97.2 | 87.0 | 0.916 | 0.973 |
| LGB | 80.0 | 91.5 | 86.5 | 85.7 | 87.8 | 0.837 | 0.925 |
| RF | 67.8 | 92.4 | 81.7 | 79.0 | 87.1 | 0.762 | 0.915 |
| ABC | 90.0 | 73.7 | 80.8 | 90.6 | 72.3 | 0.802 | 0.925 |
| GLM | 58.9 | 88.1 | 75.5 | 73.8 | 79.1 | 0.675 | 0.881 |
| GBC | 86.7 | 90.7 | 88.9 | 89.9 | 87.6 | 0.872 | 0.953 |
Figure 5.

Receiver operating characteristic (ROC) curves of six machine learning models in the training set.
Furthermore, DCA was performed to evaluate the potential clinical utility of the six diagnostic models across a range of threshold probabilities (Figure 6). The results showed that all six models achieved positive net benefits over certain threshold probability ranges, suggesting their potential to support clinical decision-making. However, the magnitude of net benefit varied among models, and several models exhibited a decline in net benefit at higher threshold probabilities. Overall, the XGB model maintained a higher net benefit across a relatively broad range of threshold probabilities, whereas the net benefit of the LGB model declined at higher thresholds. Nevertheless, the DCA results suggest that both models may offer potential clinical utility.
Figure 6.

Decision curve analysis (DCA) curves of six machine learning models in the training set.
Compared with previous clinical prediction studies that combined machine-learning algorithms with SHAP analysis to improve model interpretability, our study selected the optimal model based on its observed performance in the target cohort rather than assuming the superiority of a particular algorithm. LightGBM (LGB) is a gradient-boosting decision-tree algorithm capable of capturing complex nonlinear relationships and interactions among clinical and laboratory variables.
In an independent test set (n = 88; 38 MPE and 50 BPE), all six models were evaluated, with detailed results presented in Table 3 and Figure 7 and Figure 8. The LGB model achieved the highest discrimination between MPE and BPE.
Table 3.
Evaluation metrics of six machine learning models in the test set.
| Sensitivity, % | Specificity, % | Accuracy, % | Negative Predictive Value, % | Positive Predictive Value, % | F1 Score | AUC | |
|---|---|---|---|---|---|---|---|
| XGB | 86.8 (76.3–97.4) | 82.0 (70.0–92.0) | 84.1 (76.1–90.9) | 89.1 | 78.6 | 0.825 | 0.921 (0.854–0.973) |
| LGB | 86.8 (73.7–97.4) | 94.0 (86.0–100.0) | 90.9 (84.1–96.6) | 90.4 | 91.7 | 0.892 | 0.930 (0.871–0.979) |
| RF | 76.3 (63.1–89.5) | 92.0 (84.0–98.0) | 85.2 (77.3–92.0) | 83.6 | 87.9 | 0.817 | 0.899 (0.822–0.962) |
| ABC | 92.1 (81.6–100.0) | 82.0 (72.0–92.0) | 86.4 (79.5–93.2) | 93.2 | 79.5 | 0.854 | 0.903 (0.829–0.959) |
| GLM | 76.3 (63.1–89.5) | 90.0 (82.0–98.0) | 84.1 (76.1–90.9) | 83.3 | 85.3 | 0.806 | 0.885 (0.809–0.949) |
| GBC | 86.8 (76.3–97.4) | 84.0 (74.0–94.0) | 85.2 (78.4–92.0) | 89.4 | 80.5 | 0.835 | 0.924 (0.862–0.972) |
Figure 7.

Receiver operating characteristic curves (ROC) of six machine learning models in the test set.
Figure 8.

Decision curve analysis (DCA) curves of six machine learning models in the test set.
LGB test AUC was 0.930 (95% CI 0.871–0.979), with an accuracy of 90.9% (84.1–96.6%), a sensitivity of 86.8% (73.7–97.4%), a specificity of 94.0% (86.0–100.0%), and an F1 score of 0.892 (Table 3; Figure 6). The LGB calibration intercept and slope were 0.246 and 3.328 (Figures S1 and S2).
Although the XGB model showed better apparent performance in the training set, the LGB model demonstrated the best overall discrimination in the held-out test set. Model selection was therefore informed by performance in the test set rather than apparent training performance alone. Nevertheless, given the single-center retrospective design and the absence of external validation, the superiority and generalizability of the LGB model require further confirmation in independent cohorts.
3.3. SHAP Analysis of the LGB Model
Following the identification of LGB as the optimal predictive model, SHAP analysis was performed to quantify the contributions of individual features to model predictions and to characterize the associations between feature values and the predicted probability of malignant pericardial effusion (MPE). As shown in Figure 9, pericardial effusion LDH was the most influential predictor, followed by pericardial effusion CEA, serum D-dimer, serum CA125, and disease course, in descending order of feature importance. These rankings reflect the relative predictive contributions of the features within the fitted model and may be influenced by correlations among predictors and interactions captured by the model. Accordingly, the SHAP results are interpreted as reflecting the model’s learned predictive patterns rather than independent pathophysiological effects or causal relationships.
Figure 9.

Global SHAP feature importance of the LightGBM model in the test set. Mean absolute SHAP values quantify the relative contributions of individual features to the model output on the log-odds scale.
TreeSHAP was implemented using the tree-path-dependent approach, with MPE designated as the positive class (MPE = 1) and additive feature contributions calculated on the log-odds scale. For the disease course, the SHAP contributions of its dummy variables were summed before calculating the overall feature importance, yielding a mean absolute SHAP value of 0.000. Figure 10 presents the SHAP summary (beeswarm) plot. Each point represents an individual patient; the x-axis shows the SHAP value, indicating the magnitude and direction of the feature’s contribution to the model output on the log-odds scale. Point color represents the corresponding feature value, with red indicating higher values and blue indicating lower values. Features are arranged on the y-axis in descending order of global SHAP importance. The plot shows that higher values of pericardial fluid LDH, pericardial fluid CEA, and serum D-dimer generally contributed positively to the model output for MPE, as reflected by positive SHAP values. These features therefore made important contributions to the model’s predictions of MPE.
Figure 10.

SHAP summary (beeswarm) plot of the LightGBM model in the test set. Each point represents an individual patient. The x-axis shows the SHAP value, indicating the direction and magnitude of each feature’s contribution to the model output (log-odds of MPE), while features on the y-axis are ranked in descending order of global feature importance. Point color represents the corresponding feature value, with red indicating higher values and blue indicating lower values.
To further elucidate the model’s prediction mechanism at the individual level, SHAP force plots were generated for two representative patients: one with MPE and one with BPE (Figure 11). In the plots, red bars indicate positive contributions to the model output, shifting the prediction toward higher log-odds of MPE, whereas blue bars indicate negative contributions, shifting the prediction toward lower log-odds of MPE. For the patient with MPE, pericardial fluid CEA, pericardial fluid LDH, serum D-dimer, and serum CA125 all made positive contributions to the model output, resulting in a predicted probability of MPE of 0.624. In contrast, for the patient with BPE, pericardial fluid LDH, serum D-dimer, and serum CA125 made negative contributions, whereas pericardial fluid CEA made a positive contribution, yielding a predicted probability of MPE of 0.261. Disease course contributed zero SHAP value in both cases. These individualized explanations illustrate how the LGB model integrates clinical and laboratory features and combines their relative contributions to generate patient-specific predictions. Importantly, SHAP values quantify feature contributions to the model output on the log-odds scale and should not be interpreted as independent causal effects of the features on disease occurrence.
Figure 11.


Individual-level SHAP force plots illustrating the LGB model predictions for representative patients with malignant and benign pericardial effusion: (A) A representative patient with MPE (PEF-175675), with a predicted MPE probability of 0.624. (B) A representative patient with BPE (PEF-220072), with a predicted MPE probability of 0.261.
4. Discussion
In this retrospective study, we employed LASSO regression analysis to identify five key variables with the highest predictive value for constructing a diagnostic model of MPE. Six machine learning algorithms were developed and validated, with the LGB model exhibiting superior performance compared to GLM, GBC, RF, ABC, and XGB models. To enhance the interpretability and reliability of the LGB model, we utilized the SHAP method to elucidate its decision-making process. This approach facilitates clinicians’ understanding of the model’s underlying rationale, thereby enhancing its accuracy and clinical utility in predicting MPE.
Studies have found that the incidence of PE is approximately 3% in developed countries, although data from developing countries remain scarce [12]. MPE can be associated with localized tumor burden, metastatic spread, or opportunistic infections in the context of immunosuppression [2,13]. The mortality rate for pericardial tamponade caused by MPE exceeds two-thirds [7]. Consequently, accurate identification of MPE is crucial for effective management of PE.
Cytology remains the gold standard for diagnosing MPE by detecting tumor cells in the PE. However, tumor cells may not always be present in MPE cases [14]. Accordingly, the development of a reliable complementary diagnostic tool is warranted to enhance the discrimination between MPE and BPE. In this study, we sought to establish a machine learning-based model incorporating routinely collected clinical variables to facilitate the differential diagnosis of pericardial effusion. The model may be of particular value in patients with persistent clinical suspicion of malignant pericardial involvement despite negative initial pericardial fluid cytology following pericardiocentesis and drainage. By providing additional information on the likelihood of malignancy, the model may help guide decisions regarding further diagnostic investigations and inform individualized management planning, thereby supporting clinical decision-making in this patient population.
Analysis of 105 PE cases revealed that CEA, CA 19-9, CA 72-4, squamous cell carcinoma (SCC), and NSE could serve as useful diagnostic indicators [15]. Studies have demonstrated the diagnostic utility of CEA in MPE detection, with a cut-off value of 5 ng/mL in pericardial fluid, yielding a diagnostic sensitivity of 75% [16,17]. Other studies have also highlighted the diagnostic value of CYFRA21-1 and CA125 in distinguishing MPE from BPE and assessing the severity of PE [18,19]. Nonetheless, these studies were limited to presenting data on individual markers and failed to construct a practical, comprehensive diagnostic model. This gap highlights the necessity of integrating multiple clinical and biochemical variables into a cohesive diagnostic framework.
Machine learning offers such a strategy for developing diagnostic models, providing substantial gains in efficiency and accuracy. Unlike traditional linear analysis, machine learning can integrate multimodal datasets and capture high-dimensional, nonlinear relationships with clinical relevance. Prior studies have demonstrated that multimodal machine learning models achieved diagnostic accuracy comparable to biopsy in breast cancer (90.1% vs. 92.7%) [20]. In our study, the LGB algorithm yielded a 90.9% accuracy and a 94.0% specificity in the internal test set. Together, these findings support continued evaluation of LGB for adjunctive etiological classification after drainage. Discrimination, classification at a specified threshold, and probability calibration describe different aspects of performance. The calibration slope of 3.328 indicates insufficiently dispersed probability estimates but does not negate the observed ranking or classification results [21]. Strictly increasing recalibration can preserve AUC while changing probability estimates; sensitivity and specificity at the same numerical threshold may nevertheless change [22]. Thus, the slope identifies a need to reassess the probability scale rather than, by itself, a reason to discard the model. Its clinical impact depends on the decision threshold and consequences of false-positive and false-negative classifications [23].
Building on these advantages, our study successfully constructed a machine learning-based diagnostic model; among these, carcinoembryonic antigen (CEA) in pericardial effusion was one of the most predictive indicators. This finding is consistent with previous studies reporting higher CEA levels in MPE [15,16,17,24]. As MPE most commonly arises from metastatic malignancies, particularly lung, gastrointestinal, and breast cancers, as well as lymphoma and leukemia [13], the central role of CEA in our model is biologically plausible. CEA is a well-established biomarker in oncology, formally approved for breast cancer surveillance and associated with lung adenocarcinoma and its adverse prognosis [25,26,27].
LDH is ranked as another major indicator in our model. LDH is a pivotal enzyme in cellular metabolism and has been implicated in tumor proliferation. Pericardial effusion typically contains abundant nucleated cells, albumin, and LDH [28], and elevated LDH has been recognized as a potential tumor-promoting factor in lung cancer [29]. LDH is also associated with leukemia and lymphoma, serving as a marker of poor prognosis [24,30,31,32]. These findings align with our results, reinforcing its diagnostic and prognostic significance.
CA125, a high-molecular-weight glycoprotein, is closely linked to pelvic malignancies, particularly ovarian cancer, and its levels correlate with tumor burden, making it useful for monitoring treatment response and disease progression. Beyond gynecologic cancers, CA125 also holds adjunctive diagnostic value in other cancers, such as pulmonary adenocarcinoma [33]. Several studies, along with our model, have confirmed the diagnostic contribution of CA125 in MPE [18]. Notably, CA125 is also expressed by mesothelial cells, and its levels may rise in non-malignant conditions such as inflammatory or exudative pericardial and pleural effusions [34]. Thus, while highly informative, CA125 requires cautious interpretation in the context of clinical history and comprehensive laboratory findings.
Baseline characteristics revealed a predominance of acute pericardial effusion in malignant cases. This pattern may reflect the natural trajectory of advanced malignancies, wherein rapid-onset effusions frequently arise as terminal complications. Accordingly, disease course (acute vs. chronic onset) may serve as a useful clinical discriminator between BPE and MPE, and its inclusion in the model adds complementary value beyond biochemical indices.
D-dimer, a degradation product of crosslinked fibrin, is a well-established marker of hypercoagulation and thrombosis. The rapid proliferation of tumor cells releases toxins and procoagulant mediators that damage endothelial cells and promote coagulation, thereby driving elevations in D-dimer compared with non-neoplastic conditions [35]. Elevated D-dimer has been associated with tumor burden and can independently predict poor prognosis in lung cancer, leukemia, and breast cancer [36,37,38]. This mechanistic link between tumor biology and hypercoagulation plausibly explains the incorporation of D-dimer in the diagnostic model.
These observations provide a clinical rationale for evaluating local and serum measurements together, although the present comparison cannot separate the contribution of fluid markers from that of the modeling method. LGB therefore remains a diagnostic candidate for evaluation alongside the simpler serum model. Its proposed role is adjunctive assessment after clinically indicated drainage, alongside cytology and clinical evaluation [39]. Choosing between these approaches for practice requires evidence on calibration, net benefit, and additional assay burden.
Taken together, the five parameters capture both the biological and clinical dimensions of MPE. While each marker holds individual diagnostic relevance, their integration within a machine learning framework substantially improves diagnostic accuracy. This underscores the superiority of data-driven, adaptive modeling over reliance on single biomarkers, offering a scalable and interpretable tool for precision clinical decision-making.
Limitations
This study has several limitations. First, it was a single-center retrospective analysis of hospitalized patients with pericardial effusion, which may limit the generalizability of the findings to other clinical settings and patient populations. Second, although the sample size was relatively modest, it enabled the identification of key predictors and the development of a diagnostic model; however, the model’s performance and robustness require further validation in larger, multicenter cohorts. Third, this study primarily evaluated the model’s diagnostic discrimination and did not directly assess its impact on diagnostic delays, clinical decision-making, management strategies, or patient outcomes. Therefore, the potential clinical utility of the model, including whether its implementation could facilitate earlier recognition of malignant pericardial effusion (MPE) or improve patient outcomes, remains to be established. Finally, prospective studies are needed to validate the model’s performance and clinical applicability in real-world practice and to determine whether its integration into clinical workflows can meaningfully improve diagnostic efficiency, inform clinical management, or ultimately benefit patients.
5. Conclusions
This study developed and validated an interpretable LightGBM (LGB)-based diagnostic model using routine clinical data to differentiate malignant from benign pericardial effusion. The model demonstrated promising diagnostic discrimination in the study cohort. By integrating five key predictors—LDH and CEA in pericardial effusion, serum CA125, serum D-dimer, and disease course—the model incorporates both biological and clinical information relevant to MPE. These findings suggest that the model may have potential as an interpretable and scalable tool to support the diagnostic assessment of pericardial effusion. Nevertheless, its ability to facilitate earlier diagnosis, influence clinical management, or improve patient outcomes has not yet been established. Further prospective, multicenter studies are warranted to validate its performance and assess its clinical utility before routine clinical implementation.
Supplementary Materials
The following supporting information can be downloaded at https://www.mdpi.com/article/10.3390/jcm15229012/s1, Figure S1. Calibration curves for six models in the internal test cohort (n = 88). Penalized cubic spline logistic fits are plotted over the central 95% range of predicted probabilities; the diagonal line represents perfect calibration. LGB, LightGBM; XGB, XGBoost; RF, random forest; ABC, AdaBoost; GLM, L2-penalized logistic regression with five predictors; GBC, gradient boosting classifier. Figure S2. Calibration plot for LightGBM in the internal test cohort (n = 88). The penalized cubic spline logistic fit is presented alongside a pointwise 95% bootstrap confidence band derived from 500 outcome-stratified resamples, plotted over the central 95% range of predicted probabilities. The diagonal line denotes perfect calibration. Table S1. Hyperparameter search spaces and tuning methods.
Author Contributions
Conceptualization, S.S. and Z.S.; Methodology, S.S., Z.S., M.Z., L.P., J.S. (Jing Song) and C.Z.; Software, S.S.; Validation, S.S.; Formal analysis, S.S., Z.S., M.Z., L.P., J.S. (Jing Song) and C.Z.; Investigation, S.S. and M.Z.; Data curation, M.Z., L.P., J.S. (Jing Song) and C.Z.; Writing—original draft, S.S. and Z.S.; Writing—review & editing, C.C. and J.S. (Junxian Song); Supervision, C.C., J.L. and J.S. (Junxian Song); Project administration, C.C., J.L. and J.S. (Junxian Song); Funding acquisition, J.S. (Junxian Song). All authors have read and agreed to the published version of the manuscript.
Institutional Review Board Statement
This study was approved by the Medical Ethics Committee of Peking University People’s Hospital and conducted in accordance with the Declaration of Helsinki (Approval No. 2026PHB525-001 and 8 July 2026 of approval).
Informed Consent Statement
Informed consent was obtained from all subjects involved in the study.
Data Availability Statement
The data presented in this study are available upon reasonable request from the corresponding authors. The data are not publicly available due to patient-privacy-related ethical restrictions.
Conflicts of Interest
The authors declare no conflicts of interest.
Funding Statement
This work was supported by the Capital’s Funds for Health Improvement and Research (2026-2-4087) and Peking University People’s Hospital Research and Development Funding (RDJ2022-18).
Footnotes
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
References
- 1.Chahine J., Shekhar S., Mahalwar G., Imazio M.M., Collier M.P., Klein M.A. Pericardial Involvement in Cancer. Am. J. Cardiol. 2021;145:151–159. doi: 10.1016/j.amjcard.2020.12.092. [DOI] [PubMed] [Google Scholar]
- 2.Burazor I., Imazio M., Markel G., Adler Y. Malignant pericardial effusion. Cardiology. 2013;124:224–232. doi: 10.1159/000348559. [DOI] [PubMed] [Google Scholar]
- 3.Takayama T., Okura Y., Okada Y., Honma K., Nashimoto A., Sato N., Minamino T. Characteristics of neoplastic cardiac tamponade and prognosis after pericardiocentesis: A single-center study of 113 consecutive cancer patients. Int. J. Clin. Oncol. 2015;20:872–877. doi: 10.1007/s10147-015-0794-7. [DOI] [PubMed] [Google Scholar]
- 4.Ghosh A.K., Crake T., Manisty C., Westwood M. Pericardial Disease in Cancer Patients. Curr. Treat. Options Cardiovasc Med. 2018;20:60. doi: 10.1007/s11936-018-0654-7. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 5.Karakousi T., Mudianto T., Lund A.W. Lymphatic vessels in the age of cancer immunotherapy. Nat. Rev. Cancer. 2024;24:363–381. doi: 10.1038/s41568-024-00681-y. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 6.Jiang X., Wang J., Deng X., Xiong F., Zhang S., Gong Z., Xiong W. The role of microenvironment in tumor angiogenesis. J. Exp. Clin. Cancer Res. 2020;39:204. doi: 10.1186/s13046-020-01709-5. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 7.Alerhand S., Adrian R.J., Long B., Avila M.J. Pericardial tamponade: A comprehensive emergency medicine and echocardiography review. Am. J. Emerg. Med. 2022;58:159–174. doi: 10.1016/j.ajem.2022.05.001. [DOI] [PubMed] [Google Scholar]
- 8.Rooper L.M., Ali S.Z., Olson M.T. A Minimum Volume of More Than 60 mL Is Necessary for Adequate Cytologic Diagnosis of Malignant Pericardial Effusions. Am. J. Clin. Pathol. 2016;145:101–106. doi: 10.1093/ajcp/aqv021. [DOI] [PubMed] [Google Scholar]
- 9.Gornik H.L., Gerhard-Herman M., Beckman J.A. Abnormal cytology predicts poor prognosis in cancer patients with pericardial effusion. J. Clin. Oncol. 2005;23:5211–5216. doi: 10.1200/jco.2005.00.745. [DOI] [PubMed] [Google Scholar]
- 10.Maniar K.M., Lassaren P., Rana A., Yao Y., Tewarie I.A., Gerstl J.V., Mekary R.A. Traditional Machine Learning Methods versus Deep Learning for Meningioma Classification, Grading, Outcome Prediction, and Segmentation: A Systematic Review and Meta-Analysis. World Neurosurg. 2023;179:e119–e134. doi: 10.1016/j.wneu.2023.08.023. [DOI] [PubMed] [Google Scholar]
- 11.Qi X., Wang S., Fang C., Jia J., Lin L., Yuan T. Machine learning and SHAP value interpretation for predicting comorbidity of cardiovascular disease and cancer with dietary antioxidants. Redox Biol. 2025;79:103470. doi: 10.1016/j.redox.2024.103470. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 12.Lazaros G., Vlachopoulos C., Lazarou E., Tsioufis K. New Approaches to Management of Pericardial Effusions. Curr. Cardiol. Rep. 2021;23:106. doi: 10.1007/s11886-021-01539-7. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 13.Mudra S.E., Rayes D., Kumar A.K., Li J.Z., Njus M., McGowan K., Klein A.L. Malignant Pericardial Effusion: A Systematic Review. CJC Open. 2024;6:967–972. doi: 10.1016/j.cjco.2024.05.003. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 14.Dragoescu E.A., Liu L. Pericardial fluid cytology: An analysis of 128 specimens over a 6-year period. Cancer Cytopathol. 2013;121:242–251. doi: 10.1002/cncy.21246. [DOI] [PubMed] [Google Scholar]
- 15.Karatolios K., Pankuweit S., Maisch B. Diagnostic value of biochemical biomarkers in malignant and non-malignant pericardial effusion. Heart Fail Rev. 2013;18:337–344. doi: 10.1007/s10741-012-9327-x. [DOI] [PubMed] [Google Scholar]
- 16.Szturmowicz M., Tomkowski W., Fijalkowska A., Burakowski J., Sakowicz A., Filipecki S. The role of carcinoembryonic antigen (CEA) and neuron-specific enolase (NSE) evaluation in pericardial fluid for the recognition of malignant pericarditis. Int. J. Biol. Markers. 1997;12:96–101. doi: 10.1177/172460089701200302. [DOI] [PubMed] [Google Scholar]
- 17.Koh K.K., Kim E.J., Cho C.H., Choi M.J., Cho S.K., Kim S.S., Kim J.M. Adenosine deaminase and carcinoembryonic antigen in pericardial effusion diagnosis, especially in suspected tuberculous pericarditis. Circulation. 1994;89:2728–2735. doi: 10.1161/01.cir.89.6.2728. [DOI] [PubMed] [Google Scholar]
- 18.Seo T., Ikeda Y., Onaka H., Hayashi T., Kawaguchi K., Kotake C., Kobayashi K. Usefulness of serum CA125 measurement for monitoring pericardial effusion. Jpn. Circ. J. 1993;57:489–494. doi: 10.1253/jcj.57.489. [DOI] [PubMed] [Google Scholar]
- 19.Szturmowicz M., Tomkowski W., Fijalkowska A., Kupis W., Cieślik A., Demkow U., Torbicki A. Diagnostic utility of CYFRA 21-1 and CEA assays in pericardial fluid for the recognition of neoplastic pericarditis. Int. J. Biol. Markers. 2005;20:43–49. doi: 10.5301/jbm.2008.318. [DOI] [PubMed] [Google Scholar]
- 20.Qian X., Pei J., Han C., Liang Z., Zhang G., Chen N., Shen D. A multimodal machine learning model for the stratification of breast cancer risk. Nat. BioMed Eng. 2025;9:356–370. doi: 10.1038/s41551-024-01302-7. [DOI] [PubMed] [Google Scholar]
- 21.Van Calster B., McLernon D.J., van Smeden M., Wynants L., Steyerberg E.W. Calibration: The Achilles heel of predictive analytics. BMC Med. 2019;17:230. doi: 10.1186/s12916-019-1466-7. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 22.Van Calster B., Collins G.S., Vickers A.J., Wynants L., Kerr K.F., Barreñada L., Steyerberg E.W. Evaluation of performance measures in predictive artificial intelligence models to support medical decisions: Overview and guidance. Lancet Digit. Health. 2025;7:100916. doi: 10.1016/j.landig.2025.100916. [DOI] [PubMed] [Google Scholar]
- 23.Van Calster B., Vickers A.J. Calibration of risk prediction models: Impact on decision-analytic performance. Med. Decis. Mak. 2015;35:162–169. [Google Scholar]
- 24.Jin X., Hu L., Fang M., Zheng Q., Yuan Y., Lu G., Li T. Development and validation a simple scoring system to identify malignant pericardial effusion. Front. Oncol. 2022;12:1012664. doi: 10.3389/fonc.2022.1012664. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 25.Hashinokuchi A., Haratake N., Takenaka T., Matsudo K., Nagano T., Watanabe K., Yoshizumi T. Clinical significance of the combination of preoperative SUVmax and CEA in patients with clinical stage IA lung adenocarcinoma. Thorac. Cancer. 2022;13:2624–2632. doi: 10.1111/1759-7714.14599. [DOI] [Google Scholar]
- 26.O’Hanlon D.M., Kerin M.J., Kent P., Maher D., Grimes H., Given H.F. An evaluation of preoperative CA 15-3 measurement in primary breast carcinoma. Br. J. Cancer. 1995;71:1288–1291. doi: 10.1038/bjc.1995.249. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 27.Uehara M., Kinoshita T., Hojo T., Akashi-Tanaka S., Iwamoto E., Fukutomi T. Long-term prognostic study of carcinoembryonic antigen (CEA) and carbohydrate antigen 15-3 (CA 15-3) in breast cancer. Int. J. Clin. Oncol. 2008;13:447–451. doi: 10.1007/s10147-008-0773-3. [DOI] [PubMed] [Google Scholar]
- 28.Buoro S., Tombetti E., Ceriotti F., Simon C., Cugola D., Seghezzi M., Brucato A. What is the normal composition of pericardial fluid? Heart. 2021;107:1584–1590. doi: 10.1136/heartjnl-2020-317966. [DOI] [PubMed] [Google Scholar]
- 29.Zhang X., Guo M., Fan J., Lv Z., Huang Q., Han J., Jin Y. Prognostic significance of serum LDH in small cell lung cancer: A systematic review with meta-analysis. Cancer Biomark. 2016;16:415–423. doi: 10.3233/cbm-160580. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 30.Hafiz M.G., Rahman M.M., Mannan M.A. Serum lactate dehydrogenase as a prognostic marker of childhood acute lymphoblastic leukemia. Mymensingh Med. J. 2008;17:169–173. [PubMed] [Google Scholar]
- 31.Maral S., Albayrak M., Dagdas S., Yıldız A., Yıldırım R., Oz M., Dilek I. Prognostic Value of Baseline Serum Lactate Dehydrogenase Level in Patients with Hairy Cell Leukemia. Clin. Lymphoma Myeloma Leuk. 2020;20:e616–e621. doi: 10.1016/j.clml.2020.04.005. [DOI] [PubMed] [Google Scholar]
- 32.Wu W., Miao L., Zhao L., Zhu Y., Mao J., Cai Z., Jia T. Prognostic value of lactate dehydrogenase, serum albumin and the lactate dehydrogenase/albumin ratio in patients with diffuse large B-cell lymphoma. Hematology. 2024;29:2293514. doi: 10.1080/16078454.2023.2293514. [DOI] [PubMed] [Google Scholar]
- 33.Wu L.H., Chen L., Wang Q.Y., Wang Y.T. Correlation between HRCT signs and levels of CA125, SCCA, and NSE for different pathological types of lung cancer. Eur. Rev. Med. Pharmacol. Sci. 2023;27:4162–4168. doi: 10.26355/eurrev_202305_32325. [DOI] [PubMed] [Google Scholar]
- 34.Falcao F., de Oliveira F., Da S.M., Sobral Filho D.C. Carbohydrate antigen 125: A promising tool for risk stratification in heart diseases. Biomark. Med. 2018;12:367–381. doi: 10.2217/bmm-2017-0452. [DOI] [PubMed] [Google Scholar]
- 35.Yu J., Li D., Lei D., Yuan F., Pei F., Zhang H., Wang Y. Tumor-Specific D-Dimer Concentration Ranges and Influencing Factors: A Cross-Sectional Study. PLoS ONE. 2016;11:e165390. doi: 10.1371/journal.pone.0165390. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 36.Ma M., Cao R., Wang W., Wang B., Yang Y., Huang Y., Ye L. The D-dimer level predicts the prognosis in patients with lung cancer: A systematic review and meta-analysis. J. Cardiothorac. Surg. 2021;16:243. doi: 10.1186/s13019-021-01618-4. [DOI] [Google Scholar]
- 37.Geng Y., Jian C., Yang S., Wu S., Zhou J., Li D. The Prognostic Value of D-Dimer in De Novo Acute Myeloid Leukemia. Am. J. Med. Sci. 2016;352:129–133. doi: 10.1016/j.amjms.2016.04.008. [DOI] [PubMed] [Google Scholar]
- 38.Alkhoder L., Salamoon M., Saifo M., Alwassouf S. D-dimer as a Predictive Biomarker of Response to Chemotherapy in Patients with Metastatic Breast Cancer. Biomark. Insights. 2024;19:865410096. doi: 10.1177/11772719241290704. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 39.Schulz-Menger J., Collini V., Gröschel J., Adler Y., Brucato A., Christian V., Imazio M. 2025 ESC Guidelines for the management of myocarditis and pericarditis. Eur. Heart J. 2025;46:3952–4041. doi: 10.1093/eurheartj/ehaf192. [DOI] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Supplementary Materials
Data Availability Statement
The data presented in this study are available upon reasonable request from the corresponding authors. The data are not publicly available due to patient-privacy-related ethical restrictions.
