# Prediction of Intensive Care Unit Length of Stay in the MIMIC-IV Dataset
## 5 Conclusions  
Predicting hospital length of stay (LOS) is important for clinical resources and cost management; however, it is a challenging problem because of the multiple factors involved. In this study, we performed the predictive modeling of LOS for patients admitted to the ICU of the MIMIC-IV dataset. We prepared and processed the data with typical features, including demographic and administrative data as well as vital signs and laboratory measurements collected on the first day of the ICU stay. We also considered data with LOSs of up to three weeks to avoid extremely long stays and divided them into short and long stays in the upper quartile. We then performed binary classification using different models: logistic regression, SVM, random forest, and XGBoost. The models were evaluated on several metrics, averaged over 10 different experiments using a repeated random train/test split for each model. The results demonstrate that the random forest is superior to the other algorithms, while the accuracy is moderate, as many actual long LOSs are predicted to be short. We also performed regression models to predict the actual LOS in the ICU. The results show the poor performance of the models when the entire dataset is considered with a maximum LOS of 21 days. This is mainly due to the fact that the models only incorporated data collected on the first day of ICU admission and are therefore unlikely to correctly predict a long LOS. To conclude the study, we proposed a practical approach for a realistic situation where the actual LOS on the first day of admission is not yet known. For this purpose, we first classified LOS as short or long stay, and then predicted the actual LOS only for data with a short predicted LOS. As a result, this approach significantly improved the performance of the models, with SVM and random forest outperforming other models. To predict an LOS longer than four days, we should shift the modeling window forward and consider, for example, data from the first four days or at least the fourth day. Future work will focus on improving the classification performance by exploiting the embedded information in diagnosis data. Profiling the diagnosis codes and the consideration of interrelated diseases will have an impact on performance. Moreover, a deep learning model that incorporates detailed information contained in temporal features can greatly improve the performance of the model and requires further investigation. The following are available online at [[https://www.mdpi.com/article/10.3390/app13126930/s1](https://www.mdpi.com/article/10.3390/app13126930/s1)]([https://www.mdpi.com/article/10.3390/app13126930/s1](https://www.mdpi.com/article/10.3390/app13126930/s1)). Conceptualization: L.H., S.S. and T.K. ; Software: L.H. ; Validation: L.H. ; Data curation: L.H. ; Writing--original draft preparation: L.H., S.S. and T.K. ; Writing--review and editing: L.H., S.S. and T.K. ; Visualization: L.H. and S.S.; Supervision: S.S. and T.K. ; Project administration: T.K. ; Funding acquisition: T.K. All authors have read and agreed to the published version of the manuscript. This work was supported by the German Ministry for Research and Education as part of the SMITH consortium (T.K., grant no. 01 ZZ1803K), and by the German Ministry of Health as part of the LEUKO-Expert consortium (L.H., grant no. ZMVII-2520 DAT94A). This work was conducted jointly by the Leipzig University Medical Center and the Mittweida University of Applied Sciences. Not applicable. The data used in this study are already publicly available. We also provide the source code for all methods through the publicly accessible [[https://gitlab.com/ul-mds/data-science/length-of-stay-prediction-mimic-iv](https://gitlab.com/ul-mds/data-science/length-of-stay-prediction-mimic-iv)]([https://gitlab.com/ul-mds/data-science/length-of-stay-prediction-mimic-iv](https://gitlab.com/ul-mds/data-science/length-of-stay-prediction-mimic-iv)), accessed on 3 June 2023. The authors declare no conflict of interest.