Comparing LSTM, GRU, and Transformers in Traffic Forecasting Across Varying Context Sizes and Horizons
Resumo
Forecasting traffic delays is a challenging task due to complex temporal dependencies and the sensitivity of models to input configurations. This paper presents a comparative analysis of the Long Short-Term Memory (LSTM), Gated Recurrent Unit (GRU), and Transformer architectures using time-series data from the PeMS system. We evaluated the sensitivity of the model to different context sizes and forecast horizons. Hyperparameters are optimized using Optuna, and performance is assessed with RMSE and MAE. The results show that GRU achieve the best performance in most scenarios, followed by LSTM and Transformer.
Referências
Box, G., Jenkins, G., and Reinsel, G. (2008). Time Series Analysis: Forecasting and Control. Wiley Series in Probability and Statistics. Wiley.
Brookings (2024). Traffic: Why it’s getting worse, what government can do. Accessed on October 7, 2024.
Chen, F. et al. (2022). Quatformer: Quaternion transformer for multi-modal learning. arXiv preprint arXiv:2205.05982.
Chen, L., Chen, L., Wang, H., and Zhang, H. (2024). Traffic flow prediction based on interactive dynamic spatio-temporal graph convolution with a probabilistic sparse attention mechanism. Transportation Research Record, 2678(9):837–853.
Chen, Y. and Chen, X. (2020). A large scale pems traffic speed dataset. Cho, K., Van Merrienboer, B., Gulcehre, C., Bahdanau, D., Bougares, F., Schwenk, H., and Bengio, Y. (2014). Learning phrase representations using rnn encoder-decoder for statistical machine translation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1724–1734.
Das, A., Barisal, S. K., and Dutta, P. (2022). A comparative analysis on traffic flow prediction. In 2022 International Conference on Machine Learning, Computer Systems and Security (MLCSS), pages 318–324.
Data, C. (2024). Us number of registered vehicles. Accessed on October 7, 2024. Demšar, J. (2006). Statistical comparisons of classifiers over multiple data sets. JMLR, 7:1–30.
Elmazi, K., Elmazi, D., Musta, E., Mehmeti, F., and Hidri, F. (2024). An intelligent transportation systems-based machine learning-enhanced traffic prediction model using time series analysis and regression techniques*. In 2024 International Conference on INnovations in Intelligent SysTems and Applications (INISTA), pages 1–6.
Fang, Y., Zhao, F., Qin, Y., Luo, H., and Wang, C. (2022). Learning all dynamics: Traffic forecasting via locality-aware spatio-temporal joint transformer. IEEE Transactions on Intelligent Transportation Systems, 23(12):23433–23446.
Feng, T., Zheng, Z.-Y., Xu, J., Liu, M., Li, M., Jia, H., and Yu, X. (2022). The comparative analysis of sarima, facebook prophet, and lstm for road traffic injury prediction in northeast china. Frontiers in Public Health, 10.
Gao, J. (2022). Time-series prediction research based on combined prophet-lstm models. In 2022 18th International Conference on Computational Intelligence and Security (CIS), pages 143–147.
Hochreiter, S. and Schmidhuber, J. (1997). Long short-term memory. Neural computation, 9(8):1735–1780.
Hou, Y., Zhang, D., Li, D., and Deng, Z. (2024). Regional traffic flow combination forecasting model considering the virtual space of road network. Physica A: Statistical Mechanics and its Applications, 637:129598. Available online 10 February 2024.
Hou, Y., Zhang, D., Li, D., and Yang, P. (2023). Forecasting method considering macro and micro characteristics of chaotic traffic flow. Chinese Physics B, 32(10):100508.
Hua, C. and Fan, W. D. (2022). Freeway traffic speed prediction under the intelligent driving environment: A deep learning approach. Journal of Advanced Transportation, 2022:1–9.
Huang, X., Lan, Y., Ye, Y., Wang, J., and Jiang, Y. (2022). Traffic flow prediction based on multi-mode spatial-temporal convolution of mixed hop diffuse ode. Electronics, 11(19).
Hyndman, R. J. and Athanasopoulos, G. (2018). Forecasting: principles and practice. OTexts.
Instituto Brasileiro de Geografia e Estatística (2023). Frota nacional de veículos.
Jia, Y., Wu, J., and Du, Y. (2016). Traffic speed prediction using deep learning method. In 2016 IEEE 19th International Conference on Intelligent Transportation Systems (ITSC), pages 1217–1222.
Joseph, L. M. I. L., Goel, P., Jain, A., Rajyalakshmi, K., Gulati, K., and Singh, P. (2021). A novel hybrid deep learning algorithm for smart city traffic congestion predictions. In 2021 6th International Conference on Signal Processing, Computing and Control (ISPCC), pages 561–565.
Lakhani, R., Dalal, D., Dantwala, V., and Bhowmick, K. (2023). Traffic congestion prediction using deep learning models. In Joshi, A., Mahmud, M., and Ragel, R. G., editors, Information and Communication Technology for Competitive Strategies (ICTCS 2022), pages 779–788, Singapore. Springer Nature Singapore.
Ma, L., Wang, Y., Lv, X., He, Y., and Wang, G. (2024). Hybrid deep learning model for traffic flow and speed forecasting at urban junction. Advances in Information Management and Economic Development Research, 1:48.
Morettin, P. and Toloi, C. (2018). Análise de séries temporais: modelos lineares univariados. BLUCHER.
Narmadha, S. and Vijayakumar, V. (2023). Spatio-temporal prediction of vehicle traffic flow using a multivariate cnn and lstm model. Materials Today: Proceedings, 81:826–833.
of Concerned Scientists, U. (2024). Inequitable exposure to air pollution from vehicles in california. Accessed on October 7, 2024.
of Public Health, H. T. C. S. (2024). Decreased vehicle emissions linked to fewer deaths. Accessed on October 7, 2024.
of Transportation, C. D. (2017). Transit Features in the California Department of Transportation Performance Measurement Systems (PeMS) Transit PeMS User Guide. California Department of Transportation.
Ounoughi, C. and Ben Sadok Yahia, S. (2024). A gru-based grizzly search optimization approach for traffic flow prediction. Expert Systems with Applications, 236:121325.
Pan, Y., Guo, J., Chen, Y., Cheng, Q., Li, W., and Liu, Y. (2023). A fundamental diagram based hybrid framework for traffic flow estimation and prediction by combining a markovian model with deep learning. Expert Systems With Applications.
Ramchandra, N. and Raj, R. (2021). Performance evaluation of machine learning algorithms in traffic flow prediction. In -.
Ranjan, N., Bhandari, S., Zhao, H. P., Kim, H., and Khan, P. (2020). City-wide traffic congestion prediction based on cnn, lstm and transpose cnn. IEEE Access, 8:81606–81620.
Rui, X. and Dong, S. (2024). Short-term traffic flow prediction based on CEEMDAN-CNN-LSTM. In Mikusova, M., editor, International Conference on Smart Transportation and City Engineering (STCE 2023), volume 13018, page 130182C. International Society for Optics and Photonics, SPIE.
Samonte, M., Balan, G., Gavino, P., Monasterial, J., Reforsado, R., and Samonte, D. (2022). Deep learning in traffic flow control and prediction for traffic management. In Proceedings of the 12th Annual International Conference on Industrial Engineering and Operations Management.
Sawah, M., Taie, S., Ibrahim, M., and Hussein, S. (2024). Deep neural network-based approach for accurate vehicle counting. International Journal of Intelligent Engineering and Systems, 16.
Sharma, A. and Ranjan, P. (2023). Traffic prediction model using machine learning in intelligent transportation systems. In 2023 International Conference on Circuit Power and Computing Technologies (ICCPCT), pages 1165–1173.
Sunny, M. (2023). Vehicular traffic flow prediction model using deep learning. International Journal For Science Technology And Engineering, 11(7):275–279.
Tiwari, N. and Prasad, L. (2023). Experimental analysis of time series models for traffic flow prediction. SAMRIDDHI : A Journal of Physical Sciences, Engineering and Technology, 15(03):312–320.
ul Hissan, R., Waseem, L. A., Khurshid, M., and Maqbool, M. S. (2023). The impact of urbanization on the flow of traffic in faisalabad city pakistan. Pakistan Journal of Humanities and Social Sciences, 11.
Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. (2017). Attention is all you need. In Advances in Neural Information Processing Systems, pages 5998–6008.
Xie, Y. and Mallick, T. (2023). A comparative study of loss functions: Traffic predictions in regular and congestion scenarios. arXiv.org, abs/2308.15464.
Xu, W., Liu, J., Yan, J., Yang, J., Liu, H., and Zhou, T. (2024). Dynamic spatiotemporal graph wavelet network for traffic flow prediction. IEEE Internet of Things Journal, 11(5):8020–8032.
Xu, Y. (2024). Machine Learning Based Traffic Prediction and Congestion Control Algorithms in Software Defined Networks . In 2024 International Conference on Interactive Intelligent Systems and Techniques (IIST), pages 285–289, Los Alamitos, CA, USA. IEEE Computer Society.
Yang, D., Li, H., Wang, P., and Yuan, L. (2024). Multi-step traffic speed prediction: A sequence-to-sequence spatio-temporal attention model. Physica A: Statistical Mechanics and its Applications, 638:129636. Available online 27 February 2024.
Zhang, K., Chu, Z., Xing, J., Zhang, H., and Cheng, Q. (2023). Urban traffic flow congestion prediction based on a data-driven model. Mathematics.
