# Regressive Machine Learning for Real-Time Monitoring of Bed-Based Patients
## 3 Results  
In the pursuit of identifying the most appropriate ML regressors for the given dataset, an initial analysis was conducted on a selection of commonly used regressors. The findings of this analysis are presented in the Table 1, with the algorithms arranged in descending order of performance.  
The GBR emerged as the superior performer. This ML model is adept at detecting intricate patterns within the data. However, it is susceptible to overfitting, as it constructs trees in a sequential manner, with each new tree designed to rectify errors made by its predecessors. As the model incorporates more trees, it becomes increasingly expressive, which, if not properly managed, can lead to overfitting.  
\begin{table}
\begin{tabular}{c c c} \hline
**Regressor** & **MSE** & **R2** \\ \hline Gradient Boosting & 0.093 & 0.970 \\ Random Forest & 0.120 & 0.962 \\ Decision Tree & 0.138 & 0.956 \\ Support Vector & 0.220 & 0.930 \\ K-Nearest Neighbors & 0.322 & 0.897 \\ Linear & 19.419 & \(-5.209\) \\ \hline \end{tabular}
\end{table}
Table 1: Performance comparison of different regressors.  
The Random Forest, the second-best performer, shares GBR's ability to discern complex patterns in the data. However, it too is prone to overfitting, particularly when dealing with noisy data. This is attributed to the Random Forest's methodology of constructing numerous deep trees, each trained on a different data subset. While this can result in a model that fits the training data exceptionally well, it may perform poorly on unseen data.  
In contrast, the DTR is less likely to overfit due to its simplicity. Decision trees are generally more interpretable and can handle both numerical and categorical data. Despite this, they can still overfit if they are allowed to grow excessively deep, although this is typically easier to control than in more complex models.  
Given the circumstances, we opted for the BR, an ensemble model that incorporates the DTR as its base regressor. This method takes advantage of DTR's inherent ability to counteract overfitting. While the GBR or Random Forest may offer marginally better MSE and R\({}^{2}\) values, their use heightens the overfitting problem with our dataset. The slight improvement in these metrics does not justify their use if they contribute to overfitting issues.  
Tables 2 and 3 present comparative evaluations of three distinct models: DTR, GBR, and BR, without and with SMOT, respectively. The performance of these models is assessed using metrics such as Accuracy, R\({}^{2}\) (for both training and testing datasets), and MSE (for both training and testing datasets).  
The DTR model demonstrates an accuracy of 0.892, an R\({}^{2}\) score of 1.000 for the training data, and an R\({}^{2}\) score of 0.939 for the test data. The MSE for the training data is 0.000, suggesting no error, while the MSE for the test data is 0.167. The GBR model exhibits a slightly higher accuracy of 0.908, an R\({}^{2}\) score of 0.990 for the training data, and an R\({}^{2}\) score of 0.943 for the test data. The MSE for the training data is 0.031, and for the test data, it is 0.156.  
The ensemble model, i.e., BR, outperforms both individual models with an accuracy of 0.950, an R\({}^{2}\) score of 0.996 for the training data, and an R\({}^{2}\) score of 0.959 for the test data. The MSE for the training data is 0.012, and for the test data, it is 0.112. Additionally, BR models are known for their robustness to overfitting, which is a significant advantage in predictive modeling. While the BR may present a higher computational cost compared to simpler models, its superior performance justifies this trade-off. Although the interpretability of the BR may not be as straightforward as that of simpler models, the primary focus of this study was on achieving high predictive accuracy. Furthermore, the BR is highly scalable, making it suitable for future expansions of the study.