# The Use of Machine Learning Methods in Road Safety Research in Poland
## 5 Discussion of Results  
Research on road safety in Poland reveals that despite preventive measures, the number of accidents and their consequences remain high. To address this issue, this study applied a machine learning (ML) approach, which enabled the analysis of large datasets to identify key factors influencing road safety and develop mathematical models for predicting traffic incidents and their consequences for participants. The key variables identified as having the strongest impact on road safety in Poland include the type of vehicle, driver behavior, voivodeship, type of incident, type of the participant, and day of the week. Other significant factors include the location of the incident, speed, lighting conditions, pedestrian behavior, and sex. All these variables were incorporated into the mathematical modeling process.  
This study's goal of developing mathematical models based on ML algorithms to describe road safety in Poland was successfully achieved. Three proposed models--k-Nearest Neighbors (KNN), Random Forest (RF), and Recursive Partitioning and Regression Trees (RPart)--produced similar results:  
1. k-Nearest Neighbors (KNN): * Accuracy--64.2%; * Kappa--0.4162; * Sensitivity \"no injuries\"--88.90%; * Sensitivity \"minor injuries\"--62.72%; * Sensitivity \"severe injuries\"--14.83%; * Sensitivity \"deaths\"--6.23%.
2. RF classification with cross-validation: * Accuracy--63.02%; * Kappa--0.414; * Sensitivity \"no injuries\"--84.95%; * Sensitivity \"minor injuries\"--59.03%; * Sensitivity \"severe injuries\"--24.90%; * Sensitivity \"deaths\"--12.17%.
3. RPart classification with cross-validation:* Accuracy--62.86%;
* Kappa--0.3664;
* Sensitivity \"no injuries\"--97.13%;
* Sensitivity \"minor injuries\"--56.11%;
* Sensitivity \"severe injuries\"--0%;
* Sensitivity \"deaths\"--0%.  
Moreover, the \(p\)-value for the McNemar test was very low for each of the models (\(\chi^{2}<2.2\times 10^{-16}\)). This result shows that the difference between the number of misclassifications for one class and the number of misclassifications for the other class is statistically significant. The number of cases in which the model incorrectly classified an example as one of the classes differs significantly from the number of cases in which the model incorrectly classified an example as another class. Therefore, the models make classification errors in an asymmetric manner. This is probably due to the fact that the proposed models may be more \"biased\" toward one class, more often confusing it with the other, which suggests a problem with the data balance and confirms the uneven distribution of classes in the dataset. Among the models, k-Nearest Neighbors achieved the highest sensitivity, although the difference compared to Random Forest and RPart was small. KNN performed better at classifying the \"no injuries\" class and demonstrated higher specificity for the \"deaths\" class. The Kappa coefficient for KNN and RF indicates moderate agreement (\(Kappa\approx 0.41\)), while RPart achieved a slightly lower score (\(Kappa=0.383\)), suggesting its classifications are somewhat more random. Overall, RPart delivered the weakest results, particularly for rare classes like \"severe injuries\" and \"deaths,\" where it failed to recognize any cases. However, all the models faced challenges in classifying rare classes, highlighting the need for alternative methods to analyze such datasets. This challenge will be the focus of further research by the authors.