## 4 Training Process  
To facilitate the training and evaluation of the neural network models, the data are partitioned into three distinct categories: training, validation, and testing [37]. The training dataset is employed during the training phase to adjust the algorithm's weights and compute the loss function. Validation data are utilized to assess the system's accuracy and loss following each epoch of training. This validation dataset serves as a metric for evaluating the model's ability to generalize predictions to unseen data and identifies potential issues such as overfitting or underfitting. The testing dataset is employed to assess the performance of the final models post-training. The dataset was partitioned into 80% for training and 20% for testing. Within the training dataset, 20% was allocated for model validation. This division resulted in 15,972 training instances, 3993 validation instances, and 4992 testing instances. The dataset was randomly divided among the categories to prevent any bias towards a specific class. The training dataset for driving style comprises 17,686 instances labeled as normal driving and 2267 instances labeled as aggressive driving. Regarding traffic conditions, there are 14,972 instances labeled as low traffic, along with 2402 and 2591 instances labeled as high and medium traffic, respectively. It is notable that there is a significant imbalance in the distribution of labels, particularly observed in the normal driving style and low traffic conditions categories. This imbalance is influenced by both driver behavior and the specific traffic conditions on the roads from which the dataset originates. The initial training of the proposed ANN algorithms utilized the original dataset without adjustments. However, it became evident that the validation loss exceeded the training loss and failed to converge with an increasing number of epochs, suggesting a failure to generalize predictions to unseen data; this phenomenon is known as overfitting. To address the overfitting issue, we applied random upsampling to the low-labeled classes. This technique involves duplicating instances from the minority class randomly to balance the class distribution within the training dataset. By doing so, we aimed to mitigate system  
Figure 3: The ANN model’s architecture incorporates the bagging technique, where the final prediction is determined by averaging the outcomes of the five trained models. overfitting. The choice of random upsampling was made to retain the information present in the original dataset while addressing class imbalance. Table 2 displays the sample counts for each label before and after the resampling process. Training the model with the balanced dataset substantially narrowed the gap between training and validation loss, effectively resolving the overfitting problem. Figure 4 illustrates the training and validation loss for driving style model, highlighting the presence of overfitting in the system in the imbalanced data as seen in Figure 4a, where the model failed to generalize accurate prediction on the validation data. Figure 4b confirm that overfitting issue is handled by balancing the training dataset. Figure 5 illustrates the training and validation loss for the driving style for ANN with Bagging model post-dataset resampling. To enhance system accuracy and bolster resilience against overfitting, dropout layers with a drop rate of 0.2 were integrated into the 4 th, 5 th, and 6 th layers of both the ANN model and the ANN with bagging. The effects of dropout layers on detection outcomes are detailed in the results section. The system underwent training on a computer equipped with a 12 th Gen Intel(R) Core i7 processor clocked at 1.70 GHz, and 8 GB of RAM. The training process involved 300 epochs. The batch size and learning rate were adjusted by random variation. The most optimal results were obtained with a learning rate of 0.01 and a batch size of 30. Dropout layers were introduced in the early, middle, and final layers.