Real-Time Adaptive Traffic Flow Prediction Based on a GE-GRU-KNN Model

Xingdong Yi, Huiyu Zhou, Shaopeng ZhongPROMET 2025

Predicting the pulse of a city’s traffic is notoriously difficult. Between the morning rush, sudden accidents, and the complex way one bottleneck ripples through a network, traditional "static" models often fall short. A new paper recently published in Promet – Traffic&Transportation introduces a hybrid model that moves away from rigid maps and toward a more "fluid" understanding of how roads influence one another.

TL;DR

Researchers have developed the GE-GRU-KNN model, a hybrid approach that predicts traffic flow by dynamically adjusting how much weight it gives to different road segments in real-time. By combining graph embeddings with deep learning and adaptive k-nearest neighbors, the model reduces prediction errors by up to 14.7% compared to traditional methods.

What Problem Does This Paper Address?

Traffic flow isn't just about how many cars are on a single road; it’s about spatiotemporal correlation. If there is a crash three miles ahead of you (spatial), you will likely slow down in ten minutes (temporal).

Most current AI models use a "predefined adjacency matrix"—essentially a digital map that tells the AI which roads are connected. The problem? These maps are static. They assume the relationship between Road A and Road B is always the same. In reality, traffic is dynamic. A downstream road might have a massive impact on an upstream segment during rush hour but almost none at midnight. The authors set out to build a model that could "learn" these changing relationships on the fly.

Methods

The authors propose a three-part hybrid architecture:

  1. Graph Embedding (GE): Instead of giving the model a fixed map, they use a technique called DeepWalk (based on the Skip-Gram algorithm) to let the model learn the spatial features of the road network itself. It transforms the physical layout into a mathematical space where "similarity" between roads is calculated automatically.
  2. Gated Recurrent Unit (GRU): This is the "memory" of the model. GRUs are a type of recurrent neural network designed to capture long-term and short-term patterns in time-series data (like the daily ebb and flow of traffic).
  3. K-Nearest Neighbor (KNN): This is the "adaptive" engine. The KNN algorithm looks at the current traffic state and searches a historical database for similar patterns. It then uses these historical "neighbors" to dynamically update the weights of the predictions. If the current situation looks like a past Friday afternoon, the model shifts its weights to favor segments that were most influential during those specific past Fridays.

Datasets

The model was tested using real-world data from the Caltrans Performance Measurement System (PeMS).

  • Scope: 22 detectors located on California freeways.
  • Timeframe: Data collected every 30 seconds between May 1 and June 30, 2014.
  • Processing: The raw data was cleaned and aggregated into 5-minute intervals to provide a consistent flow for training and testing.

Key Insights and Ideas

  • Breaking the Matrix: The most significant "aha moment" is the move away from fixed adjacency matrices. By allowing the model to learn spatial representations (GE) and then weight them based on historical similarity (KNN), the model effectively creates a "living map" that changes based on current conditions.
  • Stability in the Long-Term: Many deep learning models (like LSTMs or standard GRUs) perform well for 5-minute windows but become unstable when asked to predict an hour ahead. This hybrid approach maintains much higher accuracy over longer horizons (60 minutes) because the KNN component grounds the neural network in historical reality.
  • The Power of Hybridization: The paper reinforces that "pure" deep learning isn't always the answer. Combining the pattern-matching of KNN with the feature-extraction of GRUs creates a system that is more robust than either would be alone.

Key Results

The GE-GRU-KNN model was compared against several heavy hitters, including Support Vector Regression (SVR), Random Forest (RF), and advanced attention-based models like A3TGCN.

  • Error Reduction: Across the board, the proposed model reduced the Mean Absolute Percentage Error (MAPE) by 1.08% to 14.71% compared to baselines.
  • Short-Term Accuracy: For a 5-minute prediction horizon, the model achieved a MAPE of 8.096%.
  • Long-Term Accuracy: For a 60-minute horizon, it maintained a MAPE of 10.725%, significantly outperforming T-GCN and other hybrid models which saw their performance degrade more sharply.
  • Visual Fit: Testing on real-world datasets showed the model could "hug" the actual traffic curves even during sudden, non-linear fluctuations that typically trip up simpler models.

Limitations and Future Work

While the model is a step forward, the authors acknowledge a few areas for growth:

  • Single-Variable Input: Currently, the model only looks at traffic flow data. The authors suggest that incorporating external factors—like weather conditions, holidays, or special events (like a stadium concert)—could further refine the "adaptive" weighting.
  • Computational Complexity: Training independent GRU models for various road sections and running real-time KNN searches is computationally expensive. Future work may focus on optimizing the algorithm for even faster real-time deployment in massive urban networks.
  • Long-Term Decay: Although it beats the competition, the model’s performance still drops as the prediction window moves toward 60 minutes, indicating that long-term "uncertainty" remains a hurdle for the field.

Summary updated

BibTeX
@inproceedings{yi2025real,
  author = {Xingdong Yi and Huiyu Zhou and Shaopeng Zhong},
  title = {{Real-Time Adaptive Traffic Flow Prediction Based on a GE-GRU-KNN Model}},
  booktitle = {PROMET},
  year = {2025},
  doi = {10.7307/ptt.v37i3.775},
}
Figure