# Road Event Detection and Classification Algorithm Using Vibration and Acceleration Data
## 3 The Proposed Algorithm  
An overview of the proposed event classification algorithm is illustrated in Figure 1. The algorithm uses vibration and acceleration data to identify patterns corresponding to various events, ensuring high accuracy and computational efficiency. Designed to process high-frequency sensor signals, it extracts key features that inform classification decisions in real time. The algorithm consists of the following main steps:  
1. Data Preprocessing: Collect vibration and acceleration data from the three axes (x, y, z). Normalize and segment the raw sensor data into time windows, each representing a distinct observation for classification.
2. Feature Extraction: Extract relevant features from preprocessed data, such as statistical metrics (mean, variance, skewness, kurtosis) and frequency domain features (e.g., spectral entropy, power spectral density).  
Model Training: Train a Random Forest model using the extracted features as input. Each decision tree in the forest is trained on a random subset of the data and the final classification is based on the majority votes of the trees.
* Event Classification: Use the trained Random Forest model to classify incoming sensor data into predefined event categories (e.g., vehicle movements, sudden stops, irregularities). Although the main core of the Random Forest algorithm remains unchanged, we introduce several optimizations for road event detection using vibration and acceleration data. These modifications improve the efficiency, robustness, and applicability of the model in real-time environments.
* Feature Engineering and Selection: To improve classification accuracy and computational efficiency, we apply a structured feature engineering process. First, we pre-process the raw sensor data by applying a Butterworth low-pass filter to remove high-frequency noise and normalize the signals to ensure consistency across different sensor readings. Then, we extract both statistical features (mean, variance, skewness, kurtosis) and frequency domain features (spectral entropy, power spectral density) to capture relevant patterns in the data. This set of features improves the ability of the Random Forest classifier to differentiate between different road events.
* Hyperparameter Tuning: To optimize performance, we fine-tune the hyperparameters of the Random Forest model, adjusting the number of trees (\(N_{T}\)), the maximum tree depth, and the minimum samples required for a split. This tuning process, performed using cross-validation, ensures a balance between model complexity and generalization capability. The results of different hyperparameter configurations are analyzed in Section 5.
* Class Balancing Strategy: Road event datasets are inherently unbalanced, as normal driving conditions occur more frequently than anomalies such as potholes or sudden braking events. To mitigate this issue, we apply a class weighting strategy that increases the importance of underrepresented event types during training. This approach prevents the model from being biased towards predictions of the majority class, ensuring better detection of rare but critical road events.  
Figure 1: Block diagram of the proposed event classification algorithm. The pipeline consists of four main stages: (1) Data Preprocessing, where raw vibration and acceleration signals from the  
x, y, and z axes are collected, filtered, and normalized; (2) Feature Extraction, which derives statistical and frequency-based characteristics from sensor data; (3) Model Training, where a Random Forest classifier is built using extracted features; and (4) Event Classification, in which the trained model categorizes incoming sensor data into predefined event types.  
These optimizations make the Random Forest algorithm more suitable for real-time road event detection, balancing accuracy, computational efficiency, and robustness to sensor variations. Future work may explore additional optimizations, such as multimodal sensor integration and deep learning integration, to further enhance classification performance.