Title
Author
DOI
Article Type
Special Issue
Volume
Issue
1Emergency Department, West China Hospital, Sichuan University, 610041 Chengdu, Sichuan, China
2Laboratory of Emergency Medicine, West China Hospital, Sichuan University, 610041 Chengdu, Sichuan, China
3Disaster Medical Center, Sichuan University, 610041 Chengdu, Sichuan, China
4Department of Critical Care Medicine, Chengdu First People’s Hospital, 610016 Chengdu, Sichuan, China
*Corresponding Author(s):zhouywu@scu.edu.cn (Yiwu Zhou)
| History | Submitted: 01 November 2023 | Accepted: 27 December 2023 | Published: 08 July 2024 |
| Copyright: | ©2024 The Author(s). Published by MRE Press. |

Acute pancreatitis (AP) with sepsis is a severe and potentially fatal complication. Current predictive systems for identifying high-risk sepsis in AP patients often lack specificity and timeliness, resulting in delays in diagnosis and intervention. This study retrospectively collected data from emergency departments in three tertiary comprehensive hospitals to develop a machine learning (ML) model for the rapid identification of high-risk sepsis in patients with AP. Patients were randomly divided into training and testing datasets (7:3 ratio). In the training dataset, we employed 10 ML algorithms to analyze bedside parameters of patients with AP upon admission. The 10-fold cross-validation was used to find the best parameter and model. The model was then applied to the testing dataset without modifying the model parameters to obtain unbiased classification performance. The performance of the ML model was assessed using the receiver operating characteristic curve (ROC) and compared to scoring systems using the DeLong test. In this study, 771 AP patients were assessed. During hospitalization, 559 patients were diagnosed with sepsis within the first 24 hours, while 212 were not. A Random Forest (RF) model containing 8 features demonstrated the highest area under the curve (AUC) on the cross-validation dataset (AUC: 0.877, accuracy: 0.772), with the AUC of 0.947 and accuracy of 0.836 on the testing dataset. Compared to the Acute Physiology and Chronic Health Evaluation II (AUC 0.708), quick Sequential Organ Failure Assessment (AUC 0.672), and Bedside Index of Severity in Acute Pancreatitis (AUC 0.680), the RF model showed superior performance in predicting sepsis occurrence in patients with AP. This study constructed and validated ML models for the early prediction of sepsis in patients with AP. The RF model provides clinicians with a rapid and useful tool to guide the level of patient care and implement early intervention strategies.
Cite this article
Yiqin Xia, Lingjie Xu, Qiang Lai, Hongyu Long, Yiwu Zhou. Construction and validation of machine learning models based on bedside parameters for identifying sepsis in acute pancreatitis patients. Signa Vitae. 2024; 20(7): 60-68. doi: 10.22514/sv.2024.084
Acute pancreatitis (AP) is an inflammatory disease of the pancreas characterized by acute pancreatic inflammation and acinar cell damage. It is a common gastrointestinal emergency and can progress to severe acute pancreatitis (SAP), often involving systemic organ and systemic complications [1]. The global incidence is 30–40 cases per 100,000 population per year [2], and it continues to rise, although studies suggest rates are currently more stable in Asia [3]. 40% to 70% of patients will go on to experience secondary pancreatic infection and sepsis [4]. However, when SAP is complicated by sepsis, the mortality rate further increases to 50%~80% [5]. Early hospitalization or intensive care unit (ICU) treatment can improve outcomes in these patients [6]. Therefore, early identification and treatment are crucial in reducing the risk of sepsis-related mortality in patients with AP.
In clinical practice, a Sequential Organ Failure Assessment (SOFA) score ≥2 is used as the diagnostic criterion for sepsis, and a quick SOFA (qSOFA) score ≥2 is recommended for sepsis screening in outpatient, emergency, and general ward settings [7]. A systematic review/meta-analysis involving 121 studies and a total of 1,716,017 subjects showed that the qSOFA score predicts sepsis mortality more accurately than the Systemic Inflammatory Response Syndrome (SIRS) criteria, especially in terms of specificity [7]. However, this heightened specificity may come at the expense of reduced sensitivity [8]. Subsequent studies further demonstrated the limited efficacy of the qSOFA score in predicting sepsis and mortality [9, 10]. The Bedside Index of Severity in Acute Pancreatitis (BISAP) score is a clinical scoring system used to assess the prognosis of patients with AP and has good predictive ability for AP severity and mortality [11, 12]. However, its utility in identifying individuals at high risk for sepsis is not well supported. The Acute Physiology and Chronic Health Evaluation (APACHE) II scoring system includes multiple physiological and clinical parameters and requires extensive data collection and calculations, making it less convenient for use in everyday clinical practice. Additionally, the APACHE II score needs to be calculated within 24 hours of a patient’s admission, which may render it unsuitable for emergency situations or emergency department patients [13, 14]. In summary, tools for early sepsis screening and assessment face challenges in striking a balance between simplicity and accuracy, particularly in the context of emergency evaluations.
In recent years, artificial intelligence (AI)—based machine learning (ML) has thrived, sparking a technological revolution [15, 16], particularly in the healthcare domain. It has exhibited exceptional performance in predicting and managing complications [17]. A study published in Nature Communications indicates that utilizing AI algorithms for sepsis risk identification and diagnosis can improve the early detection rate of sepsis by 32% compared to clinical physicians [18]. Most existing studies leverage big data and ML techniques to identify individuals at high risk for severe acute pancreatitis (SAP) among patients, thereby offering more precise risk assessment and personalized treatment plans [19, 20]. Nevertheless, there is a limited number of studies that investigate sepsis complications in AP. Liu et al. [21] used early ICU data for AP, employing ML to detect sepsis complications, but it lacks timeliness for emergencies.
Therefore, in this study, we utilized bedside parameters of patients with AP to construct a ML model for the rapid identification of sepsis when patients first come into contact with the healthcare system, even at the emergency triage stage. This provides a fast and accurate tool for determining the level of care and early intervention strategies.
This was a multicenter retrospective cohort study. Patients diagnosed with AP according to the International Statistical Classification of Diseases and Related Health Problems 10th Revision (ICD-10), who sought medical attention at the Emergency Departments of West China Hospital, Sichuan University, Chengdu First People’s Hospital, and Chengdu Shangjin Nanfu Hospital between 01 January 2017, and 30 September 2019, were consecutively included in this study.
Patients who met the following inclusion criteria were included: (1) Aged ≥14 years old; (2) Met the 2012 revised Atlanta criteria for AP diagnosis [22]; and (3) Met the diagnostic criteria for Sepsis 3.0. Patients were excluded from the study if they met the following exclusion criteria: (1) Had chronic pancreatitis; (2) Had hematological disorders or terminal-stage malignant tumors; (3) Had AP caused by poisoning, trauma or postoperative injury; (4) Were pregnant or in the postpartum period; (5) Had cardiac arrest or were in the post-cardiac arrest syndrome (PCAS) phase at the time of arrival; (6) Had uncontrolled bleeding within the past 24 hours; (7) Had AP complicated by chronic diseases of the liver and kidney insufficiency; and (8) Had incomplete clinical data or a lack of follow-up information.
We retrospectively collected demographic information, data on vital signs, mental status, and medical history, laboratory test results, and imaging findings from the database of AP patients. Demographic data included information such as sex, age and disease duration. Vital signs at admission were recorded, including the temperature (T), heart rate (HR), respiratory rate (RR), systolic blood pressure (SBP), diastolic blood pressure (DBP), mean arterial pressure (MAP), peripheral oxygen saturation (SpO2), and Glasgow coma scale (GCS). Bedside arterial blood gas analysis results were obtained within 30 minutes of admission using the Cobas-b-123 system developed by Roche, which included measurements of pH, partial pressure of carbon dioxide (PCO2), partial pressure of oxygen (PO2), oxygenation index (OI), lactate (LAC), base excess (BE), bicarbonate (HCO3−), serum ionic calcium (CA2+), hematocrit (HCT), glucose (GLU), sodium ions (NA+), and potassium ions (K+). In addition, bedside ultrasound was performed upon admission to assess the presence of pleural effusion. We also calculated the admission qSOFA score, BISAP score, APACHE II score and SOFA score.
The research team maintained data quality through regular audits, double checks for inconsistencies, medical team validation, and dedicated follow-ups.
The outcome of the study was to predict the diagnosis of sepsis in patients with AP within 24 hours of admission. Follow-up was conducted to assess the worst SOFA score within 24 hours for patients with AP who had infection or suspected infection, and sepsis was diagnosed when the score was greater than or equal to 2.
Patients included in the study were randomly assigned to training and testing datasets (7:3 ratio). We utilized the widely used Feature Explorer (FAE, V 0.5.4) within Python (3.7.6) to develop our model in the training dataset and evaluate its performance in the testing dataset [23, 24, 25].
In the training dataset, we initially employed an upsampling technique to achieve a balanced distribution between positive and negative samples. Subsequently, we performed three types of normalization on the feature matrix: Min-Max, Z-score and Mean. Following that, dimensionality reduction was conducted using the principal component analysis (PCA) and Pearson correlation coefficient (PCC) methods. If the PCC between a pair of features exceeded 0.8, we eliminated one of them to reduce dimensionality and ensure feature independence. For feature selection, Kruskal-Wallis (KW), Analysis of Variance (ANOVA), Recursive Feature Elimination (RFE), and Relief methods were employed. For each feature vector, we calculated the L2 norm and divided it, effectively mapping the feature vector to a unit vector. Furthermore, ten ML classifiers were used to select features with optimal efficacy in distinguishing sepsis from non-sepsis, based on 10-fold cross-validation results. The ten ML classifiers included linear discriminant analysis (LDA), support vector machine (SVM), random forest (RF), autoencoder (AE), logistic regression using Lasso (LR Lasso), linear regression (LR), AdaBoost (AB), Gaussian process (GP), decision tree (DT), and naive Bayes (NB) classifiers. In this step, bootstrap sampling was employed to randomly sample the cross-validation dataset 1000 times, obtaining the average classification results. To select a simpler and more generalizable model, we adopted the “one-standard error” rule. Model performance was evaluated using the following metrics: Area Under the Receiver Operating Characteristic Curve (AUC), accuracy, sensitivity and specificity. Positive predictive value (PPV) and negative predictive value (NPV) were computed at an optimal cutoff value determined by maximizing the Youden index. Confidence intervals at the 95% level were estimated through bootstrapping sampling.
Finally, the testing dataset was used to test the generalizability of the results from the training dataset and to estimate unbiased classification accuracy without modification of the model parameters identified in the training dataset.
Conducted Delong test using MedCalc (version 22.021, MedCalc Software Ltd, Ostend, Belgium) to compare the performance of the ML model with scoring systems. A p value < 0.05 was considered statistically significant.
This study enrolled 802 adult patients with AP consecutively. Among them, 12 patients with stays under 24 hours requested transfer to their local hospital, 8 pregnant patients, 6 patients with terminal-stage malignant tumors, and 5 patients in the PCAS phase of AP were excluded. Finally, a total of 771 patients were included in the analysis. In the entire cohort, 482 patients were male and 289 patients were female, with an average age of 48.21 ± 14.76 years. During hospitalization, a total of 559 patients were diagnosed with sepsis within 24 hours, while 212 patients were not. We selected 539 patients for the training dataset (391/148 = positive/negative). We also selected 232 patients for the independent testing dataset (168/64 = positive/negative).
We observed that the RF model, based on Min-Max normalization, PCC and Relief feature selection (with 8 selected features) achieved the highest AUC for the cross-validation dataset. The AUC and accuracy reached 0.877 and 0.772, respectively. For the testing dataset, the AUC and accuracy of the model reached 0.947 and 0.836, respectively. The clinical statistics for predicting the occurrence of sepsis within 24 hours are shown in Table 1. The ROC curve is presented in Fig. 1. The contributions of features in the final model are illustrated in Fig. 1C. The importance ranking of the 8 selected features for RF model were as follows: the respiratory rate (RR), glucose (GLU), oxygenation index (OI), partial pressure of oxygen (PO2), temperature (T), heart rate (HR), lactate (LAC), and disease duration.
| Statistics | Value |
| Accuracy | 0.8362 |
| AUC | 0.9470 |
| AUC 95% CIs | 0.9208–0.9732 |
| NPV | 0.6444 |
| PPV | 0.9577 |
| Sensitivity | 0.8095 |
| Specificity | 0.9062 |
| Abbreviations: RF: random forest; AP: acute pancreatitis; AUC: area under the curve; NPV: negative predictive value; PPV: positive predictive value; CI: confidence interval. |

