# In-Vehicle Data for Predicting Road Conditions and Driving Style Using Machine Learning
## 8 Discussion  
In this work, in-vehicle data were used to make predictions for road conditions and driving style using supervised machine learning algorithms. The detest was collected from vehicle CAN network. It includes 14 features, such as vehicle speed, longitudinal acceleration, fuel consumption and engine rpm, as shown in Table 1. The data were labeled to three categories. The first one is road surface conditions, which classify the road as full of holes, smooth or even. The second category is road traffic conditions, which classifies \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Feature Importance Rank** & **Decision Trees** & **Random Forests** & **SVM** \\ \hline
1 & Vehicle Speed Average & Vehicle Speed Average & Vehicle Speed instantaneous \\
2 & Vehicle Speed instantaneous & Longitudinal Acceleration & Vehicle Speed Average \\
3 & Longitudinal Acceleration & Fuel Consumption Average & Engine RPM \\
4 & Fuel Consumption Average & Vehicle Speed instantaneous & Longitudinal Acceleration \\
5 & Vehicle Speed Variance & Vehicle Speed Variance & Vertical Acceleration \\
6 & Engine RPM & Vertical Acceleration & Manifold Absolute Pressure \\
7 & Vertical Acceleration & Engine RPM & Vehicle Speed Variance \\ \hline \hline \end{tabular}
\end{table} 
Table 10: Driving style feature importance using the permutation feature importance approach. \begin{table}
\begin{tabular}{c c c c} \hline \hline  & **Decision Trees** & **Random Forests** & **SVM** \\ \hline Accuracy & 0.92 & 0.95 & 0.91 \\ Precision & 0.92 & 0.95 & 0.91 \\ Recall & 0.92 & 0.95 & 0.91 \\ F-score & 0.92 & 0.95 & 0.91 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Driving style classification results. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & **Decision Trees** & **Random Forests** & **SVM** \\ \hline \multirow{2}{*}{\begin{tabular}{c} True/Predicted \\ Aggressive style \\ Normal style \\ Normal style \\ Normal style \\ \end{tabular} } & \multirow{2}{*}{\begin{tabular}{c} Aggressive \\ Style \\ 354 \\ 184 \\ \end{tabular} } & \multirow{2}{*}{\begin{tabular}{c} Normal \\ 209 \\ 4243 \\ \end{tabular} } & \multirow{2}{*}{\begin{tabular}{c} Aggressive \\ style \\ 345 \\ \end{tabular} } & \multirow{2}{*}{\begin{tabular}{c} Normal \\ style \\ 230 \\ \end{tabular} } & \multirow{2}{*}{\
\begin{tabular}{c} Aggressive \\ style \\ 140 \\ \end{tabular} } & \multirow{2}{*}{
\begin{tabular}{c} Normal style \\ 409 \\ 4393 \\ \end{tabular} } \\ \hline \hline \end{tabular}
\end{table} 
Table 9: Confusion matrix for driving style classification. the traffic as low, normal or high. Finally, The driving style which classifies the driving style into aggressive or normal. A detailed overview for the system architecture is shown in Figure 1. The model includes a data logging system for in-vehicle data. A machine learning algorithm system was used for classification and prediction. Three ML algorithms were implemented, i.e., decision trees, random forests and SVM. The detection results showed that random forests provided the best performance among the three algorithms. Decision trees came second, while the lowest performance algorithm was SVM. Figures 3-5 show the detection results represented in charts for the three classifications topics we covered in this work. Due to the nature of road conditions where the dataset was gathered, it was noticed that 61% of road surface is smooth and only 13% is full of holes. Moreover, 75% of the traffic is normal and only 12% is high traffic. Normal driving style is 89% of the data and the rest are aggressive. This imbalanced data distribution can impact the ML models and make them biased toward one class more than others. Although the recall results in this study were good, which means algorithms detection was accurate for the positive classes (low-sample data), it is always better to have balanced data. Future work may focus on solving this issue by increasing the amount of the training data to have more balanced data.