Traffic flow prediction method based on graph neural network
Through the traffic flow prediction method combined with a dynamic graph convolution network and a sparse probability self-attention mechanism, the problems of high computational complexity and insufficient dynamic dependency capture capabilities in the existing technology are solved, efficient traffic flow prediction is achieved, and prediction accuracy is improved. and computational efficiency.
Patent Information
- Application Number
- CN202411520069.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2024-11-26
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing traffic flow prediction methods based on graph neural networks and spatiotemporal convolutional networks have high computational complexity, insufficient dynamic dependency capture capabilities, and it is difficult to effectively capture the complex spatiotemporal characteristics of traffic flow.
The dynamic graph convolution network and the probability sparse self-attention mechanism are adopted to capture the dynamic correlation and spatio-temporal characteristics of the traffic road network through interactive learning strategies, optimize attention calculations, and improve the calculation efficiency and prediction accuracy of the model.
Effectively capture the dynamic correlation between road nodes, improve the accuracy of spatial and temporal feature extraction, optimize computing efficiency, and improve traffic flow prediction accuracy, especially in long-term prediction.
Smart Images

Figure CN119028141A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of traffic flow prediction, and in particular, to a traffic flow prediction method based on graph neural network. Background Art
[0002] With the acceleration of urbanization, traffic flow prediction has become crucial in traffic management. Existing prediction methods based on graph neural networks (GNNs) and spatiotemporal convolutional networks (ST-Convs) have the problems of high computational complexity and insufficient dynamic dependency capture when capturing complex spatiotemporal features in traffic flow. In order to meet these challenges, this paper proposes a traffic flow prediction method based on dynamic graph convolutional networks and probabilistic sparse self-attention mechanism, which improves the model's spatiotemporal feature capture capability and optimizes computational efficiency by introducing an interactive learning strategy. Summary of the invention
[0003] In view of this, the purpose of the present invention is to provide a traffic flow prediction method based on a fused probabilistic sparse self-attention mechanism, which captures the dynamic associations in the traffic network through a dynamic graph convolutional network and optimizes the attention calculation through a sparse self-attention mechanism, thereby achieving efficient prediction of traffic flow.
[0004] In order to solve the above technical problems, the technical solution of the present invention is: a traffic flow prediction method based on graph neural network, characterized by comprising the following steps:
[0005] S1: Construct the topological structure of the traffic network and use the dynamic graph convolutional network to model the traffic network;
[0006] S2: Design a fusion probabilistic sparse self-attention mechanism to optimize attention weight calculation through sparse processing;
[0007] S3: Combine traffic time series data with graph structure data to generate time series input of traffic flow;
[0008] S4: Capturing the spatiotemporal correlation of segmented traffic data through interactive learning strategies;
[0009] S5: Based on the trained model, predict the traffic flow in the future period.
[0010] As a preferred solution of the present invention, the dynamic graph convolutional network constructed in step S1 includes a graph generator and an adaptive adjacency matrix, which are used to dynamically simulate the spatiotemporal relationship between nodes.
[0011] As a preferred solution of the present invention, the probabilistic sparse self-attention mechanism in step S2 reduces the calculation of irrelevant attention weights through the sparsification technology, thereby improving the calculation efficiency of the model.
[0012] As a preferred solution of the present invention, step S3 generates time series input through a sliding window method, and combines node features to input a dynamic graph convolutional network.
[0013] As a preferred solution of the present invention, the interactive learning strategy in step S4 adopts an interleaved sampling technique to divide the input sequence into multiple subsequences to synchronously capture the dynamic dependencies in time and space.
[0014] In summary, the present invention has the following beneficial effects:
[0015] 1. Dynamic association modeling: The dynamic association between road nodes is effectively captured through the dynamic graph convolutional network to improve the accuracy of spatiotemporal feature extraction.
[0016] 2. Computational efficiency optimization: Reduce redundant calculations through a sparse self-attention mechanism and improve the computational efficiency of the model.
[0017] 3. Improved prediction accuracy: An interactive learning strategy is used to improve the accuracy of traffic flow prediction, especially in long-term prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 Abstract schematic diagram of the spatial diversity of traffic data;
[0019] Figure 2 This is the network architecture diagram of the traffic flow prediction method;
[0020] Figure 3 This is a comparison chart of the overlap between the traffic flow prediction value and the actual value of two randomly selected nodes;
[0021] Figure 4 A dotted line plot comparing the prediction performance with other models on the same dataset;
[0022] Figure 5 Ablation experiment results to verify the necessity of each component of the network. DETAILED DESCRIPTION
[0023] The specific implementation modes of the present invention are further described below in conjunction with the accompanying drawings to make the technical solutions of the present invention easier to understand and grasp.
[0024] Figure 2 The flowchart of the traffic flow prediction method of the present invention is shown (the English part is all professional terms related to the neural network model), which mainly includes the following steps:
[0025] (1) Constructing the topological structure of the traffic network: The traffic network is modeled through the dynamic graph convolutional network model (DGCN). DGCN uses a graph generator and an adaptive adjacency matrix to dynamically capture the associations between road nodes.
[0026] DGCN will hide the features and the predefined initial adjacency matrix It is fed as input to the diffusion graph convolutional network, which is then fed into the graph generator and MLP layer to generate a discrete matrix containing spatiotemporal information. , . The representation is as follows:
[0027]
[0028] in, represents the diffusive convolution and graph generator operations, Represents a multi-layer perceptron.
[0029] Since the sampling process needs to be differentiable during training, Gumbel reparameterization is used:
[0030]
[0031] In the formula, represents a random variable, is the softmax temperature and its value is 0.5, Represents the adjacency matrix generated by the graph generator that can simulate the dynamic dependencies between nodes.
[0032] In addition, an adaptive adjacency matrix is constructed , which is expressed as follows:
[0033]
[0034] In the formula, , represents the learnable parameters, The initial value of is the predefined adjacency matrix based on the original graph data .
[0035] Through the adaptive fusion module and Fusion, and then the resulting dynamic adjacency matrix Feed it to the diffusion graph convolutional network to extract the hidden dynamic spatiotemporal correlations in the traffic road. The specific operation of this fusion module is as follows:
[0036]
[0037] In the formula, represents a learnable adaptive parameter factor.
[0038] Diffusion graph convolution is used in the graph generator network, fusion graph convolution and connection fusion module, and the input of diffusion graph convolution is uniformly defined as .
[0039] In the graph generator network, the diffuse graph convolution is defined as:
[0040]
[0041] in, is the diffusion step length, is the maximum number of diffusion steps, represents the parameter matrix.
[0042] In the fusion graph convolution module, is the adjacency matrix of the input of the fused graph convolution, where the diffusion graph convolution is expressed as follows:
[0043]
[0044] The present invention realizes the capture and correction of the entire time series features by recombining the dynamic spatiotemporal features extracted from the interactive learning structure in the connection module in the order of time index and then feeding them to the diffusion graph convolution.
[0045] Compared with other methods, the present invention also uses a predefined initial adjacency matrix in the diffusion graph convolution and a dynamic adjacency matrix generated by an interactive learning structure For the initial adjacency matrix , using a directed graph and using and express The forward and backward transfer matrices of . At this time, the diffusion graph convolution in the connection fusion module is represented as follows:
[0046]
[0047] (2) Probabilistic sparse self-attention mechanism: Reduce redundant calculations and optimize attention weight calculations through a sparse self-attention mechanism.
[0048] The typical input form of the self-attention mechanism is , the dot product is calculated as follows:
[0049]
[0050] in, , , and Represents the input query, key, value, and dimension respectively. The attention coefficient of the query as follows:
[0051]
[0052] in, , and They are , and The OK. and Using an asymmetric exponential kernel .
[0053] Self-attention mechanism to calculate dot product The space complexity of However, in the computation of the probabilistic sparse self-attention mechanism, the input lengths of the query and key are usually equivalent, i.e. , so that the total time complexity and space complexity are In addition, the probabilistic sparse self-attention mechanism combines the probabilistic sparse and self-attention mechanisms. On the basis of the self-attention mechanism, the attention coefficient is adjusted so that for each query, only some keys are important to it, that is, a few key dot products provide the main attention, and the rest of the dot products are ignored. This method can indirectly combine complex time dependencies and dynamic spatial features, saving computing resources without affecting the accuracy of the model.
[0054] Probabilistic sparse self-attention Indicates The sparsity of the query, Divergence is used to measure the sparsity of a query, as follows:
[0055]
[0056] The first item is all the keys on The logarithm and exponent of , the arithmetic mean of all keys in the second term. According to the above principle, the probabilistic sparse self-attention mechanism is obtained:
[0057]
[0058] in, Representation and A sparse matrix of the same dimension, consisting only of The previous evaluation under the sparsity The query consists of By constant sampling factor Therefore, the complexity of each query of the probabilistic sparse self-attention mechanism is only A probabilistic sparse self-attention mechanism is adopted, which is able to generate different sparse query key pairs to avoid severe information loss.
[0059] (3) Generate time series input: The historical data of traffic flow is processed through the sliding window method and combined with the node features to input DGCN.
[0060] (4) Interactive learning strategy: By interleaving sampling, the input sequence is divided into multiple subsequences for interactive learning to ensure the synchronous capture of temporal and spatial features, such as Figure 2 shown.
[0061] (5) Traffic flow prediction: Traffic flow prediction is performed based on the trained model. The prediction results are as follows: Figure 3 shown.
[0062] The above detailed description Figure 2 The English terms for technical secondary schools are as follows:
[0063] Interaction Learning: interactive learning;
[0064] Concatenation: connection layer;
[0065] Diffusion Graph Conv: Diffusion graph convolution;
[0066] Multi-head ProbSparse Self-attention: Probabilistic sparse self-attention mechanism;
[0067] Spatial-Temporal Region Convolution: spatiotemporal region convolution;
[0068] MLP: Multi-layer Perceptron;
[0069] Concatenation Fusion: Concatenation fusion operation;
[0070] Splitting Operation: Splitting operation;
[0071] Interaction Learning Strategy: Interaction Learning Strategy;
[0072] Hidden Features: Hidden features;
[0073] Graph Generator: graph generator;
[0074] Masked Fill: Masked fill.
[0075] The performance evaluation of the traffic flow prediction method based on graph neural network described in the present invention requires the use of three indicators: mean absolute error (MAE), mean absolute percentage error (MAPE), and root mean square error (RMSE), and the calculation formula is as follows:
[0076]
[0077]
[0078]
[0079] The experimental results are as follows Figure 4 , the terms for the comparison models selected in the figure are explained as follows:
[0080] DGPSA: Probabilistic Sparse Self-Attention Dynamic Graph Convolutional Network (method described in this invention);
[0081] FNN: Feedforward neural network;
[0082] FC-LSTM: Fully Connected Long Short-Term Memory Network;
[0083] Graph WaveNet: Deep Graph Network.
[0084] STGCN: Spatio-Temporal Graph Convolutional Network.
[0085] In order to prove that each component of the traffic flow prediction method based on graph neural network described in the present invention has a positive effect on the entire model, a set of ablation experiments is needed, that is, removing one of the model components in turn, and then evaluating it according to the three indicators of MAE, MAPE, and RMSE. The experimental results are as follows Figure 5 ,The special terms in the figure are explained as follows:
[0086] w / o GCN: Model after removing the graph convolution module;
[0087] w / o DGCN: Model after removing the dynamic graph convolution module;
[0088] w / o PSA: Model after removing probabilistic sparse self-attention;
[0089] w / o Interaction: The model after removing interactive learning;
[0090] w / o Conv: the model after removing the convolution module;
[0091] DGPSA: Complete model (present invention).
[0092] Of course, the above are only typical examples of the present invention. In addition, the present invention may also have many other specific implementations. All technical solutions formed by equivalent replacement or equivalent transformation fall within the scope of protection required by the present invention.
Claims
1. A traffic flow prediction method based on graph neural network, characterized in that The following steps are involved: S1: Construct the topological structure of the traffic network and use the dynamic graph convolutional network to model the traffic network; S2: Design a fusion probabilistic sparse self-attention mechanism to optimize attention weight calculation through sparse processing; S3: Combine traffic time series data with graph structure data to generate time series input of traffic flow; S4: Capturing the spatiotemporal correlation of segmented traffic data through interactive learning strategies; S5: Based on the trained model, predict the traffic flow in the future period.
2. A traffic flow prediction method based on graph neural network according to claim 1, characterized in that: The dynamic graph convolutional network constructed in step S1 includes a graph generator and an adaptive adjacency matrix, which are used to dynamically simulate the spatiotemporal relationship between nodes.
3. The traffic flow prediction method based on graph neural network according to claim 1 is characterized in that: The probabilistic sparse self-attention mechanism in step S2 reduces the calculation of irrelevant attention weights through the sparsification technology, thereby improving the calculation efficiency of the model.
4. The traffic flow prediction method based on graph neural network according to claim 1 is characterized in that: The step S3 generates a time series input through a sliding window method, and combines the node features with the input of the dynamic graph convolutional network.
5. The traffic flow prediction method based on graph neural network according to claim 1 is characterized in that: The interactive learning strategy in step S4 adopts an interleaved sampling technique to divide the input sequence into multiple subsequences to synchronously capture the dynamic dependencies in time and space.
Citation Information
Patent Citations
Traffic prediction method of space-time interactive dynamic graph attention network
CN116307152A
Traffic flow prediction method of space-time convolution fusion probability sparse attention mechanism
CN117290706A
Traffic flow prediction method based on interactive dynamic graph convolution and probability sparse attention
CN117290707A
Road traffic safety prediction method based on dynamic graph attention space-time network
CN117746628A
Traffic flow forecasting method based on multi-mode dynamic residual graph convolution network
US20230334981A1
Cited By
Electric power system end-to-end unit combination method for driving space-time attention graph neural network through object number fusion
CN120449698A
