top of page
  • OPT Group

Machine learning using preoperative patient factors can predict duration of surgery and length of stay for total knee arthroplasty


Background: Total knee arthroplasty (TKA) is one of the most resource-intensive, high-volume surgical procedures. Two drivers of the cost of TKAs are duration of surgery (DOS) and postoperative inpatient length of stay (LOS). The ability to predict TKA DOS and LOS has substantial implications for hospital finances, scheduling, and resource allocation. The goal of this study was to predict DOS and LOS for elective unilateral TKAs using machine learning models (MLMs) based on preoperative factors.

Methods: The American College of Surgeons (ACS) National Surgical and Quality Improvement (NSQIP) database was queried for unilateral TKAs from 2014 to 2019. The dataset was split into training, validation, and testing based on year. Models (linear, tree-based, and multilayer perceptron (MLP)) were fitted to the training set in scikit-learn and PyTorch, with hyperparameters tuned on the validation set. The models were trained to minimize the mean squared error (MSE). Models with the best performance on the validation set were evaluated on the testing set according to 1) MSE, 2) buffer accuracy, and 3) classification accuracy, with results compared to a mean regressor.

Results: A total of 302,300 patients were included in this study. During validation, the PyTorch MLPs had the best MSEs for DOS (0.918) and LOS (0.715). During testing, the PyTorch MLPs similarly performed best based on MSEs for DOS (0.896) and LOS (0.690). While the scikit-learn MLP yielded the best 30-minute buffer accuracy for DOS (78.8%), the PyTorch MLP provided the best 1-day buffer accuracy for LOS (75.2%). Nearly all the ML models were more accurate than the mean regressors for both DOS and LOS.

Conclusion: Conventional and deep learning models performed better than mean regressors for predicting DOS and LOS of unilateral elective TKA patients based on preoperative factors. Future work should include operational factors to improve overall predictions.

Keywords: Arthroplasty; Duration of surgery; Knee; Length of stay; Machine learning; NSQIP.

bottom of page