Abstract
Background
Stroke-associated pneumonia (SAP) is a major cause of mortality following ischemic stroke (IS). However, existing predictive models for SAP often lack transparency and interpretability, limiting their clinical utility. This study aims to develop an interpretable Bayesian network (BN) model for predicting SAP in IS patients, focusing on enhancing both predictive accuracy and clinical interpretability.
Methods
This retrospective study included patients diagnosed with IS and admitted to the Second Affiliated Hospital of Nanchang University between January and December 2019. Clinical data collected within 48 h of admission and SAP occurrences within 7 days were analyzed. Dimensionality reduction was performed using Least Absolute Shrinkage and Selection Operator regression, while data imbalances were addressed using synthetic minority oversampling technique. A BN model was trained using a hill-climbing algorithm and compared to logistic regression, decision trees, deep neural networks, and existing risk-scoring systems. Decision curve analysis was used to assess clinical usefulness.
Results
Of the 1252 patients, 165 (13.18%) patients had SAP within 7 days of admission. The BN model identified age, risk of pressure injury (PI), National Institutes of Health Stroke Scale (NIHSS) score, and C-reactive protein (CRP) as significant prognostic factors. The BN model achieved an area under the curve of 0.85(95% CI: 0.78–0.92) on the test set, outperforming other models and demonstrating a greater net benefit in clinical decision-making.
Conclusions
Age, risk of PI, NIHSS score, and CRP are significant predictors of SAP in IS patients. The interpretable BN model demonstrates superior predictive performance and interpretability, suggesting its potential as an effective and interpretable tool for clinical decision support in SAP risk assessment.
Keywords
Introduction
Stroke is the second leading cause of death globally and a major cause of disability worldwide.1,2 Among the various complications following a stroke, stroke-associated pneumonia (SAP)—defined as a respiratory tract infection occurring within the first 7 days post-stroke 3 —represents one of the most prevalent and concerning, with incidence rates reported to range from 9.4% to 27.8%.4–7 SAP is associated with significantly increased mortality, prolonged hospitalization, and heightened healthcare costs.8–10 Consequently, the early identification of patients at high risk for SAP is crucial for optimizing care, justifying enhanced monitoring, and enabling the timely implementation of tailored prophylactic interventions.
Risk prediction scores play a pivotal role in managing stroke patients and improving overall outcomes. Several risk factors for SAP, including age, gender, hyperglycemia, dysphagia, stroke severity, and atrial fibrillation, have been identified in previous studies.11–13 Based on these factors, a number of predictive scoring systems, such as A2DS2 and ISAN, have been developed.14,15 However, the clinical utility and accuracy of these existing scoring systems for SAP remain debated, as they often fail to account for the complex interrelationships between risk factors. 16 Traditional predictive models, such as logistic regression, are also limited in their capacity to model the intricate dependencies between risk factors. 17 These models assume independent relationships between variables, which do not adequately reflect the complex, networked interactions that characterize many clinical phenomena.
In recent years, machine learning (ML) techniques have gained attention for their potential to enhance disease prediction. For example, Nelde et al. 18 developed a prognostic ML model for SAP risk in the acute phase of stroke, achieving promising predictive performance. Among the various ML algorithms, decision trees are particularly appealing due to their transparency and interpretability, making them suitable for clinical application. 19 On the other hand, deep neural networks, with their capacity to process large datasets, can provide highly accurate predictions, though they often lack the interpretability needed for clinical decision-making. 20
Bayesian networks (BNs), which employ directed acyclic graphs (DAGs) and conditional probability tables, offer a promising alternative to both traditional and ML-based models. 21 By modeling the conditional dependencies among variables, BNs allow for a nuanced understanding of the interactions between risk factors. This approach has been successfully applied in medical diagnosis, statistical decision-making, and predictive modeling, providing interpretable and clinically relevant insights into complex health conditions.22–24
Despite the development of various prediction methods for SAP, significant challenges persist in understanding the underlying relationships between risk factors and quantifying their individual contributions. Many existing models lack interpretability, hindering their clinical applicability. This study aims to address these limitations by constructing an interpretable BN model that not only identifies key risk factors for SAP but also predicts its occurrence in ischemic stroke (IS) patients. To evaluate the effectiveness of our approach, we perform a comparative analysis against two widely used interpretable models—traditional logistic regression, decision trees, and deep neural networks—along with existing risk-scoring systems. Furthermore, we assess the clinical utility of our BN model, demonstrating its potential for improving clinical decision-making over traditional risk models.
Methods
Study design and participants
This retrospective study utilized data extracted from the electronic medical record system of the Second Affiliated Hospital of Nanchang University, covering the period from January to December 2019. Patients included in the analysis were diagnosed with acute ischemic stroke (AIS) based on the criteria established by the Cerebrovascular Diseases Group of the Chinese Medical Association Neurology Society in 2014 25 and were admitted within 48 h of symptom onset. All patients were aged 18 years or older. The exclusion criteria were (1) clinical signs of infection upon admission; (2) a history of pulmonary infection, non-infectious pulmonary interstitial disease, pulmonary tuberculosis, lung tumor, pulmonary edema, pulmonary embolism, or atelectasis prior to the onset of IS; (3) incomplete clinical data.
Data collection
Data were collected upon hospital admission, including patient demographics (e.g. sex and age) and known risk factors for cerebrovascular disease, such as a prior stroke, hypertension, diabetes, atrial fibrillation, coronary heart disease, smoking, and alcohol consumption. Clinical variables included stroke severity, assessed using the National Institutes of Health Stroke Scale (NIHSS); functional status, measured by the Modified Rankin Scale; consciousness disturbance (DOC); and assessments using the Braden Scale, Glasgow Coma Scale (GCS), A2DS2 score, and ISAN score. Laboratory data were obtained within 24 h of admission through venous blood sampling. Key laboratory results encompassed a range of biomarkers, including white blood cell count, neutrophil count, lymphocyte count, neutrophil-to-lymphocyte ratio, red blood cell count, thrombocytocrit, hemoglobin, platelet count, plasma fibrinogen, total protein, albumin, albumin-to-globulin ratio, total cholesterol, triglycerides, high-density lipoprotein (HDL), low-density lipoprotein, non-HDL cholesterol, and C-reactive protein (CRP). This comprehensive dataset allows for a thorough analysis of the factors contributing to the risk of SAP in IS patients.
Outcome assessment
The primary outcome was the occurrence of hospitalized pneumonia within the first 7 days after admission. Pneumonia was diagnosed based on the 2019 Chinese Expert Consensus on the Diagnosis and Treatment of Stroke-Associated Pneumonia. 26 The clinical diagnostic criteria for SAP included: (1) at least one of the following: fever ≥38°C, leukopenia (≤4000 × 10⁹/L), leukocytosis (≥ 10,000 × 10⁹/L), age ≥70 years with altered consciousness; and (2) at least two of the following: newly emerged purulent sputum or increased respiratory secretion, newly emerged or aggravated cough/dyspnea/shortness of breath (respiratory rate >25/min), rales/crackles on lung auscultation, impaired gas exchange (e.g. hypoxemia with PaO₂/FiO₂ ≤ 300, increased oxygen demand), or chest imaging showing infiltrating shadows or progression of lung opacities.
Bayesian network modeling
The BN is a probabilistic graphical model that uses DAGs to describe the conditional dependencies between variables. 27 BNs provide a clear and intuitive representation of joint probability distributions, making them particularly useful for causal reasoning and risk prediction in medical contexts.28,29 The BN model was learned in two stages: (1) structural learning (identifying the network structure based on the data), and (2) parameter learning (estimating the conditional probability distributions for the nodes). 30 The model was trained using the hill-climbing algorithm, a score-based method that iteratively explores possible network structures by adding, deleting, or reversing arcs to maximize the model's score. 31 The performance of the BN model was validated using fivefold cross-validation, with the log-likelihood loss function used to evaluate model accuracy.
Risk-scoring systems
For comparison purposes, two established risk-scoring systems were used: the A2DS2 score, developed from the Berlin Stroke Register to predict pneumonia during stroke hospitalization, 14 and the ISAN score, derived from a national UK registry to predict pneumonia risk within the first 7 days of IS. 15 These systems were selected based on the variables available in the current dataset and their relevance to SAP prediction.
Model building and interpretation
The overall model-building process is illustrated in Figure 1. The dataset was randomly split into a training set (70% of the patients) and a test set (30%). To address missing data, we applied the missForest imputation algorithm in R. Since class imbalance is a common issue in medical datasets, we employed the synthetic minority oversampling technique (SMOTE) to balance the distribution of the target variable. 32 SMOTE generates new instances for the minority class by interpolating between nearby examples, thus improving model robustness without overfitting. 33 SMOTE was applied only to the training set to avoid data leakage. To reduce dimensionality, Least Absolute Shrinkage and Selection Operator (LASSO) regression was used. 34 In addition to the BN model, we also explored other statistical and ML algorithms, including logistic regression, decision trees, and a multilayer perceptron (deep neural network). The performance of these models was assessed using multiple evaluation metrics: area under the curve (AUC) with 95% confidence intervals, calibration curves, and decision curves. Decision curve analysis was used to evaluate clinical utility, with a higher net benefit indicating better clinical applicability. 35

