## 3 Materials and Methods
### Dataset  
The PoliDriving dataset was generated with the support of this study. It comprises 2634 samples with 23 numerical features and 1 predictive class; its fields correspond to driver information, vehicle data, weather conditions, and traffic accidents. The data were acquired, processed, and updated to provide a dynamic dataset that supported the development, training, and testing of all obtained models.  
During the dataset analysis, it was necessary to perform feature selection to obtain an optimal set of features. The Pearson correlation coefficient, a statistical measure commonly employed by some authors [9; 22; 37], was used to observe the feature dependencies. It quantifies the degree of linear correlation between two variables, ranging from \(-1\) to \(1\). The Pearson coefficient reflects the strength of the variables' relationship.  
Finally, we considered the 12 most important features. The significance of these characteristics lies in their ability to encompass a wide range of factors that impact accident risk prediction and their correlation with the target class. Table 2 describes the selected features of this dataset, and Figure 6 displays the relationship of the features.  
\begin{table}
\begin{tabular}{l c c c} \hline \hline
**Source** & **Features** & **Description** & **Unit** \\ \hline Driver information & heart\_rate & Number of contractions of the heart per minute. & bpm \\ \hline \multirow{6}{*}{Vehicle data} & steering\_angle & Vehicle steering wheel plane angle with respect to the road & grades \\  & & surface in sexagesimal degrees. & \\  & speed & Vehicle speed in meters per second. & m/s \\  & rpm & Vehicle engine speed in revolutions per minute. & rpm \\  & throttle\_position & Sensor used to monitor the air intake of the engine. & \% \\  & engine\_temperature & Temperature of the air entering the engine. & \({}^{\circ}\)C \\  & system\_voltage & Voltage of the vehicle’s electrical system. & V \\  & distance\_travelled & Distance travelled by the vehicle in one-time unit. & km \\ \hline \multirow{3}{*}{Weather conditions} & latitude & Latitude coordinates of the geographic position. & \(\lambda\) degrees \\  & longitude & Longitude coordinates of the geographic position. & \(\omega\) degrees \\  & barometric\_pressure & Pressure variable to change based on weather conditions. & kPa \\ \hline Traffic accidents & accidents\_onsite & Number of deaths due to in accidents at the location. & deaths \\ \hline \hline \end{tabular}
\end{table}
Table 2: Description of the features of the used dataset.  
The dataset presented another problem: imbalanced data in the predictor class. Imbalanced data significantly affect the learning process since most standard machine learning algorithms expect a balanced class distribution or an equal misclassification cost [38]. For this reason, it was necessary to solve the dataset imbalance problem.  
For preprocessing the data, the undersampling technique was used to reduce the number of samples in the minority class to generate a balanced dataset. It was implemented utilizing imbalanced-learn [38], an open-source Python toolkit that offers a broad array of methods for dealing with the common issue of imbalanced datasets in pattern recognition and ML. Thus, the Nearmiss method version 1 [39] was employed to undersample the data. Its objective is to choose a sample from the majority class nearest to multiple samples from the minority class. The selection criterion for samples from the majority class is the one with the smallest average distance to the three nearest samples from the minority class. Using this method, we transformed the unbalanced data into four balanced classes, each with 182 samples. These four predictor classes represent different risk levels: low, medium, high, and extreme.