Fig. 1.Performance of models generated using MinMax, Pearson correlation coefficient (PCC) analyses, Relief, and Random forest (RF) algorithms. (A) Receiver operating characteristic (ROC) curves of this model on different datasets. (B) FeAture Explorer software suggested a candidate 8-feature model according to the “one-standard error” rule. (C) The contribution of features in the final model. AUC: area under the curve; CV: cross-validation; LAC: lactate; HR: heart rate; T: temperature; PO2: partial pressure of oxygen; OI: oxygenation index; GLU: glucose; RR: respiratory rate.
The AUCs of the cross-validation (CV) training, CV validation, training and test datasets, using four feature selection methods and two-dimensional reduction methods, were all above 0.800 when employing RF classifier (Fig. 2).

Fig. 2.Areas under the curve (AUCs) of the different datasets using Pearson correlation coefficient (PCC) and principal component analysis (PCA) methods and random forest (RF). (A) Analysis of variance (ANOVA), (B) Kruskal-Wallis (KW), (C) Relief, and (D) Recursive Feature Elimination (RFE). CV: cross-validation.
This study explored the impact of different feature selection methods on the performance of the prediction model. The results of this exploratory analysis showed that, using ANOVA feature selection, the AUCs of the CV training, CV validation, training and test datasets for the 10 ML classifiers were greater than 0.800, except for the DT classifier (Fig. 3A). Employing KW feature selection, the AUCs of the CV training, CV validation, training and test datasets for the 10 ML classifiers were greater than ~0.800, except for the AB classifier and DT classifier (Fig. 3B). Utilizing Relief feature selection, the AUCs of the CV training, CV validation, training and test datasets for the 10 ML classifiers were greater than ~0.800, except for the NB classifier and DT classifier (Fig. 3C). Using RFE feature selection, the AUCs of the CV training, CV validation, training and test datasets for the 10 ML classifiers were greater than ~0.800, except for the AE classifier and DT classifier (Fig. 3D). The performance of other ML models in predicting sepsis within 24 hours of admission in patients with AP is detailed in supplemental material (Supplementary Table 1). Our findings indicate that the developed models, incorporating four feature selection methods and the majority of classifiers, achieved moderate to high classification accuracy. The combination of the RF classifier with the aforementioned four feature selection methods achieved the highest AUC in both CV validation and test datasets. This suggests that the RF model may serve as a robust predictive model for identifying AP patients at high risk of sepsis.

