Skip to content
Open access

An Intelligent Machine-Learning Framework for Short-Term Traffic Accident Prediction in Urban Roads

Oct 2026 · Electronics · 0 citations · 27 references

Abstract

Urban traffic accidents remain an important road-safety problem, especially in densely populated cities where traffic conditions can change quickly and increase the possibility of accidents. This study proposes a machine-learning framework to predict urban traffic accidents over a short time using traffic, weather, congestion, and route-condition information collected in Marrakech, Morocco. The dataset was collected at five-minute intervals over a period of approximately six months and contains about 890,000 traffic observations and 3980 recorded accident events. The proposed approach includes several steps, including data preprocessing, feature analysis, Principal Component Analysis (PCA), chronological data splitting, treatment of class imbalance, machine-learning classification, and performance evaluation. The dataset was divided chronologically into 65% for training, 10% for validation, and 25% for testing. The different sampling methods were applied only to the training data to avoid affecting the validation and testing sets. Four sampling strategies were looked at: Random Over-Sampling (ROS), Synthetic Minority Over-sampling Technique (SMOTE), Random Under-Sampling (RUS), and Cluster Centroids (CC). After that several traditional machine-learning classifiers were tested. Among the evaluated classifiers, XGBoost achieved the strongest predictive performance. The results show that ROS and SMOTE improve the detection of accident cases, whereas RUS and CC lead to comparatively higher classification errors. These results indicate that an XGBoost-based approach can be useful for predicting whether an accident will occur during the following five-minute interval. The proposed framework provides a basis for developing real-time intelligent traffic-safety systems. Future work will consider additional spatial, temporal, environmental, and behavioral features and will evaluate the framework using datasets from other urban areas.

Read PDF

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.