# Road Event Detection and Classification Algorithm Using Vibration and Acceleration Data
## 5 Dataset Description
### Quantitative Analysis  
In this section, we present the results of three different configurations tested in the context of event detection and classification based on vibration and acceleration data. Each configuration is designed to optimize specific aspects of the model's performance, such as precision, recall, and AUC (Area Under the Curve of the Receiver Operating Characteristic--ROC Curve), while addressing the challenges of class imbalance and generalization. The dataset was divided into two parts for training and testing purposes. Dataset1 was split in half, with one part used for training and the other for testing. Similarly, for Dataset2, the data were divided into two sets with the same approach. This ensured that the model was trained on one subset of the data and tested on the other, allowing for a fair evaluation of its performance. The three configurations tested are as follows:  
* Configuration A: Baseline Model In this configuration, the Random Forest classifier was trained using the default hyperparameters to establish a baseline model. Specifically, the model used trees  
Figure 2: Visualization of the trajectories recorded for data collection. The urban route (**a**) covers 6.8 km within the metropolitan area of Puebla City, while the suburban route (**b**) covers 5.4 km on the outskirts of the city. \(N_{T}=100\) with default values for the maximum depth (max_depth \(=\) None) and the minimum samples required to split a node (min_samples_split \(=2\)). The dataset was divided into training and test sets with a ratio of 50%-50% and no adjustments were made for the imbalance of the classes. The performance of the model on all class events was evaluated using standard metrics of precision, recall, and AUC (Area Under the Receiver Operating Characteristic Curve). This configuration serves as a reference for comparing more advanced configurations. * Configuration B: Class Balanced Model This configuration addresses the class imbalance problem by applying class weighting during the training process. Given that the \"No events detected\" class is significantly overrepresented, this configuration assigns higher class weights to minority classes to ensure that the model gives adequate attention to them. The class weights are computed as the inverse of the class frequencies and are incorporated into the training of each decision tree. In addition, the dataset was split into training and testing sets using stratified k-fold cross-validation to ensure that each fold contains a proportionate representation of each class. The hyperparameters for the model remained unchanged, except for the adjustment in class weights. The Random Forest model still used trees \(N_{T}=100\), with no constraints on tree depth or leaf samples. Performance metrics are calculated after the model is evaluated in the testing set. * Configuration C: Hyperparameter Tuning Model Configuration C represents an optimized version of the Random Forest model, where the hyperparameters are fine-tuned to achieve the best performance. The number of trees, \(N_{T}\), varied from 100 to 200, and the maximum depth of the trees was restricted between 10 and 20 to prevent overfitting. The minimum number of samples required to split a node was varied between 2 and 10. A grid search approach was used to identify the optimal combination of these hyperparameters, and the best model was selected based on cross-validation results using a five-fold split. Additionally, class balancing was incorporated as in Configuration B, where class weights were adjusted based on the inverse of the class frequencies. Cross-validation was performed on the entire dataset, ensuring that the model's performance generalizes well across different splits. Finally, the performance of the model was evaluated in the testing set using precision, recall, F1 score, and AUC (Area Under the Operating Characteristic Curve of the Receiver).