DOI: 10.3390/app16199435 ISSN: 2076-3417

Explainable Gradient Boosting Machine Learning for Predicting Early Functional Recovery and Hospital Discharge After Hip and Knee Arthroplasty

Mattia Morri, Monica Guberti, Laura Verzellesi, Valeria Trojani, Laura Tornatore, Marco Bertolini, Debora Raffa, Mauro Iori

This study aimed to develop and comprehensively evaluate machine learning models based on gradient boosting decision trees for predicting early stair-climbing recovery and prolonged length of stay (LOS > 5 postoperative days) using routinely available clinical data. A retrospective cohort study was conducted on 630 patients undergoing primary hip or knee arthroplasty. Candidate predictors were predefined according to the literature and multidisciplinary clinical expertise. CatBoost models were developed using stratified training, validation, and test datasets, with Bayesian hyperparameter optimization. Model performance was assessed through discrimination, calibration, explainability using SHAP (Shapley Additive Explanations), and clinical utility using Decision Curve Analysis. Early stair-climbing recovery within four postoperative days was achieved by 40.0% of patients, while 32.5% were discharged within five days. On the independent test set, the model predicting early functional recovery achieved an AUC of 0.759 (95% CI: 0.670–0.815) while the prolonged stay model achieved an AUC of 0.761 (95% CI: 0.666–0.830). Age consistently represented the most influential predictor for both outcomes, followed by relevant clinical and perioperative factors, including ASA score, type of surgery, preoperative hemoglobin, postoperative pain, and orthostatic intolerance. Calibration assessment showed moderate agreement between predicted and observed probabilities, highlighting areas for future model refinement, while Decision Curve Analysis demonstrated a positive net clinical benefit across clinically relevant probability thresholds. These findings indicate that gradient boosting models based on routinely collected clinical variables can provide interpretable and clinically useful predictions to support individualized rehabilitation planning and discharge management after lower-limb arthroplasty.