Fig. 3.Areas under the curve (AUCs) of different datasets using 10 machine learning algorithms. Feature selections using (A) analysis of variance (ANOVA), (B) Kruskal-Wallis (KW), (C) Relief, and (D) Recursive Feature Elimination (RFE). CV: cross-validation; SVM: support vector machine; LDA: linear discriminant analysis; AE: autoencoder; RF: random forest; LR: linear regression; LR Lasso: logistic regression using Lasso; AB: AdaBoost; DT: decision tree; GP: Gaussian process; NB: naive Bayes.
In this study, we compared the efficacy of the RF model and scoring systems (qSOFA, APACHE II, BISAP) in predicting the occurrence of sepsis within 24 hours of admission in patients with AP using the testing dataset. The results indicate that the predictive efficacy of the RF model is superior to that of the scoring systems (Table 2). The ROC curve comparison between RF model and scoring systems is shown in Fig. 4. The results of pairwise comparisons of the AUC curves between the RF model, qSOFA, APACHE II, and BISAP are detailed in supplemental material (Supplementary Table 2).
| Prediction Model | AUROC | 95% CI | p |
| RF model | 0.947 | 0.910–0.972 | <0.001 |
| qSOFA | 0.672 | 0.608–0.732 | <0.001 |
| APACHE II | 0.708 | 0.645–0.768 | <0.001 |
| BISAP | 0.680 | 0.618–0.739 | <0.001 |
| Abbreviations: RF: random forests; qSOFA: quick Sequential Organ Failure Assessment; APACHE II: Acute Physiology and Chronic Health Evaluation II; BISAP: Bedside Index for Severity in Acute Pancreatitis; AUROC: area under the receiver operating characteristic curve; CI: confidence interval. |

