Prediction of Postoperative Length of Stay in Patients with Hip Fracture: A Two-Stage Machine Learning Approach
Thanwa Kaewtha, Lak Papinwitchakul, Wichai Chattinnawat, Rungchat Chompu-inwai, Trasapong Thaiupathump, Woravut Kowatcharakul, Wimalin LaosiritawornObjectives: This study aimed to apply machine learning (ML) techniques to predict postoperative length of stay (LOS) in patients with hip fracture. Because LOS varies widely across individuals owing to complex clinical factors, accurate prediction remains challenging. To address this challenge, an enhanced two-stage approach was developed and compared with a conventional one-stage approach.Methods: Data from 3,118 surgically treated patients with hip fracture were extracted from a hospital information system. Demographic and perioperative variables were analyzed, and the dataset was divided into training and test sets at a 70:30 ratio. ML algorithms were applied using a two-stage modeling approach. In the first stage, a classification model categorized LOS as short stay or long stay. In the second stage, regression models predicted the number of hospital days within each group. Performance was evaluated using accuracy, precision, recall, and F1-score for classification and mean absolute error (MAE), root mean square error (RMSE), and mean relative error (MRE) for regression.Results: In the one-stage approach, the support vector machine model showed the lowest prediction error, with an MAE of 2.20, RMSE of 3.18, and MRE of 0.42. The two-stage approach, which integrated classification and regression, outperformed the onestage approach, achieving an MAE of 1.46, RMSE of 1.86, and MRE of 0.35.Conclusions: The two-stage approach outperformed the one-stage approach, suggesting that LOS stratification improves prediction accuracy. This improvement may help hospitals anticipate resource needs, plan postoperative care, and manage bed allocation more effectively.