# Predicting Road Traffic Collisions Using a Two-Layer Ensemble Machine Learning Algorithm
## 4 Discussion  
The increase in road traffic collisions necessitates effective analysis and control of these collisions. The study adopted a unique methodological approach to propose a model that predicts road traffic collisions based on a dataset from a driving simulator. In the knowledge that it is very dangerous to conduct trials in a real-world environment, a driving simulator provides an excellent tool for collecting data in a safe environment devoid of life-threatening risks and damage to property. The dataset from the simulator was downloaded and normalized using 15 features. We then performed feature selection engineering techniques to select the best features, thus reducing the likelihood of overfitting for our model. The best parameters of each model were determined by a 10-fold cross validation. The training set was partitioned into 10 equal subsets, with one subset serving as testing data and the remaining nine serving as training data. The process was then repeated using the entire 10 subsets, so that the whole dataset was used for validation. Our problem was one of binary classification, since our study focused on predicting the occurrence or not of a collision [45]. Given the stochastic nature of collisions, which tend to be underrepresented in the dataset, a synthetic minority oversampling technique (SMOTE) was used to balance the classes in the training dataset. Crash prediction offers a proactive approach to increasing road safety adherence and saving lives. Research into road safety has been of great interest to researchers, industry, and policy makers. Crash prediction remains complex and requires high dimensionality and large datasets to develop models that can effectively predict road traffic collisions [46].  
Although depending on accuracy as a measure of a model's performance can be misleading, the model might be biased toward one class. In the present study, to overcome  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Model** & **Accuracy** & **Precision** & **Recall** & **F1 Score** \\ \hline k-NN & 0.65 \(\pm\) 0.09 & 0.56 \(\pm\) 0.12 & 0.56 \(\pm\) 0.10 & 0.56 \(\pm\) 0.09 \\ \hline Decision Trees & 0.81 \(\pm\) 0.74 & 0.83 \(\pm\) 0.12 & 0.70 \(\pm\) 0.78 & 0.73 \(\pm\) 0.72 \\ \hline AdaBoost & 0.79 \(\pm\) 0.08 & 0.76 \(\pm\) 0.10 & 0.71 \(\pm\) 0.10 & 0.72 \(\pm\) 0.09 \\ \hline Naive Bayes & 0.81 \(\pm\) 0.10 & 0.77 \(\pm\) 0.12 & 0.76 \(\pm\) 0.11 & 0.77 \(\pm\) 0.09 \\ \hline Two-layer ensemble & 0.88 \(\pm\) 0.08 & 0.86 \(\pm\) 0.09 & 0.83 \(\pm\) 0.11 & 0.84 \(\pm\) 0.79 \\ \hline \hline \end{tabular}
\end{table}
Table 7: Outcomes of the models.  
these limitations, we determined other performance measures, such as precision, recall, and F1 score. To demonstrate the effectiveness of the proposed model, we compared it with existing works in the literature. Notably, the authors are aware of few works that have focused on crash prediction models based on a dataset from a driving simulator [47]. A comparison between the proposed two-layer ensemble approach and other works in the literature is presented in Table 8. The strategy was to include similar, closely related works that deployed the same methodologies. Our study findings align with the existing literature, but if a standard data collection format and a standard feature selection approach were to be standardized across the globe, the transferability, comparison, and usability of these models would be easy.