Predicting Urban Traffic Speeds with Graph Machine Learning
Real-time traffic speed prediction plays a critical role in urban traffic control. It helps reduce congestion, coordinate emergency responses, and enhance mobility for citizens. However, speed data required for accurate prediction is often missing due to GPS outages, device malfunctions, or communication delays.
In many road segments, either no data is collected or the sample size is too small to be reliable.
Unpredictable congestion and missing speed data
—when traditional statistical or deep learning models fall short, learning the road network structure itself may offer a breakthrough.
This article introduces a study that applies graph machine learning to supplement sparse traffic data for better prediction accuracy.[1]
By modeling the physical connections between road segments as a graph and learning from that structure,
it becomes possible to predict speeds even in segments where data is missing.
Background
The Problem of Missing and Sparse Traffic Data
Traditional time-series prediction models such as LSTM and CNN assume the availability of sufficient, continuous data.
However, real-world traffic data is often spatially and temporally sparse due to GPS loss, noise, or irregular sampling. Moreover, these models do not consider the physical connectivity between road segments, making it difficult to reflect influence from adjacent segments.
Core Idea
Predicting Missing Data with Neighboring Road Information
In this study, each road segment is modeled as a node, and the physical connections between segments as edges in a graph. Traffic speed is treated as a node feature. The model uses GraphSAGE, a type of Graph Neural Network (GNN), to predict missing speed values.
GraphSAGE learns not only the attributes of each node but also aggregates information from neighboring nodes and the structure of their connections. Originally inspired by Pinterest’s PinSage for image recommendation, GraphSAGE is highly scalable and well-suited for large-scale networks like traffic systems.
It can even predict on new nodes.
the study assumes that a segment’s speed is influenced by the speeds of physically connected segments. For example, the speed on a Manhattan–New Jersey segment A can be predicted based on the speed on the adjacent Manhattan–Brooklyn segment B.
Solution
Step 1. Constructing a Road Segment Network
A road segment is defined as a unidirectional piece of road between two intersections. For instance, the segment from Junction A to B (Segment 1) is a separate entity from the reverse direction (Segment 2).
Each node is assigned time-series traffic speed data from GPS devices. To simulate realistic missing data, some of the speed values are deliberately removed.
In the visualization below, black segments indicate areas with missing GPS data.
<Traffic speeds with missing value>
Step 2. Imputing Missing Data
The model predicts the missing speed values in the road network—reconstructing GPS losses in a real-world setting.
Various models were used for comparison, including KNN, Autoencoder, and GraphSAGE. GraphSAGE leverages information from connected segments to predict the missing values.
The results showed that GraphSAGE consistently produced the lowest prediction error among all models.
<Imputation results>
Step 3. Forecasting Travel Speeds
Finally, the study builds predictive models to forecast traffic speed for future time intervals. Models compared include traditional approaches like ARIMA, SVR, KNN, as well as GraphSAGE.
Two types of input data were used: - Original Data: Raw GPS-collected speed values. - Recovered Data: Speed data with simulated gaps, imputed using each model.
Thus, the study not only compares model performance but also analyzes the impact of data imputation on prediction accuracy, providing a quantitative evaluation of the effectiveness of graph-based recovery and forecasting techniques.
Result
Graph Machine Learning to the Rescue of Missing GPS Data
The GraphSAGE model outperformed traditional forecasting models with a 5–10% improvement in RMSE, showing that incorporating road connectivity into the model leads to significantly better prediction accuracy than time-series-only approaches.
<Performance Comparision of Models>
※ “Original Data” refers to raw GPS values. “Recovered Data” refers to values reconstructed after simulated data loss.
In traffic forecasting, where real-time performance and precision are critical, graph-based approaches provide robustness in the face of incomplete data. While conventional models struggle with sparsity, the GraphSAGE approach leverages the structural relationships within the road network to maintain predictability even when data is missing. Ultimately, GNN-based forecasting models deliver meaningful predictions even in signal-sparse areas, contributing to better traffic management and reducing blind spots. This suggests strong potential for graph analytics in smart city and intelligent transportation system (ITS) applications.
NetMiner Team
netminer@cyram.com
References
[1] Liu, Jielun & Ong, Ghim & Chen, Xiqun. (2020). GraphSAGE-Based Traffic Speed Forecasting for Segment Network With Sparse Data. IEEE Transactions on Intelligent Transportation Systems. 1-12. 10.1109/TITS.2020.3026025.




