## 5 Results
### The Most Accurate Prediction--A Random Forest Model  
After analyzing Table 1, it can be concluded that the best model for turn detection is the random forest, but those results were obtained on an unbalanced sample. After testing different balancing methods for all the selected classifiers, still, the best results were obtained using the random forest model. The results (shown in Table 2) indicate that the best-matched random forest model is created based on a sample that was balanced by the oversampling method with a scaling parameter equal to 0.15. Additional tests were made (visual and cross-validation) to confirm that conclusion. The visual results of the model are presented in Figure 7A. Many of the incorrectly verified turn's moments (red dots) are due to the fact that the classifier has marked as a turn slightly wider or narrower sample fragment than when marked manually. The second test included a 5-fold cross-validation (Figure 7B) and a 10-fold cross-validation (Figure 7C). Both forms of validation confirm the good results achieved with the developed method, with an average accuracy of over 90%.  
Finally, the selected random forest model was also tested on two additional samples (sample no. 2 and sample no. 3). Both samples consisted of two full working shifts of 6 h each. Sample No. 2 was recorded by the same operator as the training sample but driving a different vehicle, and sample No. 3 was recorded by a different operator and vehicle than considered in the training sample. The obtained results are presented in Table 3. As can be seen, a random forest model can be applied to the same problem regardless of the operator driving the given type of vehicle. In the case of each tested sample, the accuracy score did not drop below 95%.  
\begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline
**Balancing Method** & \multicolumn{3}{c}{**Undersampling**} & \multicolumn{3}{c}{**Oversampling**} \\ \hline Scaling parameter & \multicolumn{3}{c}{0.15} & \multicolumn{3}{c}{1} & \multicolumn{3}{c}{0.15} \\ Test on & The entire sample & The test sample & The entire sample & The test sample & The entire sample & The test sample \\ Accuracy score & 0.8503 & 0.5958 & 0.9158 & 0.9359 & 0.9838 & 0.9550 \\ Confusion matrix & \(\left[\begin{array}{cc}14,516&2417\\ 221&467\end{array}\right]\) & \(\left[\begin{array}{cc}329&74\\ 176&41\end{array}\right]\) & \(\left[\begin{array}{cc}15,464&1469\\ 15&673\end{array}\right]\) & \(\left[\begin{array}{cc}15,464&1469\\ 136&4933\end{array}\right]\) & \(\left[\begin{array}{cc}16,793&140\\ 145&543\end{array}\right]\) & \(\left[\begin{array}{cc}4988&69\\ 194&591\end{array}\right]\) \\ Sensitivity & 0.68 & 0.19 & 0.98 & 0.97 & 0.78 & 0.75 \\ Specificity & 0.86 & 0.82 & 0.91 & 0.90 & 0.99 & 0.99 \\ Negative predictive value (NPV) & 0.99 & 0.65 & 1.00 & 0.97 & 0.99 & 0.96 \\ Precision (PPV) & 0.16 & 0.36 & 0.31 & 0.91 & 0.81 & 0.90 \\ F1 score & 0.26 & 0.25 & 0.48 & 0.94 & 0.80 & 0.82 \\ Macro avg. (precision) & 0.57 & 0.50 & 0.66 & 0.94 & 0.90 & 0.93 \\ Weighted avg. & 0.95 & 0.55 & 0.97 & 0.94 & 0.98 & 0.95 \\ Macro avg. (recall) & 0.77 & 0.50 & 0.95 & 0.94 & 0.89 & 0.87 \\ Weighted avg. (recall) & 0.85 & 0.60 & 0.92 & 0.94 & 0.98 & 0.95 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Comparison of different balancing methods and their impact on the results obtained by the random forest model.