# Machine Learning in Medical Triage: A Predictive Model for Emergency Department Disposition
## 3 Results
By using the appropriate function, H20 calculates the confusion matrix based on the model's predictions and the actual target values from the dataset (Table 3). The confusion matrix summarizes the model's performance on the test data by comparing the predicted classes (ADMITTED and HOME) with the actual classes. Metrics such as accuracy, precision, recall, specificity, or F1-score are extracted from the confusion matrix and offer insights into the model's classification capabilities. Evaluating these metrics helps identify the model's strengths and weaknesses, guiding decision-making in practical applications. In the given confusion matrix:  
True Positives (TP): The model correctly predicted 12,241 instances as \"ADMITTED\". False Negatives (FN): The model falsely predicted 10,833 instances as \"HOME\" when they were actually \"ADMITTED\". True Negatives (TN): The model correctly predicted 28,295 instances as \"HOME\". False Positives (FP): The model falsely predicted 3797 instances as \"ADMITTED\" when they were actually \"HOME\". Accuracy: Accuracy assesses the overall correctness of the model's predictions by calculating the ratio of the correctly predicted instances to the total number of instances. In this case, the accuracy can be calculated as (12,241 + 28,295)/(23,074 + 32,092) = 0.7317 or 73.17%. Precision: Precision measures the proportion of correctly predicted positive instances (ADMITTED) among all instances that were predicted as positive. In this case, it is calculated as 12,241/(12,241 + 3797) = 0.7632 or 76.32%. Recall (Sensitivity/True Positive Rate): Recall assesses the proportion of actual positive instances (ADMITTED) that were correctly predicted by the model. It is calculated as 12,241/(12,241 + 10,833) = 0.5308 or 53.08%. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & & \multicolumn{4}{c}{**Predicted Values**} \\ \cline{3-6}  & & **Admitted** & **Home** & **Error** & **Rate \({}^{*}\)** \\ \cline{2-6}  & **Admitted** & 12,241 (TP) & 10,833 (FN) & 0.4695 & 10,833.0/23,074.0 \\ \cline{2-6}  & **Home** & 3797 (FP) & 28,295 (TN) & 0.1183 & 3797.0/32,092.0 \\ \cline{2-6}  & **Total** & 16,038 & 39,128 & 0.2652 & 14,630.0/55,166.0 \\ \hline \hline \end{tabular}  
* True Positives (TP), False Negatives (FN), True Negatives (TN), False Positives (FP).
* The \"Rate\" refers to the error rate for each class. It represents the proportion of incorrect predictions relative to the total number of instances in that class.  
\end{table} 
Table 3: Confusion matrix (actual/predicted). Specificity (True Negative Rate): Specificity evaluates the proportion of correctly predicted negative instances (HOME) among all actual negative instances. It is calculated as 28,295/(28,295 + 10,833) = 0.7221 or 72.21%. F1 Score: The F1 score merges precision and recall into a single metric, offering a balance between the two. It is computed using the following formula: 2 \(\times\) (precision \(\times\) recall)/(precision + recall). Error Rate for \"ADMITTED\" class: The number of false predictions (10,833) divided by the total number of instances in the \"ADMITTED\" class (23,074). The result is approximately 0.4695, which represents a 46.95% error rate for predicting \"ADMITTED\" cases. Error Rate for \"HOME\" class: The number of false predictions (3797) divided by the total number of instances in the \"HOME\" class (32,092). The result is approximately 0.1183, which represents an 11.83% error rate for predicting \"HOME\" cases. Based on the given confusion matrix and related evaluation metrics, we can assess the performance of the GBM model by classifying instances into two classes: \"ADMITTED\" and \"HOME\". The evaluation metrics obtained from the model's performance on the test data are as follows:  
Mean Square Error (MSE): The MSE is 0.1677, indicating the average squared difference between the predicted probabilities and the true class labels. A lower MSE value suggests higher model accuracy. Root Mean Square Error (RMSE): The RMSE is 0.4095, representing the square root of the MSE.