STAC-Net: A hierarchical framework for modeling and predicting urban traffic flow with uncertainty quantification

Z Zekai Yan B Bowen Cai

Abstract

With the rapid urbanization and growing traffic complexity, predicting urban traffic flow with high accuracy has become an essential challenge. Traditional methods struggle to model the uncertainty in traffic flow due to intricate spatiotemporal dependencies and external influencing factors such as weather and events. In this paper, we propose a novel approach based on STAC-Net for urban traffic flow uncertainty modeling and prediction. The proposed method introduces a framework that combines spatiotemporal graph convolution, Convolutional Gated Recurrent Units (ConvGRU), and hierarchical self-attention mechanisms to effectively capture the spatiotemporal dependencies and dynamic uncertainty in traffic data. The spatiotemporal graph convolution module models the spatiotemporal features of traffic flow, ConvGRU enhances the ability to learn long-term temporal dependencies, and the hierarchical self-attention mechanism optimizes multi-scale feature extraction, improving prediction accuracy and robustness. To address uncertainty quantification, we incorporate the Neural Processes (NP) module, which generates multiple prediction outcomes to quantify uncertainty and provide more reliable decision support. This multi-output approach allows the model to provide precise and reliable traffic flow predictions for traffic management departments. Experimental results show that, on the METR-LA, PeMS04, and PeMS08 datasets, our model outperforms baseline methods across all time horizons, achieving a 10.5% reduction in Mean Absolute Error (MAE) and a 12.3% improvement in Root Mean Squared Error (RMSE). In conclusion, our method provides a reliable and efficient framework for urban traffic flow prediction, addressing uncertainty in real-world traffic scenarios.

Article Details

Journal PLoS ONE
Volume / Issue Vol. 20, Issue 12
Published December 17, 2025
Pages e0336342
ISSN 1932-6203
Publisher Public Library of Science

Journal Info

PLoS ONE

Public Library of Science

ISSN: 1932-6203 Open Access Health Sciences

Authors (2)

Z

Zekai Yan

B

Bowen Cai