Overall process of model building. BN: Bayesian network; DNN: deep neural networks.
Statistical analysis
Categorical variables were expressed as percentages. Differences between the SAP and non-SAP groups were assessed using Student's t-test (for normally distributed data), the Mann–Whitney U test (for non-normally distributed data), and chi-square or Fisher's exact test (for categorical variables). The bnlearn package was used to develop the BN model, while decision trees and deep neural networks were implemented using the party and keras packages in R. Model performance for decision trees and deep neural networks was evaluated using fivefold cross-validation to ensure robustness and prevent overfitting. All statistical tests were two-tailed, with significance set at a p-value of 0.05. Data were analyzed using R 4.3.1 (The R Foundation, Vienna, Austria).
Results
Baseline characteristics and potential risk factors for SAP
A total of 1252 patients were included in this study, comprising793 (63.34%) males and 459 (36.66%) females. Of these, 165(13.18%)patients developed SAP within 7 days of admission. The specific proportions of missing data for variables are summarized in the Table S1. Table 1 provides an overview of the baseline characteristics of the study cohort. Patients with SAP were older and exhibited a higher prevalence of risk factors. Statistically significant differences were observed in most laboratory results between patients with and without SAP. To identify significant prognostic factors, LASSO regression was employed for dimensionality reduction (Figure 2). After considering clinical relevance and the practical context of the study, we selected the following nine significant predictors: age, CRP levels, NIHSS score, GCS score, DOC, and Braden Scale score for risk of pressure injury (PI).

