SurgeryLSTM: a time-aware neural model for accurate and explainable length of stay prediction after spine surgery - PubMed (original) (raw)

SurgeryLSTM: a time-aware neural model for accurate and explainable length of stay prediction after spine surgery

Ha Na Cho et al. JAMIA Open. 2025.

Abstract

Objective: To develop and evaluate machine learning (ML) models for predicting length of stay (LOS) in elective spine surgery, with a focus on the benefits of temporal modeling and model interpretability.

Materials and methods: We compared traditional ML models (eg, Linear Regression, Random Forest, Support Vector Machine [SVM], and XGBoost) with our developed model, SurgeryLSTM, a masked bidirectional long short-term memory (BiLSTM) with an attention, using structured perioperative electronic health records (EHR) data. Performance was evaluated using the coefficient of determination (R 2), and key predictors were identified using explainable AI.

Results: SurgeryLSTM achieved the highest predictive accuracy (R 2 = 0.86), outperforming XGBoost (R 2 = 0.85) and baseline models. The attention mechanism improved interpretability by dynamically identifying influential temporal segments within preoperative clinical sequences, allowing clinicians to trace which events or features most contributed to each LOS prediction. Key predictors of LOS included bone disorder, chronic kidney disease, and lumbar fusion identified as the most impactful predictors of LOS.

Discussion: Temporal modeling with attention mechanisms significantly improves LOS prediction by capturing the sequential nature of patient data. Unlike static models, SurgeryLSTM provides both higher accuracy and greater interpretability, which are critical for clinical adoption. These results highlight the potential of integrating attention-based temporal models into hospital planning workflows.

Conclusion: SurgeryLSTM presents an effective and interpretable AI solution for LOS prediction in elective spine surgery. Our findings support the integration of temporal, explainable ML approaches into clinical decision support systems to enhance discharge readiness and individualized patient care.

Keywords: discharge prediction; health resources management; length of stay; machine learning; transparent AI.

© The Author(s) 2025. Published by Oxford University Press on behalf of the American Medical Informatics Association.

PubMed Disclaimer

Conflict of interest statement

There are no conflicts of interest among the authors.

Figures

Figure 1.

Figure 1.

Length of stay distribution across patients.

Figure 2.

Figure 2.

SurgeryLSTM model architecture and training workflow.

Figure 3.

Figure 3.

Feature importance rankings from the XGBoost model predicting LOS.

Figure 4.

Figure 4.

SHAP-based model interpretation. The left panel displays a SHAP summary plot showing the top 20 features influencing LOS prediction across the full dataset. Red dots indicate higher feature values; blue dots indicate lower values. The right panel shows a SHAP decision plot for 30 randomly selected patients, visualizing how cumulative feature contributions explain individual predictions.

Figure 5.

Figure 5.

Model performance and interpretability diagnostics of the SurgeryLSTM model. Top left/right: Loss and MAE curves across 30 epochs demonstrate effective learning and minimal overfitting. Bottom left: Residuals histogram shows a well-calibrated model with minimal skew. Bottom right: Attention weights peak near the surgery date, highlighting the model’s clinical focus.

References

    1. Collins TC, Daley J, Henderson WH, Khuri SF. Risk factors for prolonged length of stay after major elective surgery. Ann Surg. 1999;230:251-259. -PMC -PubMed
    1. Krell RW, Girotti ME, Dimick JB. Extended length of stay after surgery: complications, inefficient practice, or sick patients? JAMA Surg. 2014;149:815-820. -PMC -PubMed
    1. Adogwa O, Lilly DT, Khalid S, et al. Extended length of stay after lumbar spine surgery: sick patients, postoperative complications, or practice style differences among hospitals and physicians? World Neurosurg 2019;123:e734-e739. -PubMed
    1. Goldstein BA, Navar AM, Carter RE. Moving beyond regression techniques in cardiovascular risk prediction: applying machine learning to address analytic challenges. Eur Heart J. 2017;38:1805-1814. -PMC -PubMed
    1. Rajkomar A, Dean J, Kohane I. Machine learning in medicine. N Engl J Med. 2019;380:1347-1358. -PubMed