Predicting traffic flow represents a critical undertaking within the domain of Intelligent Transportation Systems (ITS), given its pivotal role in optimizing traffic management strategies. Nevertheless, this endeavor is fraught with challenges, stemming from the inherent complexity and dynamic nature of traffic systems. Existing methods still suffer from the following three main limitations: (i) modeling the spatio-temporal correlations in a static way, restricting the ability to learn dynamic correlations; (ii) only capturing short-term local temporal features while neglecting long-term temporal patterns; (iii) cannot learn the latent relationships between traffic nodes at different time steps. Therefore, we propose a novel method named InOutformer based on In-Time-Window self-attention and Out-Time-Window self-attention to predict traffic flow. This method can effectively capture both short-term local temporal features and model long-term global temporal patterns, while also capturing dynamic spatial correlations between nodes. Specifically, we first propose a novel time window partitioning mechanism to replace the conventional sliding time window approach, in order to capture dynamic temporal features. Second, two specially designed temporal self-attention modules are used to learn short-term local temporal features and model long-term global temporal patterns, respectively. Then, a 2D-attention method is devised to capture the spatial correlations of nodes at different time steps. Moreover, by exploiting transition flow data, the detrimental effects due to spatial information propagation delays are effectively mitigated. Extensive experiments on four real-world traffic datasets demonstrate that the proposed model InOutformer outperforms the baselines, including several state-of-the-art methods.
Read full abstract