Liver, Pancreas and Biliary Tract| Volume 55, ISSUE 3, P387-393, March 2023

Machine learning for the prediction of post-ERCP pancreatitis risk: A proof-of-concept study

Published:November 04, 2022DOI:



      Predicting Post-Endoscopic Retrograde Cholangiopancreatography (ERCP) pancreatitis (PEP) risk can be determinant in reducing its incidence and managing patients appropriately, however studies conducted thus far have identified single-risk factors with standard statistical approaches and limited accuracy.


      To build and evaluate performances of machine learning (ML) models to predict PEP probability and identify relevant features.


      A proof-of-concept study was performed on ML application on an international, multicenter, prospective cohort of ERCP patients. Data were split in training and test set, models used were gradient boosting (GB) and logistic regression (LR). A 10-split random cross-validation (CV) was applied on the training set to optimize parameters to obtain the best mean Area Under Curve (AUC). The model was re-trained on the whole training set with the best parameters and applied on test set. Shapley-Additive-exPlanation (SHAP) approach was applied to break down the model and clarify features impact.


      One thousand one hundred and fifty patients were included, 6.1% developed PEP. GB model outperformed LR with AUC in CV of 0.7 vs 0.585 (p-value=0.012). GB AUC in test was 0.671. Most relevant features for PEP prediction were: bilirubin, age, body mass index, procedure time, previous sphincterotomy, alcohol units/day, cannulation attempts, gender, gallstones, use of Ringer's solution and periprocedural NSAIDs.


      In PEP prediction, GB significantly outperformed LR model and identified new clinical features relevant for the risk, most being pre-procedural.


      To read this article in full you will need to make a payment

      Purchase one-time access:

      Academic & Personal: 24 hour online accessCorporate R&D Professionals: 24 hour online access
      One-time access price info
      • For academic or personal research use, select 'Academic and Personal'
      • For corporate R&D use, select 'Corporate R&D Professionals'


      Subscribe to Digestive and Liver Disease
      Already a print subscriber? Claim online access
      Already an online subscriber? Sign in
      Institutional Access: Sign in to ScienceDirect


        • Dumonceau J.M.
        • Kapral C.
        • Aabakken L.
        • et al.
        ERCP-related adverse events: European Society of Gastrointestinal Endoscopy (ESGE) Guideline.
        Endoscopy. 2020; 52: 127-149
        • Standards of Practice Committee A.S.G.E.
        • Chandrasekhara V.
        • Khashab M.A.
        • et al.
        Adverse events associated with ERCP.
        Gastrointest Endosc. 2017; 85: 32-47
        • Dubravcsik Z.
        • Hritz I.
        • Szepes A.
        • et al.
        Risk factors of post-ERCP pancreatitis in high-risk patients despite prevention with prophylactic pancreatic stents.
        Scand J Gastroenterol. 2020; 55: 95-99
        • Lyu Y.
        • Cheng Y.
        • Wang B.
        • et al.
        What is impact of nonsteroidal anti-inflammatory drugs in the prevention of post-endoscopic retrograde cholangiopancreatography pancreatitis: a meta-analysis of randomized controlled trials.
        BMC Gastroenterol. 2018; 18: 106
        • Radadiya D.
        • Devani K.
        • Arora S.
        • et al.
        Peri-Procedural Aggressive Hydration for Post Endoscopic Retrograde Cholangiopancreatography (ERCP) Pancreatitis Prophylaxsis: meta-analysis of Randomized Controlled Trials.
        Pancreatology. 2019; 19: 819-827
        • Tomoda T.
        • Kato H.
        • Ueki T.
        • et al.
        Combination of Diclofenac and Sublingual Nitrates Is Superior to Diclofenac Alone in Preventing Pancreatitis After Endoscopic Retrograde Cholangiopancreatography.
        Gastroenterology. 2019; 156 (e1): 1753-1760
        • Zhang Z.
        • Zhao Y.
        • Canes A.
        • et al.
        written on behalf of AME Big-Data Clinical Trial Collaborative Group. Predictive analytics with gradient boosting in clinical medicine.
        Ann Transl Med. 2019; 7: 152
        • Friedman J.H.
        Greedy function approximation: a gradient boosting machine.
        Ann Stat. 2001; 29: 1189-1232
      1. Available from: Accessed 31/08/2021

        • Lundberg S.M.
        • Erion G.
        • Chen H.
        • et al.
        From Local Explanations to Global Understanding with Explainable AI for Trees.
        Nat Mach Intell. 2020; 2: 56-67
        • Lundberg S.M.
        • Nair B.
        • Vavilala M.S.
        • et al.
        Explainable machine-learning predictions for the prevention of hypoxaemia during surgery.
        Nat Biomed Eng. 2018; 2: 749-760
        • Korpela T.
        • Cárdenas-Jaén K.
        • Archibugi L.
        • et al.
        Chronic use of statins and risk of post-ERCP acute pancreatitis (STARK): study protocol for an international multicenter prospective cohort study.
        Dig Liver Dis. 2018; 50: 1362-1365
        • Cárdenas-Jaén K.
        • Archibugi L.
        • Poropat G.
        • et al.
        Chronic use of statins and acetylsalicylic acid and incidence of post-endoscopic retrograde cholangiopancreatography acute pancreatitis: a multicenter, prospective, cohort study.
        Dig Endosc. 2020;
        • Banks P.A.
        • Bollen T.L.
        • Dervenis C.
        • et al.
        Classification of acute pancreatitis–2012: revision of the Atlanta classification and definitions by international consensus.
        Gut. 2013; 62: 102-111
      2. Available from: Accessed 10/12/2020

        • Pedregosa F.
        • Varoquaux G.
        • Gramfort A.
        • et al.
        Scikit-learn: machine Learning in Python.
        JMLR. 2011; 12: 2825-2830
        • Buitinck L.
        • Louppe G.
        • Blondel M.
        • et al.
        API design for machine learning software: experiences from the scikit-learn project.
        ECML PKDD. 2013; (Available from) (Accessed 2020 December 10th)
        • Rivera S.C.
        • Liu X.
        • Chan A.W.
        • SPIRIT-AI and CONSORT-AI Working Group
        • et al.
        Guidelines for clinical trial protocols for interventions involving artificial intelligence: the SPIRIT-AI Extension.
        BMJ. 2020; 370: m3210
        • Bossuyt P.M.
        • Reitsma J.B.
        • Bruns D.E.
        • et al.
        STARD 2015: an Updated List of Essential Items for Reporting Diagnostic Accuracy Studies.
        Radiology. 2015; 277: 826-832
        • DiMagno M.J.
        • Spaete J.P.
        • Ballard D.D.
        • et al.
        Risk models for post-endoscopic retrograde cholangiopancreatography pancreatitis (PEP): smoking and chronic liver disease are predictors of protection against PEP.
        Pancreas. 2013; 42: 996-1003
        • Jeurnink S.M.
        • Siersema P.D.
        • Steyerberg E.W.
        • et al.
        Predictors of complications after endoscopic retrograde cholangiopancreatography: a prognostic model for early discharge.
        Surg Endosc. 2011; 25: 2892-2900
        • Friedland S.
        • Soetikno R.M.
        • Vandervoort J.
        • et al.
        Bedside scoring system to predict the risk of developing pancreatitis following ERCP.
        Endoscopy. 2002; 34: 483-488
        • Kamal A.
        • Akshintala V.S.
        • Elmunzer B.J.
        • et al.
        Development and validation of a risk stratification score for post-endoscopic retrograde cholangiopancreatography (ERCP) pancreatitis.
        GIE. 2018; 87: AB573
        • Beam A.L.
        • Kohane I.S.
        Big data and machine learning in health care.
        JAMA. 2018; 319: 1317e8
        • Deenadayalu V.P.
        • Blaut U.
        • Watkins J.L.
        • et al.
        Does obesity confer an increased risk and/or more severe course of post-ERCP pancreatitis?: a retrospective, multicenter study.
        J Clin Gastroenterol. 2008; 42: 1103-1109
        • Fujisawa T.
        • Kagawa K.
        • Hisatomi K.
        • et al.
        Obesity with abundant subcutaneous adipose tissue increases the risk of post-ERCP pancreatitis.
        J Gastroenterol. 2016; 51: 931-938
        • Abdelfatah M.M.
        • Koutlas N.J.
        • Gochanour E.
        • et al.
        Impact of body mass index on the incidence and severity of post-endoscopic retrograde cholangiopancreatography pancreatitis.
        Ann Gastroenterol. 2019; 32: 298-302
        • Löhr J.M.
        • Dominguez-Munoz E.
        • Rosendahl J.
        • et al.
        United European Gastroenterology evidence-based guidelines for the diagnosis and therapy of chronic pancreatitis (HaPanEU). United.
        European Gastroenterol J. 2017; 5: 153-199
        • Zhao Z.H.
        • Hu L.H.
        • Ren H.B.
        • et al.
        Incidence and risk factors for post-ERCP pancreatitis in chronic pancreatitis.
        Gastrointest Endosc. 2017; 86 (e1): 519-524
        • de Miguel-Yanes J.M.
        • García-Cano J.
        • Jiménez-García R.
        • et al.
        Post-ERCP pancreatitis in patients with type 2 diabetes mellitus.
        Gastrointest Endosc. 2018; 87: 321
        • Li S.
        • Cao G.
        • Chen X.
        • et al.
        Low-dose heparin in the prevention of post endoscopic retrograde cholangiopancreatography pancreatitis: a systematic review and meta-analysis.
        Eur J Gastroenterol Hepatol. 2012; 24: 477-481
        • de-Madaria E.
        • Herrera-Marante I.
        • González-Camacho V.
        • et al.
        Fluid resuscitation with lactated Ringer's solution vs normal saline in acute pancreatitis: a triple-blind, randomized, controlled trial.
        United European Gastroenterol J. 2018; 6: 63-72
        • Qiu Q.
        • Nian Y.J.
        • Guo Y.
        • et al.
        Development and validation of three machine-learning models for predicting multiple organ failure in moderately severe and severe acute pancreatitis.
        BMC Gastroenterol. 2019; 19: 118
        • Qiu Q.
        • Nian Y.J.
        • Tang L.
        • et al.
        Artificial neural networks accurately predict intra-abdominal infection in moderately severe and severe acute pancreatitis.
        J Dig Dis. 2019; 20: 486-494
        • Fei Y.
        • Hu J.
        • Gao K.
        • et al.
        Predicting risk for portal vein thrombosis in acute pancreatitis patients: a comparison of radical basis function artificial neural network and logistic regression models.
        J Crit Care. 2017; 39: 115-123
        • Fei Y.
        • Gao K.
        • Li W.Q.
        Prediction and evaluation of the severity of acute respiratory distress syndrome following severe acute pancreatitis using an artificial neural network algorithm model.
        HPB (Oxford). 2019; 21: 891-897
        • van den Heever M.
        • Mittal A.
        • Haydock M.
        • et al.
        The use of intelligent database systems in acute pancreatitis–a systematic review.
        Pancreatology. 2014; 14: 9-16
        • Kui B.
        • Pintér J.
        • Molontay R.
        • et al.
        EASY-APP: an artificial intelligence model and application for early and easy prediction of severity in acute pancreatitis.
        Clin Transl Med. 2022; 12: e842
        • Kiss S.
        • Pintér J.
        • Molontay R.
        • et al.
        Early prediction of acute necrotizing pancreatitis by artificial intelligence: a prospective cohort-analysis of 2387 cases.
        Sci Rep. 2022; 12: 7827
        • Christodoulou E.
        • Ma J.
        • Collins G.S.
        • et al.
        A systematic review shows no performance benefit of machine learning over logistic regression for clinical prediction models.
        J Clin Epidemiol. 2019; 110: 12-22
        • Schürmann C.
        • Sieben W.
        Differences in surrogate threshold effect estimates between original and simplified correlation-based validation approaches.
        Stat Med. 2016; 35: 1049e62