Abstract:Objective To construct and validate a prediction model for urosepsis in patients after upper urinary tract stone surgery using various machine learning algorithms. Methods A total of 7 464 upper urinary tract stone patients who underwent surgery at the Sixth Affiliated Hospital of Guangxi Medical University from Jun. 2018 to Jun. 2023 were enrolled and randomly assigned to training (5 224 cases) or validation sets (2 240 cases) at a ratio of 7∶3. Among them, 622 (8.33%) cases developed urosepsis postoperatively. Six machine learning algorithms, including extreme gradient boosting (XGBoost), logistic regression, light gradient boosting machine (LightGBM), random forest (RF), adaptive boosting (AdaBoost), and gradient boosting decision tree (GBDT), were used to construct prediction models for postoperative urosepsis. The model’s predictive ability and clinical benefits were evaluated using receiver operating characteristic (ROC) curves, Shapley additive explanation (SHAP) analysis, calibration curves, and decision curve analysis (DCA). Results The clinical features included body mass index (BMI), number of surgeries, heart rate, Barthel index, venous thrombo embolism (VTE) risk assessment, gender, American Society of Anesthesiologists (ASA) grade, urinary nitrite, and urinary leukocyte in the models. In the training set, the XGBoost, LightGBM, and RF models performed excellently, with area under curve (AUC) values of ROC curves reaching 1.00. In the validation set, the logistic regression model performed the best, with an AUC value of ROC curve of 0.76, showing good predictive stability and calibration. The AdaBoost and GBDT models followed with AUC values of 0.74 and 0.75, respectively, while the AUC values of the LightGBM, XGBoost, and RF models were 0.71, 0.70, and 0.68. In terms of model interpretability, SHAP analysis showed the contribution of variables in a descending order as: heart rate, urinary leukocytes, gender, BMI, Barthel index, VTE risk assessment, urinary nitrite, number of surgeries, and ASA grade. Conclusion A logistic regression model for early risk prediction of postoperative urosepsis in upper urinary tract stone patients has been successfully constructed. This model has good predictive performance and calibration, and can effectively assist clinical diagnosis.