Traffic Prediction with Self-Supervised Learning: A Heterogeneity-Aware Model for Urban Traffic Flow Prediction Based on Self-Supervised Learning
Abstract
:1. Introduction
- We propose a novel self-supervised learning framework to model spatial and temporal heterogeneities in urban traffic flow data. We offer a detailed understanding and new insights for other spatial–temporal prediction tasks, e.g., weather forecasting.
- We introduce an adaptive data masking strategy that dynamically adjusts the regions that need to be masked based on traffic data characteristics, thereby enhancing the model’s robustness against noise disturbances and ensuring that the learned representations are accurate and generalizable across different traffic conditions.
- Our framework incorporates two auxiliary self-supervised learning tasks, which aim to enrich the model’s feature space, thus allowing for a deeper exploration of the underlying patterns of spatial and temporal heterogeneities to enhance the primary traffic prediction task.
- We conduct experiments on several real-world public datasets, thus demonstrating the superiority of TPSSL by achieving state-of-the-art results. We also conduct ablation studies to illustrate the importance of the adaptive data masking strategy and the two self-supervised learning paradigms. Furthermore, we explain the effectiveness of TPSSL through case studies.
2. Related Work
2.1. Deep Learning in Traffic Prediction
2.2. Self-Supervised Learning in Representation Learning
3. Methodology
3.1. Problem Definition
3.2. Architecture
3.3. Spatial–Temporal Encoder
3.4. Adaptive Data Masking
3.5. Spatial Heterogeneity Modeling
3.6. Temporal Heterogeneity Modeling
3.7. Model Training
4. Experiment
4.1. Data Description
4.2. Evaluation Metrics
4.3. Baselines
- Autoregressive Integrated Moving Average (ARIMA) [35]: It is a classic model in time series forecasting that combines autoregressive, differencing, and moving average components to model various time series data.
- Support Vector Regression (SVR) [36]: It provides a powerful mechanism for capturing linear relationships in data by using support vector machines for regression tasks.
- Spatiotemporal Residual Network (ST-ResNet) [1]: It captures the spatial and temporal dependencies of traffic data through residual connections and convolutional operations.
- Spatiotemporal Graph Convolutional Network (STGCN) [4]: It integrates graph convolutional networks with temporal convolutional networks, thus simultaneously modeling spatial and temporal dependencies in traffic data.
- Graph Multiattention Network (GMAN) [3]: It introduces multiple attention mechanisms, thus allowing the model to dynamically adjust its focus on different regions and time steps of the traffic network.
- Adaptive Graph Convolutional Recurrent Network (AGCRN) [5]: It combines node-adaptive parameter learning and data-adaptive graph generation modules to capture fine-grained spatial and temporal correlations without predefined graphs automatically.
- Spatial–Temporal Synchronous Graph Convolutional Network (STSGCN) [10]: It captures complex local spatial–temporal correlations through a synchronous modeling mechanism and the heterogeneities of local spatial–temporal graphs through multiple modules at different time periods.
- Spatial–Temporal Fusion Graph Neural Network (STFGNN) [9]: It generates a time graph and fuses it with the spatial graph to parallelly process data from different periods, thus effectively learning hidden spatial–temporal dependencies.
4.4. Implementation Details
4.5. Results
4.6. Ablation Study
4.7. Case Study
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Zhang, J.; Zheng, Y.; Qi, D. Deep spatio-temporal residual networks for citywide crowd flows prediction. In Proceedings of the AAAI Conference on Artificial Intelligence, San Francisco, CA, USA, 4–9 February 2017; Volume 31. [Google Scholar]
- Cai, L.; Janowicz, K.; Mai, G.; Yan, B.; Zhu, R. Traffic transformer: Capturing the continuity and periodicity of time series for traffic forecasting. Trans. GIS 2020, 24, 736–755. [Google Scholar] [CrossRef]
- Zheng, C.; Fan, X.; Wang, C.; Qi, J. Gman: A graph multi-attention network for traffic prediction. In Proceedings of the AAAI Conference on Artificial Intelligence, New York, NY, USA, 7–12 February 2020; Volume 34, pp. 1234–1241. [Google Scholar]
- Yu, B.; Yin, H.; Zhu, Z. Spatio-temporal graph convolutional networks: A deep learning framework for traffic forecasting. arXiv 2017, arXiv:1709.04875. [Google Scholar]
- Bai, L.; Yao, L.; Li, C.; Wang, X.; Wang, C. Adaptive graph convolutional recurrent network for traffic forecasting. Adv. Neural Inf. Process. Syst. 2020, 33, 17804–17815. [Google Scholar]
- Pan, Z.; Wang, Z.; Wang, W.; Yu, Y.; Zhang, J.; Zheng, Y. Matrix factorization for spatio-temporal neural networks with applications to urban flow prediction. In Proceedings of the 28th ACM International Conference on Information and Knowledge Management, Beijing, China, 3–7 November 2019; pp. 2683–2691. [Google Scholar]
- Pan, Z.; Liang, Y.; Wang, W.; Yu, Y.; Zheng, Y.; Zhang, J. Urban traffic prediction from spatio-temporal data using deep meta learning. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, Anchorage, AK, USA, 4–8 August 2019; pp. 1720–1730. [Google Scholar]
- Ye, X.; Fang, S.; Sun, F.; Zhang, C.; Xiang, S. Meta graph transformer: A novel framework for spatial–temporal traffic prediction. Neurocomputing 2022, 491, 544–563. [Google Scholar] [CrossRef]
- Li, M.; Zhu, Z. Spatial-temporal fusion graph neural networks for traffic flow forecasting. In Proceedings of the AAAI Conference on Artificial Intelligence, Virtual, 2–9 February 2021; Volume 35, pp. 4189–4196. [Google Scholar]
- Song, C.; Lin, Y.; Guo, S.; Wan, H. Spatial-temporal synchronous graph convolutional networks: A new framework for spatial-temporal network data forecasting. In Proceedings of the AAAI Conference on Artificial Intelligence, New York, NY, USA, 7–12 February 2020; Volume 34, pp. 914–921. [Google Scholar]
- Guo, S.; Lin, Y.; Wan, H.; Li, X.; Cong, G. Learning dynamics and heterogeneity of spatial-temporal graph data for traffic forecasting. IEEE Trans. Knowl. Data Eng. 2021, 34, 5415–5428. [Google Scholar] [CrossRef]
- Yin, X.; Wu, G.; Wei, J.; Shen, Y.; Qi, H.; Yin, B. Deep learning on traffic prediction: Methods, analysis, and future directions. IEEE Trans. Intell. Transp. Syst. 2021, 23, 4927–4943. [Google Scholar] [CrossRef]
- Bai, S.; Kolter, J.Z.; Koltun, V. An empirical evaluation of generic convolutional and recurrent networks for sequence modeling. arXiv 2018, arXiv:1803.01271. [Google Scholar]
- Yao, H.; Wu, F.; Ke, J.; Tang, X.; Jia, Y.; Lu, S.; Gong, P.; Ye, J.; Li, Z. Deep multi-view spatial-temporal network for taxi demand prediction. In Proceedings of the AAAI Conference on Artificial Intelligence, New Orleans, LA, USA, 2–7 February 2018; Volume 32. [Google Scholar]
- Li, Y.; Yu, R.; Shahabi, C.; Liu, Y. Diffusion convolutional recurrent neural network: Data-driven traffic forecasting. arXiv 2017, arXiv:1707.01926. [Google Scholar]
- Wang, C.; Tian, R.; Hu, J.; Ma, Z. A trend graph attention network for traffic prediction. Inf. Sci. 2023, 623, 275–292. [Google Scholar] [CrossRef]
- Li, F.; Feng, J.; Yan, H.; Jin, G.; Yang, F.; Sun, F.; Jin, D.; Li, Y. Dynamic graph convolutional recurrent network for traffic prediction: Benchmark and solution. ACM Trans. Knowl. Discov. Data 2023, 17, 1–21. [Google Scholar] [CrossRef]
- Naheliya, B.; Redhu, P.; Kumar, K. MFOA-Bi-LSTM: An optimized bidirectional long short-term memory model for short-term traffic flow prediction. Phys. A Stat. Mech. Its Appl. 2024, 634, 129448. [Google Scholar] [CrossRef]
- Bharti; Redhu, P.; Kumar, K. Short-term traffic flow prediction based on optimized deep learning neural network: PSO-Bi-LSTM. Phys. A Stat. Mech. Its Appl. 2023, 625, 129001. [Google Scholar]
- Zhang, X.; Wen, S.; Yan, L.; Feng, J.; Xia, Y. A hybrid-convolution spatial–temporal recurrent network for traffic flow prediction. Comput. J. 2024, 67, 236–252. [Google Scholar] [CrossRef]
- Chen, J.; Zheng, L.; Hu, Y.; Wang, W.; Zhang, H.; Hu, X. Traffic flow matrix-based graph neural network with attention mechanism for traffic flow prediction. Inf. Fusion 2024, 104, 102146. [Google Scholar] [CrossRef]
- He, R.; Zhang, C.; Xiao, Y.; Lu, X.; Zhang, S.; Liu, Y. Deep spatio-temporal 3D dilated dense neural network for traffic flow prediction. Expert Syst. Appl. 2024, 237, 121394. [Google Scholar] [CrossRef]
- Bao, Y.; Huang, J.; Shen, Q.; Cao, Y.; Ding, W.; Shi, Z.; Shi, Q. Spatial–temporal complex graph convolution network for traffic flow prediction. Eng. Appl. Artif. Intell. 2023, 121, 106044. [Google Scholar] [CrossRef]
- Ericsson, L.; Gouk, H.; Loy, C.C.; Hospedales, T.M. Self-supervised representation learning: Introduction, advances, and challenges. IEEE Signal Process. Mag. 2022, 39, 42–62. [Google Scholar] [CrossRef]
- Devlin, J.; Chang, M.W.; Lee, K.; Toutanova, K. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv 2018, arXiv:1810.04805. [Google Scholar]
- Radford, A.; Narasimhan, K.; Salimans, T.; Sutskever, I. Improving Language Understanding by Generative Pre-Training. 2018. Available online: https://paperswithcode.com/paper/improving-language-understanding-by (accessed on 10 March 2024).
- Chen, T.; Kornblith, S.; Norouzi, M.; Hinton, G. A simple framework for contrastive learning of visual representations. In Proceedings of the International Conference on Machine Learning, PMLR, Virtual, 13–18 July 2020; pp. 1597–1607. [Google Scholar]
- He, K.; Fan, H.; Wu, Y.; Xie, S.; Girshick, R. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 13–19 June 2020; pp. 9729–9738. [Google Scholar]
- Liu, X.; Zhang, F.; Hou, Z.; Mian, L.; Wang, Z.; Zhang, J.; Tang, J. Self-supervised learning: Generative or contrastive. IEEE Trans. Knowl. Data Eng. 2021, 35, 857–876. [Google Scholar] [CrossRef]
- Ji, J.; Yu, F.; Lei, M. Self-Supervised Spatiotemporal Graph Neural Networks With Self-Distillation for Traffic Prediction. IEEE Trans. Intell. Transp. Syst. 2022, 24, 1580–1593. [Google Scholar] [CrossRef]
- Ji, J.; Wang, J.; Huang, C.; Wu, J.; Xu, B.; Wu, Z.; Zhang, J.; Zheng, Y. Spatio-temporal self-supervised learning for traffic flow prediction. In Proceedings of the AAAI Conference on Artificial Intelligence, Salt Lake City, UT, USA, 8–12 October 2023; Volume 37, pp. 4356–4364. [Google Scholar]
- Shi, X.; Chen, Z.; Wang, H.; Yeung, D.Y.; Wong, W.K.; Woo, W.c. Convolutional LSTM network: A machine learning approach for precipitation nowcasting. Adv. Neural Inf. Process. Syst. 2015, 28, 1–9. [Google Scholar]
- Cuturi, M. Sinkhorn distances: Lightspeed computation of optimal transport. Adv. Neural Inf. Process. Syst. 2013, 26, 2292–2300. [Google Scholar]
- Yao, H.; Tang, X.; Wei, H.; Zheng, G.; Li, Z. Revisiting spatial-temporal similarity: A deep learning framework for traffic prediction. In Proceedings of the AAAI Conference on Artificial Intelligence, Honolulu, HI, USA, 27 January–1 February 2019; Volume 33, pp. 5668–5675. [Google Scholar]
- Kumar, S.V.; Vanajakshi, L. Short-term traffic flow prediction using seasonal ARIMA model with limited input data. Eur. Transp. Res. Rev. 2015, 7, 21. [Google Scholar] [CrossRef]
- Castro-Neto, M.; Jeong, Y.S.; Jeong, M.K.; Han, L.D. Online-SVR for short-term traffic flow prediction under typical and atypical traffic conditions. Expert Syst. Appl. 2009, 36, 6164–6173. [Google Scholar] [CrossRef]
- Krishna, K.; Murty, M.N. Genetic K-means algorithm. IEEE TRansactions Syst. Man, Cybern. Part B (Cybern.) 1999, 29, 433–439. [Google Scholar] [CrossRef]
Dataset | # Regions | Time Interval | Start Date | End Date | # Bikes/Taxis |
---|---|---|---|---|---|
BJTaxi [1] | 32 × 32 | 30 min | 1 March 2015 | 30 June 2015 | 34k+ |
NYCBike1 [1] | 16 × 8 | 1 h | 1 April 2014 | 30 September 2014 | 6.8k+ |
NYCBike2 [34] | 10 × 20 | 30 min | 1 July 2016 | 29 August 2016 | 2.6m+ |
NYCTaxi [34] | 10 × 20 | 30 min | 1 January 2015 | 1 March 2015 | 22m+ |
Dataset | BJTaxi | NYCBike1 | NYCBike2 | NYCTaxi | ||||
---|---|---|---|---|---|---|---|---|
Metric | MAE | MAPE | MAE | MAPE | MAE | MAPE | MAE | MAPE |
ARIMA | 21.48 | 23.12 | 10.66 | 33.05 | 8.91 | 28.86 | 20.86 | 21.49 |
SVR | 52.77 | 65.51 | 7.27 | 25.39 | 12.82 | 46.52 | 52.16 | 65.10 |
ST-ResNet | 12.12 ± 0.11 | 15.50 ± 0.26 | 5.53 ± 0.06 | 25.46 ± 0.20 | 5.63 ± 0.14 | 32.17 ± 0.85 | 13.48 ± 0.14 | 24.83 ± 0.55 |
STGCN | 12.34 ± 0.09 | 16.66 ± 0.21 | 5.33 ± 0.02 | 26.92 ± 0.08 | 5.21 ± 0.02 | 27.73 ± 0.16 | 13.12 ± 0.04 | 21.01 ± 0.18 |
GMAN | 13.13 ± 0.43 | 18.67 ± 0.99 | 6.77 ± 3.42 | 31.72 ± 12.29 | 5.24 ± 0.13 | 27.38 ± 1.13 | 15.09 ± 0.61 | 22.73 ± 1.20 |
AGCRN | 12.30 ± 0.06 | 15.61 ± 0.15 | 5.17 ± 0.03 | 25.59 ± 0.22 | 5.18 ± 0.03 | 27.14 ± 0.14 | 12.13 ± 0.11 | 18.78 ± 0.04 |
STSGCN | 12.72 ± 0.03 | 17.22 ± 0.17 | 5.81 ± 0.04 | 26.51 ± 0.32 | 5.25 ± 0.03 | 29.26 ± 0.13 | 13.69 ± 0.11 | 22.91 ± 0.44 |
STFGNN | 13.83 ± 0.04 | 19.29 ± 0.07 | 6.53 ± 0.10 | 32.14 ± 0.23 | 5.80 ± 0.10 | 30.73 ± 0.49 | 16.25 ± 0.38 | 24.01 ± 0.30 |
ConvLSTM | 11.70 ± 0.11 | 16.05 ± 0.49 | 5.15 ± 0.04 | 24.80 ± 0.35 | 5.05 ± 0.01 | 22.61 ± 0.07 | 12.05 ± 0.12 | 17.69 ± 0.38 |
TPSSL | 11.28 ± 0.02 | 15.07 ± 0.15 | 4.96 ± 0.02 | 23.38 ± 0.12 | 5.00 ± 0.02 | 22.15 ± 0.12 | 11.85 ± 0.06 | 16.39 ± 0.26 |
Dataset | BJTaxi | NYCBike1 | NYCBike2 | NYCTaxi | ||||
---|---|---|---|---|---|---|---|---|
Metric | MAE | MAPE | MAE | MAPE | MAE | MAPE | MAE | MAPE |
ARIMA | 21.60 | 20.67 | 11.33 | 35.03 | 8.70 | 28.22 | 16.80 | 21.23 |
SVR | 52.74 | 65.51 | 7.98 | 27.42 | 11.48 | 41.91 | 41.71 | 64.06 |
ST-ResNet | 12.16 ± 0.12 | 15.57 ± 0.26 | 5.74 ± 0.07 | 26.36 ± 0.50 | 5.26 ± 0.08 | 30.48 ± 0.86 | 10.78 ± 0.25 | 24.42 ± 0.52 |
STGCN | 12.41 ± 0.08 | 16.76 ± 0.22 | 5.59 ± 0.03 | 27.69 ± 0.14 | 4.92 ± 0.02 | 26.83 ± 0.21 | 10.35 ± 0.03 | 20.78 ± 0.16 |
GMAN | 13.20 ± 0.43 | 18.84 ± 1.04 | 7.17 ± 3.61 | 34.74 ± 17.04 | 4.97 ± 0.14 | 26.75 ± 1.14 | 12.06 ± 0.39 | 21.97 ± 0.86 |
AGCRN | 12.38 ± 0.06 | 15.75 ± 0.15 | 5.47 ± 0.03 | 26.63 ± 0.30 | 4.79 ± 0.04 | 26.17 ± 0.22 | 9.87 ± 0.04 | 18.41 ± 0.21 |
STSGCN | 12.79 ± 0.03 | 17.35 ± 0.17 | 6.10 ± 0.04 | 27.56 ± 0.39 | 4.94 ± 0.05 | 28.02 ± 0.23 | 10.75 ± 0.17 | 22.37 ± 0.16 |
STFGNN | 13.89 ± 0.04 | 19.41 ± 0.07 | 6.79 ± 0.08 | 32.88 ± 0.19 | 5.51 ± 0.11 | 29.98 ± 0.46 | 12.47 ± 0.25 | 23.28 ± 0.47 |
ConvLSTM | 11.78 ± 0.10 | 16.15 ± 0.47 | 5.45 ± 0.02 | 25.46 ± 0.31 | 4.72 ± 0.03 | 21.37 ± 0.25 | 9.84 ± 0.15 | 18.27 ± 0.42 |
TPSSL | 11.38 ± 0.03 | 15.21 ± 0.17 | 5.27 ± 0.02 | 24.26 ± 0.08 | 4.65 ± 0.02 | 21.14 ± 0.12 | 9.65 ± 0.14 | 16.77 ± 0.14 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Gao, M.; Wei, Y.; Xie, Y.; Zhang, Y. Traffic Prediction with Self-Supervised Learning: A Heterogeneity-Aware Model for Urban Traffic Flow Prediction Based on Self-Supervised Learning. Mathematics 2024, 12, 1290. https://doi.org/10.3390/math12091290
Gao M, Wei Y, Xie Y, Zhang Y. Traffic Prediction with Self-Supervised Learning: A Heterogeneity-Aware Model for Urban Traffic Flow Prediction Based on Self-Supervised Learning. Mathematics. 2024; 12(9):1290. https://doi.org/10.3390/math12091290
Chicago/Turabian StyleGao, Min, Yingmei Wei, Yuxiang Xie, and Yitong Zhang. 2024. "Traffic Prediction with Self-Supervised Learning: A Heterogeneity-Aware Model for Urban Traffic Flow Prediction Based on Self-Supervised Learning" Mathematics 12, no. 9: 1290. https://doi.org/10.3390/math12091290
APA StyleGao, M., Wei, Y., Xie, Y., & Zhang, Y. (2024). Traffic Prediction with Self-Supervised Learning: A Heterogeneity-Aware Model for Urban Traffic Flow Prediction Based on Self-Supervised Learning. Mathematics, 12(9), 1290. https://doi.org/10.3390/math12091290