ObjectiveTo explore the risk factors which affect the severity of acute pancreatitis by using machine learning algorithms. MethodsA retrospective review was conducted of medical records from 262 patients hospitalized for acute pancreatitis at the Second Affiliated Hospital of Zhengzhou University between October 2022 and February 2024. Patients were classified according to the revised edition Atlanta Classification into mild cases (n=146) and non-mild cases (n=116). LASSO analysis was employed to identify predictors for non-mild acute pancreatitis. Six machine learning algorithms, including extreme gradient boosting, random forest, logistic regression, decision tree, support vector machine, and K-nearest neighbors were integrated to construct predictive models. Model performance was evaluated by comparing the following metrics: area under the curve (AUC), sensitivity, specificity, accuracy, F1 score, calibration curves, and decision curves. ResultsThrough LASSO regression analysis, six feature variables, including heart rate, white blood cell count, neutrophil count, C-reactive protein, albumin, and calcium ion were selected to train and test machine learning models. Results showed that extreme gradient boosting achieved the highest AUC value of 0.93 on the test set, making it the optimal model. The sensitivity, specificity, accuracy, Brier score, and F1 score of the extreme gradient boosting model were 0.97, 0.70, 0.85, 0.108, and 0.84. ConclusionThe prediction model developed using extreme gradient boosting has high clinical utility value, helps to predict the severity of acute pancreatitis at an early stage and is valuable in guiding clinical decision-making.