# Prediction of Intensive Care Unit Length of Stay in the MIMIC-IV Dataset
## 4 Discussion
### Temporal Feature and Diagnoses  
Vital signs and laboratory parameters are usually measured several times during the first 24 h of a patient's ICU admission. To represent such temporal data in the modeling, we used the mean of all measurements during this period (the first day of ICU admission). This single representation of temporal features simplifies the underlying complexity of the data and thus leads to information reduction. It is therefore important to select an appropriate measure for each feature in order to improve the performance in predicting LOS. To this end, we also explored several other measures, such as mean, median, standard deviation, minimum, and maximum, or a combination thereof, to represent the temporal features and evaluate their impact on improving the prediction result of LOS. Figure 6 depicts the performances of all classifiers in terms of balanced accuracy and MCC, provided that the temporal features are represented by single values or a combination. We found that models that only considered the mean performed quite well overall, with logistic regression and SVM achieving slightly better results when using both the mean and the maximum. The performance of the model, however, can be significantly improved by using a deep learning model that takes into account the detailed information contained in the temporal features. \begin{table}
\begin{tabular}{l c c c c} \hline
**Method** & **RMSE** & **MAE** & **MAPE** & **R2** \\ \hline Linear regression & 1.07 (1.14) & 0.74 (0.76) & 38.87 (39.53) & 0.20 (0.22) \\ SVM & 1.10 (1.16) & **0.71 (0.73)** & **33.11 (33.49)** & 0.23 (0.24) \\ Random forest & **1.07 (1.13)** & 0.74 (0.76) & 39.29 (39.94) & **0.23 (0.25)** \\ XGBoost & 1.17 (1.23) & 0.81 (0.83) & 41.68 (42.32) & 0.16 (0.18) \\ \hline \end{tabular}
\end{table} 
Table 6: Evaluation of the stepwise regression in terms of RMSE, MAE, MAPE, and R2. The results of each evaluation score are averaged over 10 different experiments using the repeated random train/test split. The regression models were trained on data with LOS initially predicted to be short (1–4 days) by a classification model. The regression results here are obtained using random forest (the main values) and XGBoost (the values in parentheses) as the prior classifiers. Each patient admitted to the ICU is typically diagnosed with multiple conditions identified by ICD codes. We selected the top two diagnoses based on the ranking available in the dataset, which may not include the principal diagnoses (MIMIC documentation ([[https://mimic.mit.edu/docs/iv/modules/hosp/diagnoses_icd/](https://mimic.mit.edu/docs/iv/modules/hosp/diagnoses_icd/)]([https://mimic.mit.edu/docs/iv/modules/hosp/diagnoses_icd/](https://mimic.mit.edu/docs/iv/modules/hosp/diagnoses_icd/)), accessed on 3 June 2023)). This assumption comes from the hospital billing system, where the principal diagnosis may appear among the first five diagnoses listed on the bill because of the need to convert the patient's complex conditions into a single coding system (e.g., ICD-10). The discrepancy between the principal diagnosis and the first diagnosis listed in the EHR actually depends on several factors, such as physician workload, expert experience, and the billing system itself [68]. We ultimately classified each ICD-10 code into 22 specific (coarse-grained) groups as described in Section 2. The diagnoses, included as input features in the modeling in this study, appear to have little impact on the classification performance. This is due to the fact that two selected diagnoses identified by ranking in the dataset are not necessarily the most important ones, or to the reduction in information by coarsening the diagnosis into chapters. We also note that the impact of ICD-9-10 conversion on the performance is minor, as only 2% of all hospital admissions with ICD-9 coded diagnoses did not have a unique converted ICD-10 code when the final code grouping was considered.