LASSO regression for dimensionality reduction. LASSO: Least Absolute Shrinkage and Selection Operator.
Baseline characteristics of the study population.
Pearson's Chi-squared test; Wilcoxon rank sum test; Fisher's exact test.
Abbreviations: COPD: chronic obstructive pulmonary disease; GCS: Glasgow Coma Scale; DOC: Disturbance of consciousness; NIHSS: National Institute of Health Stroke Scale; mRS: Modified Rankin Scale score; SAP: stroke-associated pneumonia.
Bayesian network structure of SAP assessment
The BN model, developed using the training set, showed no statistical difference in performance between training and test sets.
The final BN model consisted of seven nodes and 12 directed edges, emphasizing the importance of key variables such as age, CRP, NIHSS score, and Braden Scale score in directly influencing SAP risk. Indirect relationships were observed for GCS and DOC. Notably, age and CRP were found to influence SAP both directly and indirectly through their associations with NIHSS levels. The NIHSS score, in turn, influenced SAP both directly and via its connections with GCS and DOC. The BN structure is depicted in Figure 3.

The Bayesian network structure.
Our findings highlight the significant predictors of SAP in IS patients. The conditional probability distribution from the BN model indicates a 94% likelihood of SAP in patients with moderate stroke severity (NIHSS > 15), age over 65 years, elevated CRP levels, and moderate or higher risk of PI (Braden Scale score ≤ 14). These insights underscore the importance of early identification of high-risk patients, as detailed in Table 2. Early identification of high-risk patients for SAP allows clinicians to implement preventive measures such as feeding modification, oral care, airway management, and position management. 36
Conditional probabilities of the final Bayesian network.
Abbreviations: Barden score, The Braden Scale classifications were categorized according to the scores: no risk of pressure injury, 19 or higher; mild risk, 15 to 18; moderate risk, scores from 13 to 14; and high risk, scores 12 or lower; CRP: C-reactive protein; NIHSS: National Institute of Health Stroke Scale; SAP: stroke-associated pneumonia.
Model performance evaluation
The discrimination performance of the BN model, along with other predictive models—logistic regression, decision tree, deep neural network, and two existing risk-scoring systems (A2DS2 and ISAN scores)—is presented in Figure 4 and Table 3. In the test set, the BN model achieved an AUC of 0.85 (95% CI: 0.78–0.92), outperforming the A2DS2 and ISAN scores (AUC = 0.75 and 0.74, respectively), as well as the logistic regression, decision tree, and deep neural network models (AUC = 0.80, 0.75, and 0.76, respectively). Notably, the BN model demonstrated superior predictive performance, particularly in terms of accuracy and specificity. Figure 5 illustrates the relationship between the predicted risk of SAP derived from the BN model and the actual proportion of SAP observed in the training and test sets. A strong concordance between the predicted and observed risks was observed, indicating the model's reliable performance. The Brier scores for the BN model were 0.141 in the training set and 0.142 in the test set, suggesting good calibration in both datasets.

