Bayesian Spatio-Temporal Graph Convolutional Network for Traffic Forecasting
In traffic forecasting, graph convolutional networks (GCNs), which model traffic flows as spatio-temporal graphs, have achieved remarkable performance. However, existing GCN-based methods heuristically define the graph structure as the physical topology of the road network, ignoring potential dependence of the graph structure over traffic data. And the defined graph structure is deterministic, which lacks investigation of uncertainty. In this paper, we propose a Bayesian Spatio-Temporal Graph Convolutional Network (BSTGCN) for traffic prediction. The graph structure in our network is learned from the physical topology of the road network and traffic data in an end-to-end manner, which discovers a more accurate description of the relationship among traffic flows. Moreover, a parametric generative model is proposed to represent the graph structure, which enhances the generalization capability of GCNs. We verify the effectiveness of our method on two real-world datasets, and the experimental results demonstrate that BSTGCN attains superior performance compared with state-of-the-art methods.
1 University of Science and Technology of China
firstname.lastname@example.org, email@example.com, firstname.lastname@example.org
Traffic congestion is a growing drain on the economy with the acceleration of urbanization. For example, the cost of traffic congestion in America reached $124 billion in 2014, and will rise to $186 billion in 2030, according to a report by Forbes . Therefore, improving traffic conditions is essential for increasing city efficiency, improving economy, and easing peopleâs daily life. One promising way to mitigate urban traffic congestion is to introduce Intelligent Transportation Systems (ITS), in which traffic prediction plays a vital role. However, accurate traffic prediction is still challenging due to the complex spatio-temporal dependence among traffic flows.
In the past few decades, many schemes have been proposed for traffic prediction, which can be broadly divided into two categories: temporal dependence based methods and spatio-temporal dependence based methods. Temporal dependence based methods leverage temporal characteristics of traffic flows to predict future traffic condition. Nevertheless, these methods have limited capability to achieve accurate traffic prediction due to ignoring the spatial dependence among traffic flows. Therefore, spatio-temporal dependence based methods are increasingly emerging, which take the spatial information into account. Since the road network is naturally structured as a graph in a non-Euclidean space with roads as nodes and their natural connections as edges, researchers prefer to use graph convolutional networks (GCNs)  to model spatial dependence among traffic flows instead of convolutional neural networks (CNNs).
However, existing GCN-based methods have two main disadvantages in terms of the graph construction: (1) The graph structure employed in GCNs is heuristically predefined and represents only the physical structure of the road network. Thereby, it is not guaranteed to be optimal description of dependence among traffic flows. For example, the relationship between two traffic flows that have similar trends but are located far away from each other is also important for traffic prediction. However, such dependence cannot be captured in the predefined road-topology-based graphs. (2) Introducing uncertainty into the graph structure, such as randomly dropping nodes or edges, could enhance the generalization capability of GCNs. Nevertheless, the graph structure employed in existing GCN-based methods is deterministic, which is lack of uncertainty investigation.
To solve above issues, a Bayesian Spatio-Temporal Graph Convolutional Network (BSTGCN) is proposed in this paper. It views the graph structure as a sample drawn from a parametric generative model, and aims to infer the posterior probability of the graph structure based on two types of information. One type is the physical topology of the road network, the other type is traffic data. In addition, parameters of the generative model are optimized together with weights of GCNs by the back-propagation algorithm in an end-to-end manner. The main contributions of our work lie in three folds:
This work proposes to learn the graph structure from the physical topology of the road network and traffic data in an end-to-end manner, which can find a more accurate descriptor of the relationship among traffic flows.
A generative model is proposed to represent the graph structure, which can improve the generalization capability of GCNs.
We validate the effectiveness of our method on two real-world datasets, and the experimental results show that our approach outperforms state-of-the-art methods by a noticeable margin.
The rest of the paper is organized as follows. Section 2 reviews research works related to traffic prediction. Section 3, 4, and 5 introduce the background, details of our method, and experimental results, respectively. Section 6 concludes this paper and points out some future directions.
2 Related Work
Traffic prediction has attracted a lot of attention in recent years due to its essential role in traffic management. Current methods generally have two categories, temporal dependence based methods, and spatio-temporal dependence based methods. Temporal dependence based methods only consider the temporal characteristics of traffic flows for traffic prediction. At the early stage, auto-regressive models including Auto-Regressive Integrated Moving Average (ARIMA) , Kalman filtering model , and seasonal ARIMA  are widely used in traffic prediction. However, these statistical models rely on the stationary assumption on traffic time series data, which hinders their performance on real-world traffic conditions that vary over time. Some traditional machine learning methods including Linear SVR , and random forest regression  are also tailored to solve traffic prediction, but are limited by hand-crafted features and shallow architectures. With the rapid development of deep learning, a variety of neural network architectures are applied in traffic prediction, such as the Feed Forward Neural network , LSTM and GRU . Despite their impressive capability in modeling temporal dynamics, these methods still have limited ability to achieve accurate traffic prediction due to lacking consideration of the spatial dependence among traffic flows.
Spatio-temporal dependence based methods take temporal nature and spatial dependence of traffic flows into account for traffic prediction. To capture the spatial dependence among traffic flows, early attempts including SAE , ST-ResNet , and SRCN  have tried to employ various CNNs. Nevertheless, considering that CNNs prefer to Euclidean data , such as images, regular grids, and so on, such methods can not perform well in the road network with complex topological structure. As a result, a temporal graph convolutional network (T-GCN)  is proposed for traffic prediction, where GCNs and GRUs are combined to capture spatio-temporal features of traffic flows. Later, A3T-GCN  boosts the performance of T-GCN through introducing an attention mechanism. However, existing GCN-based works ignore the uncertainty and the information of traffic flows in the process of graph construction.
Graph Convolutional Network
GCNs have been widely applied to a broad of applications, such as semi-supervised learning , action recognition , and quality assessment . Graph convolutional operation can be designed in either spatial or spectral domain. In this paper, we focus on the latter. Spectral convolution on graph with nodes is defined as the product of a signal (each node with a -dim feature) and a filter parameterized by , i.e.:
where is the eigenvector of normalized Laplacian matrix , and is the Fourier transform of . Since the Fourier transform is computationally expensive, a faster propagation rule  is proposed, i.e.:
where and are the output feature and trainable parameters of the layer , denotes the activation function, and equals . The normalized adjacency matrix is equal to , where and are the adjacency matrix and the degree matrix of . To include self-loop information, Eq. 2 is rewritten as:
where , and is the identity matrix.
Bayesian Graph Convolutional Network
BGCN  is firstly introduced in the task of semi-supervised node classification. In this task, we have an observed graph , where and denote the set of nodes and edges. And we obtain feature vectors of all nodes , but only know labels of a portion of nodes . Then, we aim to infer the labels of the remaining nodes based on , and . In the BGCN based framework viewing the graph structure and the weights of GCNs as random variables, the goal is to infer the posterior probability of labels , i.e.:
where parameterizes random graphs and the term is modeled by a categorical distribution. However, this formula ignores any possible dependence of the graph on data as it targets the inference of . To this end, an enhanced BGCN  is proposed, and formulates the posterior predictive distribution as follows:
where graphs sampled from and weights samples drawn from . Considering that sampling graph from the posterior probability of is time consuming, the maximum a posterior (MAP) inference of is introduced as follows:
As a result, Eq. 6 can be simplified as follows:
where weights samples obtained via dropout.
In the task of traffic prediction, we have access to the topology of the road network , where is the set of roads and denotes the set of edges. And we also obtain historical traffic data on roads , where belongs to , and is the dimension of traffic data. Then, our goal is to forecast future signals based on and in an iterative manner. In other words, to predict , we take observed signals and previous estimated results as the input. It is worth noting that the traffic data on roads only includes the traffic speed in this paper, i.e., is set to 1.
In general, traffic prediction is regarded as a task of learning a non-linear mapping function which maps historical traffic data and the topology of the road network into traffic conditions in the future timestamps. Mathematically, we formulate the objective of traffic prediction as follows:
where is the ground truth at time , and is the desirable horizon ahead of the current timestamp . In this paper, we propose a novel Bayesian spatio-temporal graph convolutional network (BSTGCN) to model . As shown in Figure 1, four modules are involved in the BSTGCN, including a projection module, a spatio-temporal context module, a decoder module, and a Bayesian inference module. Next, we will detail these modules in sequence.
The projection module is designed to project 1D traffic speed of each road into a high-dimensional feature space using a linear layer. Concretely, the traffic speed of roads at time , , is transformed into 64-dim traffic features as follows:
where the function consists of a fully-connected (FC) layer with 64 neurons, and the enhanced representation of traffic speed is beneficial to learn the spatio-temporal characteristics of traffic flows.
Spatio-temporal Context Module
As aforementioned, the future traffic speed of one road not only depends on the historical traffic speed of the road, but also is constrained to the physical topology of the road network. As a result, the spatio-temporal context module is proposed to capture the spatio-temporal features for each road. In the light of the good performance of Gate Recurrent Unit (GRU)  in modeling temporal characteristics of sequential data , we tailor the original GRU for dealing with graph-structured traffic data. In particular, we sequentially feed the input sequence into the tailored GRU, and denote the output of the tailored GRU at timestamp as:
where the function is comprised of a tailored GRU with the hidden size of 64, and the input-state transitions of the tailored GRU are expressed as follows:
where , , , and are the hidden state, the reset, update, and new gates at time , respectively. is the sigmoid function, denotes the graph convolutional operation, and means the Hadamard product. , , , , , and are trainable parameters. As seen in Eq. 12, the tailored GRU replaces FC layers in the conventional GRU with GCNs, which could learn the spatial characteristics of traffic flows. Moreover, we introduce uncertainty and the information of traffic data to the graph structure employed in GCNs, which is detailed in the part of the Bayesian inference module.
The decoder module aims to map the spatio-temporal feature into the traffic speed of roads at time with a linear layer, which is formulated as follows:
where the function is made up of a FC layer with 1 neuron.
Bayesian Inference Module
The Bayesian inference module is designed to discover better graph structure from the , input data , and corresponding label , as well as introducing uncertainty into the graph structure. In this paper, we consider a Bayesian approach, viewing the graph structure as a sample drawn from a parametric generative model. We then aim to infer the posterior predictive distribution as follows:
where is the set of trainable parameters of our network, and is the ground-truth traffic speed at time . As seen in Eq. 14, the posterior probability of graph is calculated in a two-step manner, where the information of the topology of the road network and the information of traffic data are successively introduced into the graph structure .
where graphs sampled from , weights samples drawn from , and is modeled by a Gaussian likelihood. Like the improved BGCN , we replace the integral over with a MAP process, as follows:
where and control the scale and density of . Here, is the pairwise distance of roads in the embedding space, which is calculated as follows:
where and are the embedding vector of the -th and -th road. In this paper, we learn embedding vectors of roads through the Graph Variational Auto-Encoder algorithm . After obtaining , we solve the Eq. 17 via the prevalent method . As for the inference of , we also adopt a Monte Carlo approximation. Thus, Eq. 14 is rewritten as follows:
where weights samples drawn from via dropout, and is a trainable deterministic variable that allows us to introduce the information of traffic data into the graph structure. As we can see, aims to learn the global graph structure as it is shared across all timestamps. The training algorithm of is described in Algorithm 1.
Relationship with Existing BGCNs
The improved BGCN  cannot be applied in traffic prediction due to two main reasons: (1) To include the information of traffic data in the graph structure, it needs to pre-calculate the MAP result for each timestamp, which is time-consuming. (2) It relies on the assumption that the graph structure is symmetric in the calculation of . However, this hypothesis is easily violated in the task of traffic prediction because the mutual influence of two traffic flows is usually unequal. In our proposed method, we learn the dependence of the graph structure over traffic data by injecting a trainable parameter , without introducing extra calculation. Moreover, the learned graph structure can be either symmetric or asymmetric.
Datasets and Evaluation Metrics
We verify our model on two real-world traffic datasets, SZ-taxi and Los-loop. The SZ-taxi dataset records the traffic speed of 156 major roads in Luohu District, Shen Zhen from Jan. 1 to Jan. 31, 2015. And the Los-loop dataset collects the traffic speed of 207 highways in Los Angeles County from Mar. 1 to Mar. 7, 2012. The traffic data is aggregated in the SZ-taxi and Los-loop datasets every 15 minutes and every 5 minutes. The topology of the road network is available in both datasets. In our experiment, we split both datasets into the training set and the evaluation set in a ratio of 4 and 1, and use observed 60-minute traffic speed to predict traffic conditions in the next 15, 30, 45, and 60 minutes.
We compare BSTGCN with the following state-of-the-art methods including historical average model (HA) , ARIMA , SVR , GCN model , GRU model , T-GCN model , and A3T-GCN model  in terms of Root Mean Squared Error (RMSE), Mean Absolute Error (MAE), Accuracy (ACC), Coefficient of Determination (), and Explained Variance Score (VAR). Higher ACC, and VAR values as well as lower RMSE and MAE values represent better prediction performance.
We implement BSTGCN on the PyTorch framework . All trainable variables in BSTGCN are optimized by the Adam  optimizer. We train BSTGCN on a NVIDIA Geforce GTX 1080Ti GPU for 100 epochs. The learning rate is initialized as and for the SZ-taxi and Los-loop dataset, respectively. During training, 32 pairs are randomly generated from the training dataset per iteration, and the learning rate is decayed by 0.2 every 25 epochs. It is worth noting that we use the learned graph structure without dropout in the evaluation phase.
Parameter Experiment and Ablation Study
First, we investigate the impact of hidden size and Monte Carlo dropout probability on the prediction performance in Table 1 and 2. As we can see, the prediction performance with 64 hidden neurons achieves the optimum on two real-world datasets. And, the optimal configurations of Monte Carlo dropout probability are 0.1 and 0.5 for the SZ-taxi and Los-loop dataset. As a result, we fix these hyperparameters in the following experiment.
Second, we verify the importance of introducing uncertainty and different ways of learning the graph structure in Table 3. and are two variants of BSTGCN. and learn the individual traffic pattern for each timestamp through Graph Attention Network  and Self-Attention Network , but ignore the uncertainty. According to results of , , and BSTGCN, we can conclude that introducing uncertainty and the information of traffic data into the graph structure can steadily improve the performance of traffic prediction. In addition, we can see that that learns the global traffic pattern across all timestamps exceeds and by a clear margin, which confirms the advantage of our way to learn graph structure from traffic data.
|Dataset||T||Metric||Monte Carlo dropout probability|
|Topology of the road network||✓|
|MAP result of||✓||✓||✓|
|Dependence of the graph structure over traffic data||✓||✓|
|Self Attention Network||✓|
|Graph Attention Network||✓|
Comparison with Existing Methods
Table 4 summaries the comparison between BSTGCN and existing methods in terms of RMSE, MAE, ACC, and VAR under various prediction horizon of traffic prediction. The major findings are introduced as follows. First, temporal dependence based methods including HA, ARIMA, SVR, and GRU achieve lower prediction performance on two real-world datasets, compared to spatio-temporal dependence based methods, i.e., T-GCN, A3T-GCN, and BSTGCN. This verifies the benefits of spatial characteristics of traffic speed for traffic prediction. Second, GCN, considering only spatial characteristics of traffic speed, is inferior to GRU in all evaluation metrics. This indicates that future traffic speed on roads is more dependent on historical traffic speed on roads. Third, we can observe that BSTGCN has a clear advantage over T-GCN and A3T-GCN, especially in the Los-loop dataset. For instance, with respect to the 15-minute prediction horizon, BSTGCN outperforms T-GCN and A3T-GCN by 1.76% and 1.57% in terms of . This confirms the superior capability of BSTGCN in capturing spatio-temporal characteristics of traffic speed. Finally, we can notice that BSTGCN shows its impressive ability in mitigating long-term prediction errors. For instance, with respect to 60-minute time series, BSTGCN outperforms T-GCN and A3T-GCN by 3.85% and 2.61% in terms of in the Los-loop dataset.
Visualized Results of Graph Structure
Figure 2 visualizes the observed adjacency matrix , the MAP estimation of adjacency matrix , and the final learned adjacency matrix . We can see that has the densest connectivity among traffic flows, but is of an asymmetric structure. This confirms that the assumption that adjacency matrix is symmetric is violated in the task of traffic prediction. In addition, we can notice that the relationships among traffic flows in are not always positive. However, such negative dependence among traffic flows cannot be captured in the original observed adjacency matrix .
Visualized Prediction Results
Figure 3 presents the prediction results of BSTGCN in the setting of 15-, 30-, and 45-minute prediction horizon. First, we can see that the traffic speed in the SZ-taxi dataset is more stationary than that of the Los-loop dataset. This explains the phenomenon that the naive historical average model (HA) performs well in the SZ-taxi dataset. Second, we can notice that the prediction results of BSTGCN are closer to the ground-truth traffic speed than that of existing methods, which is more obvious in the long-term prediction. This confirms the excellent ability of BSTGCN in traffic forecasting. Third, despite achieving impressive results, BSTGCN still cannot predict the value of sharply changing points.
Deep Dive into Network Architecture
We also have a deep dive into the network architecture of BSTGCN. Specifically, we switch the activation function of the reset gate in the tailored GRU from the sigmoid function to the identity function. The experimental results are presented in Table 5. It is interesting that such a simple modification can bring a noticeable gain in the Los-loop dataset, but has little impact in the SZ-taxi dataset. This phenomenon indicates different datasets prefer to different neural architecture. As a result, we advocate that automatically search neural architecture for the specific dataset is a promising alternative to further improve the performance of BSTGCN.
6 Conclusion and Future Work
In this paper, we propose a Bayesian spatio-temporal graph convolutional network (BSTGCN) for traffic prediction. Specifically, we propose to learn the underlying graph structure from the observed topology of the road network and traffic data in an end-to-end manner, and introduce uncertainty into the graph structure through a Bayesian approach. Experimental results on two real-world datasets verify the outstanding capability of BSTGCN in traffic prediction. In the future, we focus on two main directions. One is to extend BSTGCN to other spatio-temporal time series forecasting tasks, such as forecasting ride demand. The other is to perform neural architecture and hyperparameters search for BSTGCN.
- (1979) Analysis of freeway traffic time-series data by using box-jenkins techniques. Cited by: §2, §5.
- (2014) On the properties of neural machine translation: encoder-decoder approaches. arXiv preprint arXiv:1409.1259. Cited by: §4, §5.
- (2016) Convolutional neural networks on graphs with fast localized spectral filtering. In Advances in neural information processing systems, pp. 3844–3852. Cited by: §2.
- (2016) Using lstm and gru neural network methods for traffic flow prediction. In 2016 31st Youth Academic Annual Conference of Chinese Association of Automation (YAC), pp. 324–328. Cited by: §2.
- (2016) Dropout as a bayesian approximation: representing model uncertainty in deep learning. In international conference on machine learning, pp. 1050–1059. Cited by: §3.
- (2014) Traffic congestion costs americans $124 billion a year, report says. Forbes, October 14. Cited by: §1.
- (2019) Semi-supervised learning with graph learning-convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 11313–11320. Cited by: §3.
- (2017) Large scale graph learning from smooth signals. arXiv preprint arXiv:1710.05654. Cited by: §4.
- (2014) Adam: a method for stochastic optimization. arXiv preprint arXiv:1412.6980. Cited by: §5.
- (2016) Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907. Cited by: §1, §3, §5.
- (2016) Variational graph auto-encoders. arXiv preprint arXiv:1611.07308. Cited by: §4.
- (2007) Traffic flow prediction using adaboost algorithm with random forests as a weak learner. In Proceedings of world academy of science, engineering and technology, Vol. 19, pp. 193–198. Cited by: §2.
- (2004) A summary of traffic flow forecasting methods [j]. Journal of Highway and Transportation Research and Development 3, pp. 82–85. Cited by: §5.
- (2019) A gru-based prediction framework for intelligent resource management at cloud data centres in the age of 5g. IEEE Transactions on Cognitive Communications and Networking. Cited by: §4.
- (2014) Traffic flow prediction with big data: a deep learning approach. IEEE Transactions on Intelligent Transportation Systems 16 (2), pp. 865–873. Cited by: §2.
- (1984) Dynamic prediction of traffic volume through kalman filtering theory. Transportation Research Part B: Methodological 18 (1), pp. 1–11. Cited by: §2.
- (2019) Bayesian graph convolutional neural networks using non-parametric graph learning. arXiv preprint arXiv:1910.12132. Cited by: §3, §4, §4.
- (1999) Forecasting freeway link travel times with a multilayer feedforward neural network. Computer-Aided Civil and Infrastructure Engineering 14 (5), pp. 357–367. Cited by: §2.
- (2017) Automatic differentiation in pytorch. Cited by: §5.
- (2004) A tutorial on support vector regression. Statistics and computing 14 (3), pp. 199–222. Cited by: §5.
- (2017) Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008. Cited by: §5.
- (2017) Graph attention networks. arXiv preprint arXiv:1710.10903. Cited by: §5.
- (2003) Modeling and forecasting vehicular traffic flow as a seasonal arima process: theoretical basis and empirical results. Journal of transportation engineering 129 (6), pp. 664–672. Cited by: §2.
- (2004) Travel-time prediction with support vector regression. IEEE transactions on intelligent transportation systems 5 (4), pp. 276–281. Cited by: §2.
- (2020) Blind omnidirectional image quality assessment with viewport oriented graph convolutional networks. arXiv preprint arXiv:2002.09140. Cited by: §3.
- (2018) Spatial temporal graph convolutional networks for skeleton-based action recognition. In Thirty-second AAAI conference on artificial intelligence, Cited by: §3.
- (2017) Spatiotemporal recurrent convolutional networks for traffic prediction in transportation networks. Sensors 17 (7), pp. 1501. Cited by: §2.
- (2017) Deep spatio-temporal residual networks for citywide crowd flows prediction. In Thirty-First AAAI Conference on Artificial Intelligence, Cited by: §2.
- (2019) Bayesian graph convolutional neural networks for semi-supervised classification. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 33, pp. 5829–5836. Cited by: §3.
- (2019) T-gcn: a temporal graph convolutional network for traffic prediction. IEEE Transactions on Intelligent Transportation Systems. Cited by: §2, §5.
- (2020) A3T-gcn: attention temporal graph convolutional network for traffic forecasting. arXiv preprint arXiv:2006.11583. Cited by: §2, §5.