# Pervasive Intelligent Models to Predict the Outcome of COVID-19 Patients
## 4 Case Study
### Modelling  
In this phase, several modeling techniques were selected and later applied to the previously treated data, optimized to obtain better results. For this, the modeling includes the following tasks: Selecting modeling techniques, generating a test environment, building the model, and evaluating it [34; 35].  
To proceed with the application of the algorithms to make predictions on the data, the data had to be divided into two parts: a training set and a testing set. The training set is used by the various classification algorithms so that they can train and adjust the model's constituent parameters. The test set allows evaluating the Accuracy of the final model taken from the training. For the data referring to patients infected by the Coronavirus, the data was divided using Stratified Cross-Validation since it offers more robust and reliable results. This method estimates the Machine Learning model's learning capacity to make predictions on unused data during the training phase, evaluating the classifier performance. Therefore, when a supervised Machine Learning process is carried out, data is separated so that one of these sets can be tested. This procedure has a single parameter denominated \"k\", and this value refers to the number of sets into which the data set in use was divided. For the project in question, this variable assumed the value of ten, meaning that the data sample in question was divided into ten different groups. The purpose of cross-validation is to test the model's ability to correctly predict new data that was not used in the training phase [36]. The Stratification process reorganizes the data to ensure that each fold has the same proportions of observations and provides a correct representation of the data as a whole [37].  
In this case, the data referring to COVID-19's patients will be subject to several classification algorithms to be able to predict the class of data in question. The SVM classification algorithm was also considered; however, it was not possible to obtain results on time due to the amount of data.  
The targets under consideration, presented in JSON (JavaScript Object Notation), were the following:  
\(\{\)  
\"Scenarios\":\(\{\)  
\"S1\":\"All comorbidities, symptoms, age and gender\",  
\"S2\":\"All comorbidities, age and gender\",  
\"S3\":\"Risk comorbidities, age and gender\",  
\"S4\":\"All comorbidities, symptoms and age\",  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**Targets**} & \multicolumn{2}{c}{**Before**} & \multicolumn{2}{c}{**After**} \\ \cline{2-5}  & **Number of Cases** & **Percentage of Cases** & **Number of Cases** & **Percentage of Cases** \\ \hline Patients who died & 14,667 & 1.98\% & 14,667 & 50.0\% \\ \hline Patients infected/recovered & 724,630 & 98.02\% & 14,667 & 50.0\% \\ \hline \hline \end{tabular}
\end{table}
Table 6: Distribution of cases using Undersampling.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{**Targets**} & \multirow{2}{*}{**Replicated**} & \multicolumn{2}{c}{**Before**} & \multicolumn{2}{c}{**After**} \\ \cline{2-5}  & & **Number of Cases** & **Percentage of Cases** & **Number of Cases** & **Percentage of Cases** \\ \hline Patients who died & 50 & 14,667 & 1.98\% & 733,350 & 50.3\% \\ \hline Patients infected/recovered & 0 & 724,630 & 98.02\% & 724,630 & 49.7\% \\ \hline \hline \end{tabular}
\end{table}
Table 5: Distribution of cases using Oversampling.  
\"S5\";\"All comorbidities and symptoms\",  
\"S6\";\"All comorbidities\",  
\"S7\";\"All comorbidities and age\",  
\"S8\";\"All comorbidities and gender\"  
},  
\"Techniques\":{  
\"T1\";\"Logistic Regression\",  
\"T2\";\"Naive Bayes\",  
\"T3\";\"Decision Trees\",  
\"T4\";\"Deep Learning\"  
},  
\"Sampling Methods\":{  
\"SM1\";\"Oversampling\",  
\"SM2\";\"Undersampling\"  
Therefore, 64 models were induced to obtain the published results (8 Scenarios \(\times\) 1 Targets \(\times\) 4 Techniques \(\times\) 2 Sampling Methods).