Fig. 4.The ROC curve comparison between RF model and scoring systems. APACHE II: Acute Physiology and Chronic Health Evaluation II; BISAP: Bedside Index for Severity in Acute Pancreatitis; RF: random forests; qSOFA: quick Sequential Organ Failure Assessment; AUC: area under the curve; CI: confidence interval.
This study utilized bedside parameters obtained within the initial 30 minutes after admission from patients with AP to construct and validate ML models predicting the risk of sepsis within the first 24 hours after hospital admission. Through different feature selection methods and model construction, we found that the RF model, which combines Min–Max normalization with the PCC and Relief feature selection, was one of the best-performing models. For the validation dataset, this model achieved an AUC of 0.877 and an accuracy of 0.772, while for the testing dataset, the AUC and accuracy reached 0.947 and 0.836, respectively. The model utilizes only the physiological parameters at the time of admission, combined with bedside rapid arterial blood gas analysis indicators, which can identify and predict patients at high risk for sepsis within 24 hours of admission.
The RF algorithm is an ensemble learning method that reduces the risk of overfitting individual decision trees by combining the results of multiple decision trees. It also demonstrates robustness to noise and outliers since it is less susceptible to the influence of individual data points [26]. Furthermore, the RF algorithm can estimate the importance of each feature, aiding in the identification of features with the greatest impact on model performance. A study of non-ICU hospitalized patients developed and validated an RF classifier using demographic characteristics, vital signs, and laboratory results to predict the occurrence of severe sepsis and septic shock. While the classifier had relatively low sensitivity, it exhibited high specificity, enabling the early identification of patients at high risk of sepsis [27]. Another study of hospitalized ICU patients similarly achieved early sepsis prediction using the RF classifier [28]. In addition, we extensively compared various feature selection methods in this study, including ANOVA, KW, Relief, and RFE feature selection, to determine which method best suited the data. In this regard, the RF model achieved the highest AUC compared to other models, consistently achieving AUCs above 0.800 for cross-validation training and validation datasets, as well as training and testing datasets. This further confirms the effectiveness of the RF classifier.
The RF model generated 8 key features, ranked in order of importance as follows: RR, GLU, OI, PO2, T, HR, LAC, and disease duration. This indicates the significant role of the mentioned indicators in identifying sepsis risk in AP patients.
First, patients with AP complicated by sepsis often exhibit SIRS. This is primarily characterized by tachypnea, where the respiratory rate typically increases to meet the elevated oxygen demands of the tissues. A retrospective analysis of 148,907 patients with suspected infection in 2015 found that a respiratory rate of ≥22 breaths per minute was a valuable predictor of sepsis occurrence [29]. In another study that used a ML algorithm to predict high-risk SAP patients, the most influential feature was the respiratory rate, which is highly consistent with the results of this study [30].
Second, AP can lead to hyperglycemia, as it impairs insulin secretion, thereby affecting blood glucose regulation. On the one hand, during the progression of AP, elevated glucose levels can promote the release of inflammatory cytokines, concurrently affecting the phagocytic and bactericidal functions of immune cells and leading to a reduced immune response, making it a high-risk factor for sepsis [31, 32]. On the other hand, sepsis typically accompanies a systemic inflammatory response, resulting in enhanced insulin resistance and causing stress-induced hyperglycemia, thus creating a vicious cycle. Furthermore, the hyperglycemic environment provides an ideal breeding ground for pathogenic microorganisms, potentially increasing the likelihood of drug-resistant strains, making it challenging to control the primary infection and consequently increasing the risk of patient mortality [33].
Third, both the OI and PO2 reflect a patient’s lung function and oxygenation status. PO2 is a direct physiological parameter commonly used for general oxygenation assessment. In contrast, the OI is a composite index that provides more comprehensive information and is particularly suitable for evaluating critically ill patients requiring respiratory support. As previously mentioned, patients with AP complicated by sepsis often exhibit SIRS, with the lungs being one of the first affected organs, resulting in reduced OI and PO2 values. Research has confirmed a close correlation between the ratio of partial pressure arterial oxygen and fraction of inspired oxygen (PaO2/FiO2) and the severity of sepsis [34].
Fourth, fever is a typical immune system response to infection [35]. Previous studies have shown that body temperature is a predictor of sepsis in AP patients [36]. Prolonged high fever or low body temperature may indicate a high-risk state for septic shock [37]. A study using a gradient tree boosting ML algorithm to predict septic shock also confirmed the importance of indicators such as the heart rate, the respiratory rate, body temperature, and oxygen saturation in the early identification of sepsis or septic shock [38].
Fifth, elevated lactate levels reflect cellular dysfunction in sepsis patients [39]. High lactate levels are typically associated with the severity and poor prognosis of sepsis, and monitoring lactate levels aids in the early identification of sepsis [40, 41, 42].
Finally, the course of AP can be divided into early (onset ≤2 weeks) and late stages (onset >2 weeks), corresponding to two peaks of mortality, with some overlap between the two stages. The main cause of the second peak in mortality is sepsis resulting from pancreatic and peripancreatic infections, with bacterial translocation as the primary mechanism [43, 44]. Therefore, the identification of sepsis is also related to the duration of the disease.
Comparing the performance of the RF model with the qSOFA, APACHE II and BISAP scoring systems, we found that the RF model significantly outperformed the traditional scoring systems. This further emphasizes the potential advantages of the RF model in the early identification of patients with AP complicated by sepsis, enabling physicians to triage these patients to the intensive care unit early, thus improving their treatment and prognosis. Additionally, this study provides valuable insights for future applications of ML in sepsis research.
Firstly, while this was a multicenter retrospective cohort study, approximately 70% of the data came from a single hospital, which represents a relatively homogeneous study population. Despite our efforts to minimize the effects, some selection bias is inevitable.
Secondly, this study only included data from patients in the emergency departments of the three hospitals, which may limit the external generalizability of the model and requires validation in a broader health care environment.
Thirdly, the proportion of patients with AP complicated by sepsis in this study was relatively high [45]. This may be attributed to West China Hospital of Sichuan University serving as a national-level center for the diagnosis and treatment of difficult and critically ill patients in western China, where it often receives critically ill patients transferred from other hospitals.
Fourthly, although the ML models used in this study showed excellent performance in early sepsis recognition, they cannot yet fully replace traditional clinical scoring systems. In clinical practice, physicians still need to combine ML models with clinical judgment to make decisions.
Lastly, to enhance the clinical application of our results, we employed classic and widely used RF classifier. Future research could explore integrating advanced models or employing deep learning approaches to enhance sepsis identification accuracy in AP patients, aiming to advance the field with a more forward-looking and innovative perspective.
This study constructed and validated ML models for the early prediction of sepsis in patients with AP in the emergency department. The RF model, which relies on 8 predictive factors, outperformed traditional scoring systems. This predictive model provides clinicians with a rapid and useful tool to guide the level of patient care and implement early intervention strategies.
The original contributions generated for the study are included in the article/supplementary material, and further inquiries can be directed to the corresponding authors.
YQX—conceived the study design, analyzed and interpreted the data, and drafted the manuscript. LJX—provided help and advice on study progression. QL and HYL—contributed to collecting the data and substantially interpreting the data. YWZ—participated in the design of the study and helped to revise the manuscript. All the authors have read and approved the final manuscript.
The study underwent a thorough ethical review and obtained approval from the Ethics Committee at Sichuan University West China Hospital (No. 2019-334), which also oversees ethical matters at Chengdu Shangjin Nanfu Hospital. Additionally, approval was obtained from the Ethics Committee of Chengdu First People’s Hospital (No. 2020-048). Patient consent for informed participation was not sought, but the research maintained rigorous safeguards for the confidentiality of individual patient information throughout the study.
We would like to thank Fei Zhu for her significant contribution to the statistical analysis and all the volunteers and data collectors involved in this study.
This study was supported by the Funds of Technology Department of Sichuan Provincial (No. 2023YFS0242).
The authors declare no conflict of interest. Yiwu Zhou is serving as one of the Editorial Board members of this journal. We declare that Yiwu Zhou had no involvement in the peer review of this article and has no access to information regarding its peer review. Full responsibility for the editorial process for this article was delegated to OK.
Supplementary material associated with this article can be found, in the online version, at https://oss.signavitae.com/mre-signavitae/article/1810196680309391360/attachment/Supplementary%20material.doc.