# Predicting Road Crash Severity Using Classifier Models and Crash Hotspots
## 6 Results and Discussion  
A total of 8027 automobile collisions occurred throughout the study period, of which 21.7% resulted in fatalities and 78.3% in serious injuries. To create models that predict the degree of injury severity in collisions, eight predictor variables (attributes) were combined with the class variable of injury severity. The work also seeks to assess the importance of qualities (relative variable importance) in causing a crash. The confusion matrix produced by each classification approach on the test data is summarized in Table 5. The confusion matrix for each class displays how instances belonging to that class are classified. The diagonal of the contingency table contains all of the correctly classified samples. Consequently, it is possible to visually check the matrix for errors. The confusion matrix was used to determine the various values of the classifiers' accuracy measure, which were then listed in Tables 4 and 5 to demonstrate how well the classification algorithms performed in relation to the crash in Al-Ahsa. The prediction accuracies for each class for all three classification algorithms are listed in Table 6. It expressly displays the sensitivity, specificity, accuracy, and recall results for all three machine learning approaches that were acquired using 10-fold cross-validation. The classifiers' performance metrics are provided in Table 6. The models were developed in a Python environment with Scikit-learn library. Random forest classifier achieves an accuracy of 94.00%, with a precision of 0.95 and 0.94 for fatal and serious injuries, respectively. The accuracy is 93.00%, with a precision of 0.91 and 0.93 for fatal and serious injuries when XGBoost was used, whereas using the logistic regression, the accuracy is 79.00% with a precision of 0.59 and 0.79 for fatal and serious injuries, respectively. Comparing the accuracy parameters of these models reveals that the R.F. model had the best prediction accuracy in terms of recall, precision, and F1 score. The random forest model outperformed the other models by a small margin (F1 score--R.F. model: fatal 0.85 and serious injury 0.96; XGBoost: fatal 0.81 and serious injury 0.85). Technically, it can be inferred that the important feature of R.F. was better than the XGBoost; however, the difference in the feature list was not very significant. With slightly superior performance metrics than logistic regression, which came in last in the performance metrics ranking, XGBoost was the next-best classification algorithm. This clearly advocates the use of machine learning techniques in place of statistical techniques for predicting crash severity. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Classifier** & **Severity Class** & **Sensitivity** & **Specificity** & **Precision** & **Recall** & **F1-Score** \\ \hline \multirow{3}{*}{Random Forest} & Fatal & & 0.95 & 0.77 & 0.85 \\  & Serious Injury & 0.770 & 0.989 & 0.94 & 0.99 & 0.96 \\ \cline{1-1}  & Fatal & & 0.91 & 0.73 & 0.81 \\ \cline{1-1}  & Serious Injury & 0.730 & 0.981 & 0.93 & 0.98 & 0.95 \\ \cline{1-1}  & Fatal & & 0.59 & 0.05 & 0.09 \\ \cline{1-1}  & Serious Injury & 0.050 & 0.990 & 0.79 & 0.99 & 0.88 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Performance metrics for the classifier modes. \begin{table}
\begin{tabular}{c c c c} \hline \hline  & & \multicolumn{2}{c}{**Predicted Class**} \\ \cline{3-4}
**Classifier** & **Actual Class** & **Fatal** & **Serious Injuries** \\ \hline Random Forest & Fatal & 268 & 80 \\  & Serious Injuries & 13 & 1245 \\ XGBoost & Fatal & 254 & 94 \\  & Serious Injuries & 24 & 1234 \\ Logistic Regression & Fatal & 17 & 331 \\  & Serious Injuries & 12 & 1246 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Confusion metrics for the classifier modes. According to the gain ratio evaluator derived using random forest and XGBoost models, Figures 6 and 7 depict the relative priority ranking of each feature. Higher feature relevance is implied by an evaluator with a high value. The R.F.