Revisiting Spatial-Temporal Similarity: A Deep Learning Framework for Traffic Prediction

Huaxiu Yao, Xianfeng Tang, Hua Wei, Guanjie Zheng, Zhenhui Li · DOI

Abstract

Traffic prediction has drawn increasing attention in the AI research field due to the increasing availability of large-scale traffic data and its importance in the real world. The key challenge lies in modeling complex spatial dependencies and temporal dynamics. Existing works often make strong assumptions: that spatial dependence is stationary in time and temporal dynamics are strictly periodical. However, in practice, spatial dependence is dynamic, and temporal patterns often exhibit shifting. In this paper, we propose a novel Spatial-Temporal Dynamic Network (STDN). We introduce a flow gating mechanism to learn dynamic similarity between locations and a periodically shifted attention mechanism to handle long-term periodic temporal shifting. Experimental results on real-world traffic datasets verify the effectiveness of the proposed method.

Introduction

Predicting traffic—whether it's taxi demand or road congestion—is notoriously difficult because it involves complex "spatial-temporal" dependencies. Most existing deep learning models make two major, oversimplified assumptions:

  1. Stationary Spatial Dependence: They assume the relationship between two locations is constant. In reality, a residential area and a business district are strongly linked during the morning commute but weakly linked late at night.
  2. Strict Periodicity: They assume traffic patterns repeat exactly every 24 hours. However, "temporal shifting" is common—rush hour might start at 4:30 PM on Monday but 5:15 PM on Tuesday due to weather, accidents, or events.

The Spatial-Temporal Dynamic Network (STDN) improves traffic prediction by moving beyond these rigid assumptions, achieving state-of-the-art accuracy on real-world taxi and bike-sharing datasets.

Methodology

The STDN framework combines several deep learning architectures to handle different aspects of the data:

The architecture of the Spatial-Temporal Dynamic Network (STDN), illustrating the integration of local spatial-temporal networks, flow gating, and attention mechanisms.
  • Local Spatial-Temporal Network (LSTN): Instead of looking at the whole city as one image, the model uses local CNNs to capture the immediate neighborhood of a target region and LSTMs to handle short-term (hour-to-hour) changes.
  • Flow Gating Mechanism (FGM): This is a key innovation. The model constructs "flow matrices" representing the actual movement of people between regions. It uses these flows to "gate" (filter) the spatial information. If there is high flow between two areas, the gate opens wider, allowing the model to recognize a stronger dynamic similarity.
  • Periodically Shifted Attention Mechanism (PSAM): To handle the fact that "yesterday's peak" might not happen at the exact same time today, the model looks at a window of time intervals from previous days. It uses an attention mechanism to learn which of those intervals is most relevant to the current prediction, effectively "shifting" its focus to account for delays or early surges.
  • Joint Training: The model predicts both "start" (departures) and "end" (arrivals) traffic volumes simultaneously, as these two values are often highly correlated.

Experimental Results

The authors evaluated STDN on two large-scale public datasets from New York City: NYC-Taxi (2015), with over 22 million records, and NYC-Bike (2016), with over 2.6 million trajectories.

MAPE comparison of STDN and its variants on the NYC-Taxi dataset, showing significant improvements over baseline methods.

STDN was compared against a battery of baselines, including traditional methods (ARIMA), standard machine learning (XGBoost), and specialized deep learning models (ST-ResNet, DMVST-Net). Key findings include:

  • Superior Accuracy: STDN consistently achieved the lowest error rates. On the NYC-Taxi dataset, it improved the Mean Average Percentage Error (MAPE) by significant margins compared to previous state-of-the-art models.
  • Ablation Studies: The authors proved that both the Flow Gating and the Shifted Attention were necessary. Removing either component led to a measurable drop in performance, confirming that capturing "dynamic" similarity is essential.
  • Flow as the "Glue": Actual traffic flow (people moving from A to B) is a much more direct and dynamic way to represent how regions influence one another than simple geographical distance.

Conclusion

STDN represents a significant step forward in traffic prediction by explicitly modeling the dynamic nature of spatial and temporal dependencies. While highly effective, future work could explore irregular road networks instead of grid-based maps and improve model interpretability for urban planners. Integrating more complex external signals like weather and events could further refine the temporal shifting logic.

Summary updated

BibTeX
@inproceedings{yao2019revisiting,
  author = {Huaxiu Yao and Xianfeng Tang and Hua Wei and Guanjie Zheng and Zhenhui Li},
  title = {{Revisiting Spatial-Temporal Similarity: A Deep Learning Framework for Traffic Prediction}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2019},
  doi = {10.1609/aaai.v33i01.33015668},
}
Figure