Receiver operating characteristic (ROC) curves. BN: Bayesian network; DNN: deep neural networks.

Calibration plots for the BN prediction models in training and test sets. BN: Bayesian network.
The performance of predictive models.
Comparison with BN model.
BN: Bayesian network; DNN: deep neural networks; AUC: area under the curve.
Figure 6 illustrates the decision curves for the BN model, A2DS2 score, and ISAN score across both the training and test sets. The BN model consistently outperforms the A2DS2 and ISAN scores, indicating a greater net benefit across the range of threshold probabilities. These findings suggest that the BN model provides superior clinical utility for SAP prediction and may support more effective intervention strategies.

Decision curve of the Bayesian network (BN) model, ISAN score and A2DS2 score.
Discussion
Given the increasing morbidity and mortality associated with SAP, early-stage prediction of SAP risk is crucial. In this study, we aimed to identify clinical and laboratory factors associated with SAP and to develop an interpretable BN model for assessing SAP risk. Our findings highlight the direct association of age, Braden score, NIHSS level, and CRP with SAP, while GCS and DOC showed indirect associations. Notably, the BN model demonstrated superior predictive robustness compared to two commonly used interpretable models (logistic regression and decision tree). Moreover, compared to traditional SAP prediction scores, including ISAN and A2DS2, the BN model showed a better net benefit, highlighting its clinical utility.
Our results are consistent with previous studies linking age to an increased risk of SAP in stroke patients. 37 Older age is linked to a higher risk of post-stroke pneumonia, 13 likely due to increased comorbidities and impaired swallowing function in older individuals. 38 As age increases, organ function and immunity decline, making the body more susceptible to infections, thereby increasing the risk of pulmonary infection. 37 This finding corroborates the importance of age in traditional SAP prediction models like ISAN and A2DS2, which highlight age as a key predictor of pneumonia risk.
In addition to age, the BN model identified elevated CRP levels as a critical risk factor for SAP. Stroke triggers an inflammatory response, potentially reducing immunity and increasing the risk of lung infections, thus exacerbating inflammatory and immune response disorders. These events can further elevate CRP levels, thereby increasing pneumonia risk. 16 Previous studies have indicated that elevated CRP levels are associated with the development of SAP. 39 The association between elevated CRP and the increased risk of SAP highlights the importance of monitoring inflammatory markers, such as CRP, to predict and intervene early in at-risk patients.
Furthermore, the severity of IS, as measured by the NIHSS score, was also a strong predictor of SAP. A higher NIHSS score is associated with more severe neurological deficits, which may lead to compromised respiratory function and reduced ability to clear respiratory secretions, thus increasing the risk of pneumonia. These findings are consistent with previous studies that report a correlation between stroke severity and the development of SAP. 40 In this context, incorporating NIHSS score into clinical practice as part of a risk assessment for SAP could help identify patients who need more intensive monitoring and preventive care.
PI risk, assessed via the Braden Scale, was another critical factor in predicting SAP. Stroke patients, particularly those who are bedridden or have impaired consciousness, are at higher risk of developing pressure injuries, which can compromise skin integrity and contribute to infections, including pneumonia. 41 Moreover, prolonged immobility associated with stroke can impair normal mucociliary clearance, facilitating bacterial colonization and increasing the risk of respiratory infections. 42 This finding suggests that assessing and managing PI risk early on may not only help prevent skin breakdown but also reduce the likelihood of SAP in stroke patients.
The psychological status of stroke patients, particularly depression, may influence the development of SAP. Depression has been identified as a risk factor for stroke, 43 and as a severe post-stroke complication, it adversely affects the prognosis of IS patients. 44 While our study did not include psychological indicators, existing research demonstrates that depression is commonly observed in stroke survivors. 45 Additionally, depression may influence immune function, 46 potentially increasing the risk of infections such as pneumonia. Incorporating psychological assessments into future studies could enhance stroke rehabilitation and improve long-term health outcomes.
One of the key strengths of the BN model is its interpretability, distinguishing itself from complex ML methods that rely on supplementary tools for explanation.47,48 By representing relationships through a graphical structure and conditional probability distributions, BN provides clear insights into the direct and mediated effects of risk factors on SAP.49–51 This interpretability is particularly valuable in clinical settings, where actionable and trustworthy insights are essential.
The BN model also provides a nuanced understanding of how variables interact. For example, age and CRP are both directly associated with SAP, but they also indirectly affect SAP risk through their relationship with NIHSS and the Braden score. This capability to model complex interdependencies among factors offers a more comprehensive view of the predictors of SAP, which is invaluable for decision-making in clinical practice.
This study had several limitations. Firstly, there was an imbalance in the number of patients with and without SAP, with a notably smaller sample size for patients exhibiting SAP. We used the SMOTE to balance the class sizes, which helped improve model performance. However, this technique may not fully eliminate class imbalance, and prior research has indicated that variability within the minority class may be underestimated, potentially degrading model generalizability. 52 To enhance the robustness of future studies, researchers should prioritize the use of balanced datasets that better reflect model performance in practical applications. Furthermore, combining SMOTE-based techniques, such as FLEX-SMOTE, 53 which adapts to diverse minority class distributions via density-guided synthetic sample generation, may further improve model performance. Secondly, due to data limitations, we were unable to compare the BN model with other widely used SAP prediction scales, such as the AIS-APS, which could provide a broader context for evaluating the model's performance. Future research should not only include comparisons with a wider range of existing models but also focus on improving the collection of relevant variables. By enhancing the comprehensiveness of variable data, future studies can adopt more robust methods for comparison to validate the BN model's superiority in predicting SAP. Third, the discretization of continuous variables for BN modeling may have resulted in a reduction of valuable predictive information. Future studies could explore alternative methodologies, such as Gaussian BNs or Conditional Gaussian BNs,54,55 which are better suited for integrating continuous variables. Such approaches could potentially enhance model performance, improving its overall predictive accuracy and precision. Finally, while the BN model demonstrated strong performance in the training and test sets, the findings are based on a single-center dataset, which may limit the results’ generalizability. Future research should include multi-center studies with diverse patient populations to assess the model's external validity, generalizability, and robustness across different clinical settings.
Conclusion
In conclusion, our study demonstrates that an interpretable BN model can effectively predict the risk of SAP in IS patients. The model's superior predictive performance, coupled with its ability to clarify the interdependencies between risk factors, offers a significant advantage over traditional statistical methods and ML approaches. By providing a more detailed understanding of SAP risk, the BN model could help clinicians identify high-risk patients early, enabling timely interventions and reducing the incidence of SAP. Future research should focus on external validation using multi-center datasets to assess the model's generalizability. Additionally, ongoing efforts to refine the BN model, incorporating more diverse variables and advanced techniques, will enhance its predictive accuracy and applicability across different clinical settings.
Footnotes
Ethical considerations
This retrospective study was approved by the Biomedical Research Ethics Committee of the Second Affiliated Hospital of Nanchang University (IRB approval number: 20240522) and received a waiver of informed consent due to the use of nonidentifiable data.
Author contributions/CRediT
JK contributed to the study conception and design. Material preparation, data collection and analysis were performed by YG and TL. The first draft of the manuscript was written by XL, JM and ZL; all authors commented on previous versions of the manuscript. All authors read and approved the final manuscript.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This study was supported by the National Natural Science Foundation of China (82360667,82160645) and Natural Science Foundation of Jiangxi Province (20212BAB206091).
Conflicting interests
The authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Data availability
The data that support the findings of this study are not publicly available. Anonymous data are available on reasonable request from the corresponding author.
