Short-Term Traffic Congestion Forecasting Using Machine Learning and Deep Learning Models for Spatiotemporal Traffic Analysis
Abstract
Traffic congestion is a complex spatiotemporal phenomenon characterized by rapid fluctuations in traffic flow resulting from temporal dependencies, recurring mobility patterns, and location-specific variations within transportation networks. Accurate short-term traffic forecasting is essential for enhancing intelligent transportation systems (ITSs), enabling proactive congestion management, and supporting real-time decision-making. This study proposes a data-driven traffic forecasting framework developed within a spatiotemporally structured data environment using machine learning and deep learning approaches to predict traffic congestion 10 min ahead. The proposed framework was implemented in MATLAB R2020a and utilizes temporal and traffic-related features, including date, time, holiday indicators, day-of-week indicators, and observed mean speed, to capture dynamic traffic behavior. The methodology consists of data preprocessing, spatially structured data preparation and temporal feature representation, model training, mean speed prediction, congestion-level classification, and performance evaluation. We developed and comparatively evaluated three predictive models: Random Forest (RF), Long Short-Term Memory (LSTM), and Support Vector Regression (SVR). Experimental results demonstrated that LSTM achieved the highest congestion-level classification accuracy of 99.13%, followed by Random Forest at 98.26% and SVR at 94.21%. For continuous speed forecasting, Random Forest obtained the lowest MAE of 0.62 and MAPE of 0.71%, while both Random Forest and LSTM achieved an RMSE of 0.86 and an R2 of 0.9790. Compared with SVR, which obtained an MAE of 1.95, MAPE of 2.21%, RMSE of 2.78, and R2 of 0.7829, Random Forest and LSTM demonstrated substantially lower forecasting errors and stronger agreement with observed traffic speeds. These results indicate complementary strengths between the two leading models: Random Forest minimized average numerical forecasting error, whereas LSTM achieved higher congestion-level classification accuracy and closely reproduced observed temporal traffic variations. The results demonstrate the effectiveness of temporally informed data-driven learning for 10-min-ahead traffic forecasting within a spatially structured traffic-data framework. The proposed framework provides a potential foundation for short-term congestion alerts, traffic-monitoring decision support, and adaptive transportation applications, subject to further validation of computational efficiency and deployment requirements.