Admission-time prediction of hospital length of stay in diverticular disease using explainable machine learning models
Acute diverticulitis (AD) is a leading cause of emergency department admissions and hospitalizations worldwide. Accurately predicting hospital length of stay (LOS) at the time of admission is essential for optimizing the utilization of resources, planning discharges and managing patients. The aim of this study was to develop and validate an explainable machine learning framework for predicting LOS at the time of admission in patients with diverticulitis and diverticulosis. A retrospective dataset comprising 148 hospitalized patients was analyzed. Advanced feature engineering techniques were applied, including interaction terms, nonlinear transformations, logarithmic scaling and clinically derived inflammatory indices. Multiple regression-based and machine learning model such as Linear Regression, Ridge Regression, Random Forest, XGBoost and a Voting Regressor ensemble were trained using log-transformed LOS values. Model performance was evaluated using five-fold cross-validation, bootstrap-based stability analysis, calibration assessment, SHAP-based explainability and Kaplan-Meier-based risk stratification. The mean LOS was 2.08 ± 2.5 days. Tree-based ensemble models demonstrated better predictive performance compared to linear models. XGBoost performed best in the full cohort (mean absolute error (MAE) = 0.03; R² = 0.99), while Random Forest and ensemble approaches showed comparable or improved performance in the diverticulitis subgroup with MAE of 0.74 and R² of 0.77. XGBoost showed exceptionally high apparent performance in the full cohort. However, stricter internal validation produced more conservative estimates. Patient-level nested out-of-fold (OOF) evaluation resulted in an R² of approximately 0.57, while bootstrap optimism correction yielded an optimism-corrected R² of 0.8314 and MAE of 0.3512 days. SHAP analysis indicated that Hinchey class and inflammatory characteristics contributed substantially to model predictions. Calibration and residual analyses indicated acceptable agreement between predicted and observed LOS, while prediction intervals provided clinically relevant uncertainty estimates. Subgroup analysis revealed decreased predictive performance and increased variability, reflecting the challenges associated with reduced sample size and heterogeneity. Combining explainable machine learning with clinically informed feature engineering provides a promising framework for estimating LOS at the time of admission for diverticular disease. However, the more conservative nested cross-validation results highlight the need for larger, independent cohorts in order to establish the generalizability and potential utility of the proposed approach.
Authors
- Gürkan Güneri (ORCID: https://orcid.org/0000-0001-6749-2159)
- Özcan Emre (ORCID: https://orcid.org/0009-0001-6174-9803)
- Emre Dandıl (ORCID: https://orcid.org/0000-0001-6559-1399)
- Mehmet Emin GÖNÜLLÜ (ORCID: https://orcid.org/0000-0001-9126-2396)
- Kevser Dilek Andıç (ORCID: https://orcid.org/0000-0002-2384-4201)
- Mücahit Ünal (ORCID: https://orcid.org/0000-0001-9941-5166)
- Kadir Çorbacı (ORCID: https://orcid.org/0000-0001-7616-4798)
- Doğuşcan Kurular
Institutions
- Bilecik Şeyh Edebali Üniversitesi (TR)
Publication Details
- Journal
- Scientific Reports
- Published
- 2026-10-26
- DOI
- https://doi.org/10.1038/s41598-026-78128-7
- Primary Topic
- Diverticular Disease and Complications
- Type
- article
- Field-Weighted Citation Impact
- 0.00