## 3 Methods
### Machine Learning  
In total, eight machine learning models were assessed: logistic regression (LogR), naive Bayes (NB), decision trees (DT), random forest (RandF), K-nearest neighbors (KNN), support vector machine (SVM), adaptive boosting (ADA), and gradient boosting (GB). As mentioned, LogR was considered as the baseline model as, in literature, it is generally considered to be the best performing model [7, 8, 17]. As the goal of the ML model was to either predict sepsis or LOS (i.e., \"infected\") for each 30 min segment starting from \(t_{i}=-48\), all of the models could be considered binary classifiers. Similar to the approach of [PERSON] et al. (2019) [9], we used repeated stratified K-fold cross-validation (CV) to train and test the models. Repeated stratified K-fold is especially useful when dealing with imbalanced datasets, as it makes sure that each fold contains the same percentage of positive and negative labels as in the original study population. Thus, each fold contained roughly 36% LOS segments and 64% control segments. To avoid data leakage from the training set to the test set within the CV procedure, we ensured that no segments of the same patient were present in both the training and test set. As we used a four-fold CV procedure where each procedure was repeated 10 times, 40 test and train results were collected for each learning window. In order to ensure the reliability of the results, all of the results were presented using a 95% confidence interval. We considered the results of each model to be significantly different if the corresponding confidence intervals were non-overlapping. We assessed our models mainly on the predictive performance of the area under the receiving operator characteristic (AUROC) score. The AUROC score is suitable for imbalanced datasets, as it does not have any bias towards models that perform well on the minority class at the expense of the majority class [32]. Furthermore, we trained the models on a decreasing training window: each model was trained on data from a shorter period, starting at \(t_{i}=-48\) and ending at \(t_{i}=-6\), with 6 h increments. Because no further hyperparameter tuning was completed, all the data were used for the CV procedure.  
We opted for no further hyperparameter tuning as this did not add much value towards the objective of this study (i.e., assess whether non-linear methods performed better than linear methods and on which types of features). All of the modelling was completed using the SciKit-learn library [24] within Python. The hyper-parameters as  
Figure 1: Example of one of the features calculated: minimum of inter heartbeat intervals (\(\Delta\) Min_rr). The green line is the onset of the sepsis.  
advised by the documentation of this library were used. In Table 15 in the Appendix A, an overview of the cost functions is presented. For SVM, we used a \"RBF\" (i.e., radial basis function) kernel and for KNN the number of neighbors was set to 5 (i.e., the default parameters in the SciKit-learn library). In Table 16 in the Appendix A, an overview of the hyperparameters of the ensemble models is presented. Note that the \"Max Estimators\" and \"Max Depth\" refer to the amount of decision trees (i.e., \"learners\") and depth of the corresponding tree used in the ensemble models. However, if the ensemble reached a perfect fit with an amount less than specified within these parameters, the learning stopped early.