Modeling Spatial-Temporal Dynamics for Traffic Prediction

Huaxiu Yao, Xianfeng Tang, Hua Wei, Guanjie Zheng, Yanwei Yu, Zhenhui Li

Abstract

Traffic prediction is a critical task in urban computing, enabling applications like taxi demand forecasting and bike-sharing optimization. However, existing models often rely on two restrictive assumptions: that spatial dependencies between locations are stationary over time, and that temporal dynamics are strictly periodic. In reality, spatial relationships are dynamic, and temporal patterns exhibit "drifting" shifts. This paper introduces the Spatial-Temporal Dynamic Network (STDN), a unified framework that addresses these challenges. STDN employs a flow gating mechanism to capture dynamic spatial similarities and a periodically shifted attention mechanism to handle long-term temporal shifting. Evaluations on large-scale NYC taxi and bike datasets demonstrate that STDN significantly outperforms state-of-the-art baselines.

Introduction: The Challenge of Dynamic Traffic Patterns

Predicting traffic volume—whether it's taxi demand or bike-sharing usage—is notoriously difficult because it relies on complex, non-linear interactions across both space and time. Traditional deep learning models for traffic prediction often suffer from two major flaws:

  1. Static Spatial Assumptions: Most models assume the relationship between two locations is fixed, often based on geographical distance. In practice, a residential area and a business district may be highly correlated during morning commutes but have almost no relationship at midnight.
  2. Strict Periodicity: Models often assume traffic patterns repeat exactly every 24 hours or 7 days. However, "peak hours" are not fixed points; they shift due to weather, accidents, or local events. A model looking only at 9:00 AM yesterday to predict 9:00 AM today will miss these temporal shifts.

Methodology: The Spatial-Temporal Dynamic Network (STDN)

To overcome these limitations, the authors propose the STDN, which integrates several specialized components into a unified architecture.

The STDN architecture, featuring the Local Spatial-Temporal Network (a), Periodically Shifted Attention Mechanism (b), Flow Gating Mechanism (c), and Output layer (d).

Local Spatial-Temporal Network (LSTN)

Instead of treating the entire city as a single image, STDN uses local CNNs to capture spatial dependencies for a target region and its immediate neighbors. These spatial features are then combined with LSTMs to model short-term temporal trends.

Flow Gating Mechanism (FGM)

A key innovation of STDN is the Flow Gating Mechanism. The model constructs "flow images" representing the actual movement of people between regions. It uses a gating mechanism where flow information "gates" the spatial features. If there is high traffic flow between two areas, the gate opens, allowing more information to propagate between them, thus capturing dynamic connectivity rather than just static distance.

Periodically Shifted Attention Mechanism (PSAM)

To handle long-term periodicity, the model examines the same time slots from previous days. Crucially, it doesn't just look at the exact same minute; it selects a window of time intervals (e.g., an hour before and after) and uses an attention mechanism to weight which of those intervals is most relevant to the current prediction. This allows the model to "re-align" the timeline when peak hours shift.

Experimental Evaluation

The model was evaluated on two large-scale, real-world datasets from New York City: NYC-Taxi (2015) with over 22 million records, and NYC-Bike (2016) with over 2.6 million trajectories. Both datasets were mapped to a 10x20 grid with 30-minute time intervals.

Key Results

STDN consistently outperformed state-of-the-art baselines, including ST-ResNet and DMVST-Net, across both datasets.

Comparison of RMSE for different methods on the NYC-Taxi dataset, showing STDN's superior performance in predicting both start and end volumes.
  • Accuracy: On the NYC-Taxi dataset, STDN achieved an RMSE of 24.10 for start volume, a significant improvement over DMVST-Net (25.74).
  • Error Reduction: It showed a consistent lead in MAPE (Mean Average Percentage Error), maintaining roughly 16% error on taxi data while other deep learning models hovered between 17% and 21%.
  • Ablation Success: The authors conducted ablation studies to prove the necessity of their components. Removing the flow gating (FGM) or the shifted attention (PSAM) led to a measurable drop in performance, confirming that modeling dynamic similarity is the "secret sauce" of the architecture.

Conclusion and Future Directions

The STDN framework represents a significant step forward by moving beyond static assumptions in traffic prediction. By treating spatial similarity as a dynamic function of flow and temporal periodicity as a shiftable window, it achieves higher accuracy and robustness.

Future work may focus on improving the interpretability of the model for urban planners and adapting the dynamic gating mechanisms to graph-based networks where the topology is more complex than a simple grid.

Summary updated

BibTeX
@inproceedings{yao2019modeling,
  author = {Huaxiu Yao and Xianfeng Tang and Hua Wei and Guanjie Zheng and Yanwei Yu and Zhenhui Li},
  title = {{Modeling Spatial-Temporal Dynamics for Traffic Prediction}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2019},
  doi = {10.1609/aaai.v33i01.33015668},
}
Figure