Traffic flow prediction model construction method and prediction method based on adaptive dynamic graph

By constructing an adaptive dynamic graph convolutional encoder-decoder network, fusing spatiotemporal encoding vectors and dynamic adjacency matrix, using the gated cyclic unit GGRU and interactive attention mechanism, the problem of insufficient fusion of spatiotemporal features in existing traffic flow prediction is solved, and high-precision traffic flow prediction is achieved.

CN116187555BActive Publication Date: 2025-07-29HUAZHONG UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310124440.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-16
Publication Date
2025-07-29
Estimated Expiration
2043-02-16

AI Technical Summary

Technical Problem

The existing graph neural network cannot effectively utilize the dynamic change information of the road network topology in traffic flow prediction, resulting in poor prediction results and the existing methods fail to fully integrate spatiotemporal features.

Method used

Adaptive dynamic graph convolutional encoder-decoder network is constructed, and the spatiotemporal encoding vector and dynamic adjacency matrix are fused, feature extraction is used to use the gated cyclic unit GGRU, and an interactive attention mechanism is introduced to realize the spatial and temporal change feature prediction of traffic flow.

Benefits of technology

It improves the accuracy and effect of traffic flow prediction, can effectively capture the spatial and temporal changes of traffic flow, and reduces the accumulation of errors in multi-step recursive prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116187555B_ABST
    Figure CN116187555B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of intelligent transportation, specifically to a method for constructing a traffic flow prediction model and prediction method based on an adaptive dynamic graph. The method comprises: calculating the time series similarity of nodes on a road network to construct a static adjacency matrix for the road network; assigning learnable embedding vectors to the road network nodes, combining them with time coding to form a spatiotemporal coding, and constructing a dynamic adjacency graph to represent the temporal evolution of node relationships; fusing the static adjacency matrix with the dynamic adjacency matrix to obtain an adaptive dynamic adjacency matrix; constructing a graph convolutional encoder-decoder network structure, inputting traffic flow data and the dynamic adjacency matrix into the encoder, and extracting features using an adaptive dynamic graph convolutional recurrent network; performing weighted fusion of encoder output features through interactive attention between the encoder and decoder; and inputting the weighted features into the decoder to obtain traffic flow prediction values. This invention can effectively predict the spatiotemporal variation characteristics and patterns of traffic flow, with high prediction accuracy, and improve traffic flow prediction results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of intelligent transportation, and more specifically, relates to a method for constructing a traffic flow prediction model and a prediction method based on an adaptive dynamic graph. Background Art

[0002] With the rapid development of big data and the Internet of Things, urban construction presents the characteristics of intelligence. In traffic lines, sensors such as induction coils, microwave radars, and geomagnetics record a large amount of data, which provides strong support for the intelligent transportation system (ITS). As an important part of ITS, traffic prediction can play an important role in traffic dynamic planning and provide an important basis for traffic departments to make scientific decisions. Traffic data is collected by a large number and various types of sensors. Not only does each time-series data have complex self-correlations, but the intricate road network structure also leads to potential mutual dependencies between data. Therefore, traffic flow prediction is different from general multi-variable time-series prediction problems, and the complex dependence relationships between various variables caused by the road network topology should also be considered.

[0003] Currently, most traffic prediction methods based on graph convolution need to pre-define an adjacency matrix to represent the dependence relationships between nodes. There are also a few studies that adaptively learn the dependence relationships between nodes. However, the graph adjacency matrix obtained by this method is static and does not change with time. In actual traffic conditions, the relationships between nodes have dynamic change patterns, and static graphs cannot accurately describe the real situation. When existing graph neural networks construct traffic flow prediction models, they often process the features of the time and space dimensions separately. This strategy independently models spatio-temporal information, resulting in the model being unable to obtain global information, thereby affecting the model prediction effect. Summary of the Invention

[0004] Aiming at the defects and improvement requirements of the existing technology, the present invention provides a method for constructing a traffic flow prediction model and a prediction method based on an adaptive dynamic graph, and its purpose is to improve the model prediction accuracy by obtaining the global information of the road network.

[0005] To achieve the above purpose, according to one aspect of the present invention, a method for constructing a traffic flow prediction model based on an adaptive dynamic graph is provided, including: constructing a graph convolution encoder-decoder network structure and a training sample set, and obtaining a traffic flow prediction model through iterative training;

[0006] Wherein, each training sample in the training sample set includes an adaptive dynamic graph corresponding to Q time steps before the time period of the training sample and traffic flow label data corresponding to P time steps after; the adaptive dynamic graph at time t j is composed of the static adjacency matrix of the road network and the adaptive adjacency matrix of the road network at time t j of the adaptive adjacency matrix Fusion results in an adaptive adjacency matrix is obtained by concatenating the spatio-temporal encoding vectors of each node in the road network at time t j and both the fusion weight and the concatenation processing weight are parameters to be learned during the iterative training process;

[0007] The spatio-temporal encoding vector is constructed as follows: Assign a spatial embedding vector to each node. The spatial embedding vector is a network parameter and is learned during the iterative training process. Divide the selected time period into multiple time steps at different time scales, encode the time features at each time scale into vectors, concatenate and reduce the dimension to obtain time embedding vectors at multiple moments. The weight for this dimensionality reduction is a parameter to be learned during the iterative training process. Weightedly fuse the time embedding vector at time t j with the spatial embedding vector of node v i to obtain the spatio-temporal encoding vector of node v i at time t j .

[0008] The beneficial effects of the present invention are as follows: In order to make full use of the road network structure information, the method of the present invention proposes a dynamic spatio-temporal embedding method when constructing training samples, fuses spatio-temporal features, including multi-scale time embedding and spatial embedding, and constructs an adaptive adjacency matrix that changes with time. Spatial embedding encodes nodes into static vectors that can represent graph structure information, and time embedding encodes the time information of each time step into feature vectors. The combination of the two vectors forms a spatio-temporal encoding vector, and the multiple spatio-temporal encoding vectors corresponding to each node can represent the dynamic spatio-temporal evolution of node correlations. Therefore, the prediction model constructed by this method can effectively predict the spatio-temporal change characteristics and laws of traffic flow, has high prediction accuracy, and has a better traffic flow prediction effect.

[0009] Furthermore, the fusion method is weighted summation, and the sum of the two weights is 1.

[0010] A further beneficial effect of the present invention is that by using the weighted method, both static spatial information and time-varying information can be considered. At the same time, the number of parameters involved is small, and the method is simple and efficient.

[0011] Furthermore, the construction method of the adaptive adjacency matrix is as follows:

[0012]

[0013] wherein, is the spatio-temporal encoding matrix of the entire road network at time t j , denoted as represents node vi At time t j The spatio-temporal encoding vector, denoted as is the spatial embedding vector of node v i ; is the temporal embedding vector at time tj.

[0014] Furthermore, the encoder unit in the graph convolutional encoder-decoder network structure adopts a gated recurrent unit GGRU;

[0015] Among them, the gated recurrent unit GGRU is obtained by combining a dynamic adaptive graph convolution and a gated recurrent unit GRU, and the graph convolution method of the dynamic adaptive graph convolution is: W = E S W S ; In the formula, H represents the hidden feature matrix; I represents the identity matrix; represents the adaptive dynamic graph corresponding to time t j ; represents the traffic flow data at time tj; W ∈ R N×2×F×h is the weight matrix, E S ∈ R N×e is the spatial embedding matrix composed of the spatial embedding vectors of each node, N is the total number of nodes, and e is the dimension of the spatial embedding vector of each node; W S ∈ R e ×2×F×h is the weight matrix, which is the node-shared parameter to be learned.

[0016] A further beneficial effect of the present invention is that considering that the weight matrix in spectral graph convolution is a shared parameter, and for traffic flow data, there is a certain similarity in the traffic flow sequence patterns between some nodes, while the traffic flow patterns between some nodes may be irrelevant. As a shared parameter, the weight matrix is not prominent enough for node learning. Therefore, the spectral graph convolution is redefined, and by using the method of tensor decomposition, the weight matrix in the spectral graph convolution is made the product of E S and W S , where E S ∈ R N×e is the matrix composed of node embedding vectors, and W S ∈ R e×2×F×h is the weight matrix, which is used as the node-shared parameter. While being able to highlight the different similarities between nodes, the number of parameters is small and the convergence speed is fast.

[0017] Furthermore, in the encoder of the graph convolutional encoder-decoder network structure, Q GGRUs are cascaded; during the encoding operation, the Q adaptive dynamic graphs and traffic flow data corresponding to the Q time steps before the time period taken by each training sample are respectively input into the Q gated recurrent units GGRU connected in cascade, and the spatial embedding matrix composed of the spatial embedding vectors of each node is respectively input into the Q gated recurrent units GGRU. Each GGRU encodes and outputs according to its input information. The encoding method is specifically as follows:

[0018]

[0019]

[0020]

[0021]

[0022] In the formula, represents the adaptive dynamic graph at the current time t j corresponding to; is the traffic flow data at the current time t j ; represents the output of the output gate; are respectively the hidden features of the input data at the previous time t j-1 and the current time t j output by the output gate; is the output of the reset gate; is the output of the update gate; σ is the sigmoid activation function; ⊙ is the Hadamard product; Θ r 、Θ z and Θ h represent graph convolution.

[0023] A further beneficial effect of the present invention is that the encoding operation of each GGRU integrates the aforementioned dynamic adaptive graph convolution. This dynamic adaptive convolution can highlight the different similarities between nodes while having a small number of parameters and a fast convergence speed. Therefore, each GGRU can better adapt to the specific scenario of the road network.

[0024] Furthermore, during each iterative training process, weights are assigned to the outputs of each GGRU in the encoder and used as the input to the decoder in the graph convolutional encoder-decoder network structure. The weight assignment method is as follows:

[0025]

[0026]

[0027] d = D / K

[0028]

[0029]

[0030] Wherein, D is the dimension after feature transformation, K is the number of attention mechanism heads, and f1, f2, and f3 are fully connected layers for dimension transformation; Represents node v i The hidden feature output after being encoded by the encoder; Represents node v i The hidden feature obtained through interactive attention. The hidden features obtained through interactive attention for all nodes at time t' are represented as C t′ ∈R N ×D ; γ t,t′ (k) Represents the attention score; α t,t′ (k) Represents the attention coefficient; t' = t Q+1 , t Q+2 ,..., t Q+P ; Represents node v i The spatio-temporal encoding matrix in the past Q steps; Represents node v i The spatio-temporal encoding matrix in the future P steps.

[0031] A further beneficial effect of the present invention is that based on the spatio-temporal encoding vector, an interactive attention mechanism is introduced between the encoder and the decoder to assign weights to the output of the encoder and input it into the decoder, so as to convert the historical traffic flow features into future traffic flow features. This attention mechanism learns the direct mapping relationship between historical and future time steps to avoid the problem of error accumulation in multi-step recursive prediction.

[0032] Furthermore, the static adjacency matrix is constructed by the dynamic time warping algorithm.

[0033] A further beneficial effect of the present invention is that based on the dynamic programming idea, the distance between the historical time series data between two nodes is adjusted to the minimum to obtain a minimized node correlation matrix. The smaller the value of each element in the matrix, the more similar the traffic flow sequences between the corresponding two nodes. This method has high precision and improves the training effect of the prediction model.

[0034] The present invention also provides a traffic flow prediction method based on an adaptive dynamic graph, including:

[0035] Constructing an adaptive dynamic graph of multiple historical moments according to historical traffic flow data;

[0036] The traffic flow prediction model constructed by using the method for constructing a traffic flow prediction model based on an adaptive dynamic graph as described above predicts future traffic flow data according to the adaptive dynamic graphs at multiple historical moments.

[0037] The beneficial effects of the present invention are as follows: The traffic flow prediction model constructed by using the method for constructing a traffic flow prediction model based on an adaptive dynamic graph as described above is used for traffic flow prediction. Since in the process of constructing the traffic flow prediction model, training samples are constructed by fusing spatio-temporal features. Specifically, the spatio-temporal features include multi-scale time embedding and spatial embedding. By splicing and fusing the spatio-temporal features of each node, an adaptive adjacency matrix that changes with time is constructed. Among them, spatial embedding refers to encoding nodes into static vectors that can represent graph structure information, and time embedding refers to encoding the time information of each time step into feature vectors. The combination of the two vectors forms a spatio-temporal encoding vector, and each node corresponds to multiple spatio-temporal encoding vectors, which can represent the dynamic spatio-temporal evolution of node correlations. Therefore, the prediction model adopted by the present method can effectively predict the spatio-temporal change characteristics and laws of traffic flow, has high prediction accuracy, and has a better traffic flow prediction effect.

[0038] Further, during the prediction process, the outputs of the encoder units in the traffic flow prediction model are used as the inputs of the decoder after weight distribution, and the weight distribution method is as described above.

[0039] A further beneficial effect of the present invention is that: during the prediction process of the present method, the above-mentioned interactive attention mechanism is introduced to distribute weights to the outputs of the encoder and input them into the decoder, so as to convert historical traffic flow features into future traffic flow features. This attention mechanism learns the direct mapping relationship between historical and future time steps to avoid the problem of error accumulation in multi-step recursive prediction.

[0040] The present invention also provides a computer-readable storage medium, which includes a stored computer program. When the computer program is run by a processor, it controls the device where the storage medium is located to execute the method for constructing a traffic flow prediction model based on an adaptive dynamic graph as described above and / or the method for traffic flow prediction based on an adaptive dynamic graph as described above.

[0041] Generally speaking, through the above technical solutions conceived by the present invention, the following beneficial effects can be achieved:

[0042] The present invention discloses an adaptive dynamic graph convolutional recurrent network traffic flow prediction method, including: calculating the similarity of the node time series on the road network, and constructing a static adjacency matrix of the road network; allocating a set of learnable embedding vectors for the road network nodes, combining them with time encoding to form spatio-temporal encoding, and constructing a dynamic adjacency graph therewith to represent the time evolution of node relationships; fusing the static adjacency matrix and the dynamic adjacency matrix to obtain an adaptive dynamic adjacency matrix; constructing a graph convolutional encoder-decoder network structure, inputting traffic flow data and the dynamic adjacency matrix into the encoder together, and performing feature extraction through the adaptive dynamic graph convolutional recurrent network; performing weighted fusion on the encoder output features through an interactive attention module between the encoder and the decoder; inputting the weighted features into the decoder to obtain traffic flow prediction values. The method of the present invention can effectively predict the spatio-temporal change characteristics and laws of traffic flow, has high prediction accuracy, and improves the traffic flow prediction effect. Description of the Drawings

[0043] Figure 1 It is an overall framework diagram of a traffic flow prediction model based on a graph convolutional encoder-decoder network structure provided by an embodiment of the present invention;

[0044] Figure 2 It is a specific internal structure diagram of a gated recurrent unit integrating adaptive graph convolution provided by an embodiment of the present invention;

[0045] Figure 3 It is a comparison diagram of the actual value and the predicted value of the traffic flow on node 0 in the PeMSD4 dataset provided by an embodiment of the present invention;

[0046] Figure 4 It is a comparison diagram of the actual value and the predicted value of the traffic flow on node 0 in the PeMSD8 dataset provided by an embodiment of the present invention; Detailed Embodiments

[0047] In order to make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0048] Embodiment 1

[0049] A method for constructing a traffic flow prediction model based on an adaptive dynamic graph, including: constructing a graph convolutional encoder-decoder network structure and a training sample set, and obtaining a traffic flow prediction model through iterative training;

[0050] Among them, each training sample in the training sample set includes the adaptive dynamic graph of Q moments corresponding to the Q time steps before the time period of the training sample and the traffic flow label data of P moments corresponding to the P time steps after the time period; j The adaptive dynamic graph is composed of the static adjacency matrix of the road network and the road network at time t j Adaptive adjacency matrix Fusion obtains, adaptive adjacency matrix It is achieved by calculating the time of each node in the road network at time t j The spatiotemporal coding vectors are spliced together to obtain the fusion weights and the splicing weights, and both the fusion weights and the splicing weights are parameters to be learned in the iterative training process;

[0051] The construction method of the spatiotemporal coding vector is as follows: a spatial embedding vector is assigned to each node, and the spatial embedding vector is used as a network parameter and is learned in the iterative training process; the time period is divided into multiple time steps at different time scales, and the time features at each time scale are encoded into vectors and spliced and reduced in dimension to obtain the time embedding vectors of multiple moments. The dimensionality reduction weight is the parameter to be learned in the above iterative training process; the time t j The temporal embedding vector of node v i The above spatial embedding vectors are weighted fused to obtain node v i At time t j The space-time encoding vector of .

[0052] The method of this embodiment uses the adaptive dynamic graph of Q moments to predict the traffic flow data of the future time step. j The adaptive dynamic graph is composed of the static adjacency matrix of the road network and the road network at time t j Adaptive adjacency matrix The fusion is obtained, and the adaptive adjacency matrix It is achieved by calculating the time of each node in the road network at time t j Therefore, the adaptive dynamic graph splicing at Q moments can form an adaptive adjacency matrix of the road network, which can represent the time evolution of node relationships.

[0053] This method proposes a dynamic spatiotemporal embedding method, which includes multi-scale temporal embedding and spatial embedding. Spatial embedding encodes nodes into static vectors that can represent graph structural information, while temporal embedding encodes the temporal information of each time step into a feature vector. The two vectors are combined to form a spatiotemporal encoding vector. The multiple spatiotemporal encoding vectors corresponding to each node can represent the dynamic spatiotemporal evolution of node correlations. Therefore, this method can effectively predict the spatiotemporal variation characteristics and patterns of traffic flow, with high prediction accuracy and excellent traffic flow prediction results. The fusion weights and splicing weights are used as parameters to be learned, which has strong adaptability and improves prediction accuracy.

[0054] Specifically, regarding the construction of the spatio-temporal coding vector, the implementation method is as follows: (1) Learn the spatial embedding matrix. Assign an embedding vector of dimension e to each node v i ∈V. The node embedding vector is randomly initialized as a network parameter and the final learned representation is obtained through network training. The spatial embedding matrix composed of node embedding vectors is denoted as E S ∈R N×e , is a vector. (2) Learn the temporal embedding matrix. Extract temporal features, including moment features and day features. According to the data recording time interval, divide a day into T d time steps. For example, if a data is recorded every 5 minutes, then T d = 288; the number of days in a week is 7 days, let T w = 7, encode the two temporal features into one-hot vectors respectively, and obtain e Tw ∈R 7 , and obtain a vector of dimension by vector concatenation. Input it into a multi-layer fully connected network, and use the ReLU function to activate between layers. Finally, obtain the temporal embedding e i T ∈R e at each time point j, with the same dimension as the node embedding. (3) Add and fuse the temporal embedding and the spatial embedding matrix to obtain the spatio-temporal coding matrix. For node v i ∈V, the spatio-temporal coding vector at time t j is The construction method of spatio-temporal coding is simple and direct, without too many parameters, but it is the core of the overall network, used to realize the dynamic graph evolution, and is also the key to the conversion from history to future. This method learns the spatial dependence relationship of nodes in the road network through an automatic learning method, with strong adaptability.

[0055] As a preferred implementation, the above fusion method is weighted summation, and the sum of the two weights takes the value of 1. It is denoted as where α + β = 1, which are parameters to be determined.

[0056] As a preferred implementation, the construction method of the adaptive adjacency matrix is:

[0057]

[0058] where, is the spatio-temporal coding matrix of the entire road network at time t j denoted as Denote node v i The spatio-temporal encoding vector at time tj, denoted as For node v i The spatial embedding vector (including geographical location information); For time t j The time embedding vector.

[0059] That is, multiply the spatio-temporal encoding matrix by its transpose, perform non-linear transformation and normalization. The spatio-temporal encoding of the entire road network at time t j Is denoted as For matrix After non-linear transformation and normalization, the adaptive graph at time t j Can be obtained

[0060] As a further preferred implementation, the encoder unit in the graph convolutional encoder-decoder network structure uses the gated recurrent unit GGRU;

[0061] Among them, the gated recurrent unit GGRU is obtained by combining the dynamic adaptive graph convolution and the gated recurrent unit GRU, and the graph convolution method of the dynamic adaptive graph convolution is: W = E S W S ; In the formula, H represents the hidden feature matrix; I represents the identity matrix; Represents the adaptive dynamic graph corresponding to time t j ; Represents the traffic flow data at time t j ; W ∈ R N×2×F×h Is the weight matrix, E S ∈ R N×e Is the spatial embedding matrix composed of the spatial embedding vectors of each node, N is the total number of nodes, and e is the dimension of the spatial embedding vector of each node; W S ∈ R e×2×F×h Is the weight matrix, which is the node sharing parameter to be learned.

[0062] Now the above convolution method is explained as follows:

[0063] The general spectral graph convolution formula is: Among them, W ∈ R 2×F×his the weight matrix and is a parameter to be learned. For the nodes in the graph, the W in graph convolution is parameter - shared. The way of sharing parameters helps to learn the most prominent patterns of all nodes, but it may be sub - optimal for traffic flow data. There is a certain similarity in the traffic flow sequence patterns between some nodes, while the traffic flow patterns between some nodes may be completely unrelated. A direct and simple method is to assign a unique parameter space to each node, and the parameter matrix is denoted as W′∈R N×2×F×h , which will cause problems such as an excessive number of parameters and difficulty in convergence. Therefore, consider using the method of tensor decomposition, let W' = E S W S , where, E S ∈R N×e is the matrix composed of node embedding vectors, and W S ∈R e×2×F×h is the weight matrix and is the parameter shared by nodes. Redefine graph convolution:

[0064] Furthermore, the encoder in the graph convolution encoder - decoder network structure uses Q cascaded GGRUs; when performing the encoding operation, the adaptive dynamic graph and traffic flow data corresponding to Q time steps before the time period taken by each training sample are respectively input into the Q cascaded gated recurrent units GGRUs, and the spatial embedding matrix composed of the spatial embedding vectors of each node is respectively input into the Q gated recurrent units GGRUs. Each GGRU performs encoding output according to its input information, and the encoding method is specifically:

[0065]

[0066]

[0067]

[0068]

[0069] In the formula, represents the adaptive dynamic graph corresponding to the current time t j ; is the traffic flow data at the current time t j ; represents the output of the output gate; are respectively the hidden features of the input data at the previous time t j-1 and the current time t j ; is the output of the reset gate; is the output of the update gate; σ is the sigmoid activation function; ⊙ is the Hadamard product; Θ r , Θz and Θ h denotes graph convolution.

[0070] GRU is a variant of LSTM, which realizes the control of the input at the current moment and the retention of the information of the past state through the gating mechanism, so as to realize the extraction of temporal features. Different from that, GRU only contains two gates, the update gate and the reset gate. The larger the value of the update gate and the smaller the value of the reset gate, the less information of the previous state is retained. Combining the dynamic adaptive graph convolution with the gated recurrent unit, for time t j , the corresponding adaptive adjacency matrix of the graph is The internal calculation formula of the gated recurrent unit integrating graph convolution is as above.

[0071] In the spatio-temporal multi-step prediction task, some models adopt the recursive output method. During training, the real historical time series is used as the input for the next moment. During testing, the output of the previous moment is used as the input for the next moment. Due to the difference in the distribution between the training set and the test set, this method will lead to a performance decline. In order to reduce the error of multi-step prediction and reduce the output time, as a further preferable implementation scheme, an attention mechanism based on spatio-temporal coding is proposed to calculate the attention coefficient between the future spatio-temporal coding and the past spatio-temporal coding, and assign weights to the hidden features output by the encoder to obtain the input representation of the decoder. That is, during each iteration training process, weights are assigned to the outputs of each GGRU in the encoder and used as the input of the decoder in the traffic flow prediction network. Among them, the weight assignment method is:

[0072]

[0073]

[0074] d = D / K

[0075]

[0076]

[0077] In the formula, D is the dimension after feature transformation, K is the number of attention mechanism heads, and f1, f2, f3 are fully connected layers for dimension transformation; denotes the node v i the hidden feature output after being encoded by the encoder; denotes the node v i the hidden feature obtained through interactive attention. The hidden features obtained through interactive attention of all nodes at time t' are represented as C t′ ∈R N ×D ; γ t,t′ (k)Denote the attention score; α t,t′ (k) Denote the attention coefficient; t′ = t Q+1 , t Q+2 ,..., t Q+P ; Denote the spatio - temporal encoding matrix of node v i in the past Q steps; Denote the spatio - temporal encoding matrix of node v i in the future P steps.

[0078] The decoder consists of a graph convolutional layer and a fully - connected layer. The graph convolutional layer uses the dynamic adaptive adjacency matrix A t′ to further extract spatial information; the fully - connected layer performs dimensional transformation to obtain the final predicted output

[0079] As a preferred implementation, the static adjacency matrix is constructed by the dynamic time warping algorithm.

[0080] Specifically, using dynamic time warping (DTW), calculate the similarity of the time series of nodes on the road network, construct the static adjacency matrix of the road network, and use the Top - K mechanism for sparsification. Dynamic time warping (DTW) is often used to measure the correlation between two time series with different lengths. Based on the dynamic programming idea, adjust the distance between the historical time series data between pairwise nodes to the minimum to obtain the minimized node correlation matrix. The smaller the value of each element in the matrix, the more similar the traffic flow sequences between the corresponding two nodes. Finally, obtain the static adjacency matrix A pre .

[0081] Embodiment 2

[0082] A traffic flow prediction method based on an adaptive dynamic graph, including:

[0083] Construct an adaptive dynamic graph of multiple historical moments according to historical traffic flow data;

[0084] Adopt the traffic flow prediction model constructed by the traffic flow prediction model construction method based on an adaptive dynamic graph as described in Embodiment 1 above, and predict future traffic flow data according to the adaptive dynamic graph of multiple historical moments.

[0085] As a preferred implementation, during the prediction process, the outputs of each encoder unit in the traffic flow prediction model are used as the inputs of the decoder after weight assignment, and the weight assignment method is as described in Embodiment 1.

[0086] To illustrate the implementation effect of the present invention, the following example experiments are given:

[0087] (1) Obtain the dataset.

[0088] Two publicly available datasets (PeMSD4, PeMSD8) were selected for the experiments. PeMSD4 is the data collected from 307 detection points in the San Francisco Bay Area, with the date from January 1, 2018 to February 29, 2018, a total of 59 days. PeMSD8 is the data collected from 170 detection points in San Bernardino, with the date from July 1, 2016 to August 31, 2016, a total of 62 days. The sampling interval of both datasets is 5 minutes, and the features recorded by each sensor include the traffic flow, vehicle speed, and road occupancy passing through the road surface. Before the experiment, the data was preprocessed using standard normalization, and the dataset was divided into a training set, a validation set, and a test set in the ratio of 6:2:2.

[0089] (2) Experimental settings

[0090] The batch size of the training data was set to 64, the input step was 12, and the output steps were selected as 6 and 12, that is, the traffic flow in the next 30 minutes and 1 hour was predicted using the data in the previous 1 hour. For the PeMSD4 dataset, the learning rate was set to 0.005, for the PeMSD8 dataset, the learning rate was set to 0.003, the epoch was set to 100, the ADAM optimizer was adopted, and the Mean Absolute Error (MAE) was used as the loss function. To prevent overfitting, the Early Stopping strategy was used. When the error of the validation set did not decrease for 10 consecutive epochs, the training was stopped. The Mean Absolute Error (MAE), Root Mean Square Error (RMSE), and Mean Absolute Percentage Error (MAPE) were used as evaluation metrics in the experiment.

[0091] Five baseline models were selected for comparative analysis, namely LSTM, DCRNN, STGCN, ASTGCN, and AGCRN. Among them, LSTM: Long Short-Term Memory network, a classic time series network. In the experiment, a training model was built for each node separately, and this model could not extract the spatial dependencies between nodes. STGCN: uses one-dimensional temporal convolution to extract the temporal dependencies of traffic data and spectral graph convolution to extract the spatial dependencies of road networks, and alternately stacks the two modules. DCRNN: Diffusion Convolutional Recurrent Network, regards the road topology as a directed graph, uses the way of bidirectional random walk to obtain the graph structure, combines graph convolution with GRU, and constructs an encoder-decoder network to recursively output future prediction values. ASTGCN: considers traffic flow data at different scales, models the three time attributes of hour, day, and week respectively, and each module contains temporal, spatial attention and temporal, spatial convolution. AGCRN: proposes adaptive graph convolution, constructs an adjacency matrix by learning node embedding vectors, and combines GRU for prediction.

[0092] (3) Experimental Results and Analysis

[0093] The experimental results are shown in Tables 1 and 2. The performance of the LSTM model is the worst because LSTM can only extract features in the time dimension and cannot utilize road topology information. Other graph-based prediction models consider the spatial dependencies between nodes. Therefore, the prediction results are significantly better than those of LSTM, and the model constructed in this embodiment (ADGCRN: Adaptive dynamic graph convolutional recurrent network) achieves more advanced prediction performance than other models. For example, for the 1-hour prediction task on the PeMSD4 dataset, ADGCRN reduces the MAE by 5.31% compared to AGCRN and by 11.62% compared to DCRNN, indicating that this model has better performance in long-term prediction tasks. Figure 3 It shows the prediction ability of ADGCRN on a certain working day. It can be seen that during the morning and evening rush hours, the traffic flow fluctuates significantly, but ADGCRN still well fits the "double peak" pattern, captures the changing trend of the traffic flow, and maintains a low prediction error. ADGCRN uses a learnable method to capture the hidden relationship between nodes in the road network and considers the evolution of the potential road network topology over time.

[0094] On the premise of not adding too many parameters, by combining time encoding with the node embedding matrix, the static graph is cleverly transformed into a dynamic graph, which helps to improve the prediction accuracy. In addition, time encoding is not only used to generate the dynamic graph but also used to input the spatio-temporal interaction attention layer to obtain the future output representation at one time, reducing the error accumulation of recursive output.

[0095] Table 1 Experimental Results of PeMSD4 Dataset

[0096]

[0097] Table 2 Experimental Results of PeMSD8 Dataset

[0098]

[0099] Therefore, the correlation between traffic flow sequences is obtained through the dynamic time warping method, and a time-invariant static graph is constructed. Noticing that the traffic flow has significant periodic characteristics, the time encoding and node embedding are fused into spatio-temporal encoding, and a dynamic graph evolving with time period is constructed based on this. The static graph and the dynamic graph are fused into an adaptive dynamic graph. They are jointly input into the encoder together with the traffic flow data. The encoder is composed of an improved adaptive graph convolutional gated recurrent unit to extract the time and space features of the traffic flow. An interactive attention module is added between the encoder and the decoder to perform weighted fusion on the extracted spatio-temporal features. This method verifies the prediction performance of the model through traffic flow prediction experiments on two real highway traffic datasets. The results show that the model achieves better prediction results than other models.

[0100] The related technical solutions are the same as those in Embodiment 1 and will not be elaborated here.

[0101] Embodiment 3

[0102] A computer-readable storage medium, the computer-readable storage medium includes a stored computer program, wherein when the computer program is run by a processor, it controls the device where the storage medium is located to execute a method for constructing a traffic flow prediction model based on an adaptive dynamic graph as described in Embodiment 1 above and / or a traffic flow prediction method based on an adaptive dynamic graph as described in Embodiment 2 above.

[0103] The related technical solutions are the same as those in Embodiment 1 and Embodiment 2 and will not be elaborated here.

[0104] Generally speaking, the present invention discloses an adaptive dynamic graph convolutional recurrent network traffic flow prediction method, including: calculating the similarity of the node time series on the road network to construct a static adjacency matrix of the road network; allocating a group of learnable embedding vectors to the road network nodes, combining them with time encoding to form spatio-temporal encoding, and constructing a dynamic adjacency graph therewith to represent the time evolution of node relationships; fusing the static adjacency matrix and the dynamic adjacency matrix to obtain an adaptive dynamic adjacency matrix; constructing a graph convolutional encoder-decoder network structure, inputting traffic flow data and the dynamic adjacency matrix into the encoder together, and performing feature extraction through an adaptive dynamic graph convolutional recurrent network; performing weighted fusion on the encoder output features through an interactive attention module between the encoder and the decoder; inputting the features with weights into the decoder to obtain traffic flow prediction values. The method of the present invention can effectively predict the spatio-temporal change characteristics and laws of traffic flow, has high prediction accuracy, and improves the traffic flow prediction effect.

[0105] Those skilled in the art can easily understand that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for constructing a traffic flow prediction model based on an adaptive dynamic graph, characterized in that, Including: Construct a graph convolutional encoder-decoder network structure and a training sample set, and obtain a traffic flow prediction model through iterative training; Among them, each training sample in the training sample set includes the adaptive dynamic graphs at Q moments corresponding to the Q time steps before the time period to which the training sample belongs and the traffic flow label data at P moments corresponding to the subsequent P time steps; the moment t j The adaptive dynamic graph is obtained by fusing the static adjacency matrix of the road network and the adaptive adjacency matrix of the road network at the moment t j The adaptive adjacency matrix is obtained by splicing the spatio-temporal encoding vectors of each node in the road network at the moment t and both the fusion weight and the splicing processing weight are parameters to be learned in the iterative training process; j ​ The construction method of the spatio-temporal coding vector is as follows: assign a spatial embedding vector to each node, and the spatial embedding vector is used as a network parameter and learned during the iterative training process; divide the selected time period into multiple time steps at different time scales, encode the time features at each time scale into vectors, and then splice and reduce the dimension to obtain time embedding vectors at multiple moments, and the weight of the dimensionality reduction is a parameter to be learned during the iterative training process; at time t j the time embedding vector is weighted and fused with the spatial embedding vector of node v i to obtain the spatio-temporal coding vector of node v i at time t j ; Among them, the encoder in the graph convolutional encoder-decoder network structure adopts Q cascaded GGRUs; when performing the encoding operation, the adaptive dynamic graphs and traffic flow data corresponding to Q time steps before the time period taken by each training sample are respectively input into the Q cascaded gated recurrent units GGRUs, and the spatial embedding matrices composed of the spatial embedding vectors of each node are respectively input into the Q gated recurrent units GGRUs. Each GGRU encodes and outputs according to its input information, calculates the attention coefficient between the future spatio-temporal encoding and the past spatio-temporal encoding, and assigns weights to the hidden features output by the encoder to obtain the input representation of the decoder.

2. The method for constructing a traffic flow prediction model according to claim 1, wherein The fusion method is weighted summation, and the sum of the two weights takes a value of 1.

3. The method for constructing a traffic flow prediction model according to claim 1, characterized in that The adaptive adjacency matrix is constructed as follows: Among them, is the spatio-temporal encoding matrix of the entire road network at time t j , expressed as represents the spatio-temporal encoding vector of node v i at time t j , expressed as is the spatial embedding vector of node v i ; is the time embedding vector at time t j .

4. The method for constructing a traffic flow prediction model according to claim 3, characterized in that, The encoder unit in the graph convolutional encoder-decoder network structure adopts a gated recurrent unit GGRU; Among them, the gated recurrent unit GGRU is obtained by combining dynamic adaptive graph convolution and the gated recurrent unit GRU, and the graph convolution method of dynamic adaptive graph convolution is as follows: W = E S W S ; in the formula, H represents the hidden feature matrix; I represents the identity matrix; represents the time t j corresponding adaptive dynamic graph; represents the time t j traffic flow data; W ∈ R N×2×F×h is the weight matrix, E S ∈ R N×e is the spatial embedding matrix composed of the spatial embedding vectors of each node, N is the total number of nodes, and e is the dimension of the spatial embedding vector of each node; W S ∈ R e×2×F×h is the weight matrix, which is the node-shared parameter to be learned.

5. The method for constructing a traffic flow prediction model according to claim 4, wherein The encoding method of the encoder is specifically: In the formula, represents the adaptive dynamic graph at the current time t j corresponding to; is the traffic flow data at the current time t j ; represents the output of the output gate; are respectively the hidden features of the input data at the previous time t j-1 and the current time t j output by the output gate; is the output of the reset gate; is the output of the update gate; σ is the sigmoid activation function; ⊙ is the Hadamard product; Θ r , Θ z and Θ h represent graph convolution.

6. The method for constructing a traffic flow prediction model according to claim 5, characterized in that, During each iterative training process, weights are assigned to the outputs of each GGRU in the encoder and used as the input of the decoder in the graph convolutional encoder-decoder network structure. Among them, the weight assignment method is: Where D is the dimension after feature transformation, K is the number of attention mechanism heads, and f1, f2, and f3 are fully connected layers for dimension transformation; denotes node v i the hidden feature output after encoding by the encoder; denotes node v i the hidden feature obtained through interactive attention. The hidden features obtained through interactive attention for all nodes at time t′ are denoted as C t′ ∈R N ×D ; γ t,t′ (k) denotes the attention score; α t,t′ (k) denotes the attention coefficient; t′ = t Q+1 , t Q+2 ,..., t Q+P ; denotes node v i the spatio-temporal encoding matrix of node v in the past Q steps; denotes node v i the spatio-temporal encoding matrix of node v in the future P steps.

7. The method for constructing a traffic flow prediction model according to claim 1, wherein: The static adjacency matrix is constructed by the dynamic time warping algorithm.

8. A traffic flow prediction method based on adaptive dynamic graph, characterized in that: Including: According to historical traffic flow data, construct an adaptive dynamic graph of multiple historical moments; Using the traffic flow prediction model constructed by the method for constructing a traffic flow prediction model based on an adaptive dynamic graph according to any one of claims 1 to 7, predict future traffic flow data according to the adaptive dynamic graph of multiple historical moments.

9. The traffic flow prediction method according to claim 8, wherein During the prediction process, the outputs of each encoder unit in the traffic flow prediction model are used as the input of the decoder after being assigned weights, and the weight assignment method is as described in the method for constructing a traffic flow prediction model based on an adaptive dynamic graph according to claim 6.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program. Among them, when the computer program is run by a processor, it controls the device where the storage medium is located to execute the method for constructing a traffic flow prediction model based on an adaptive dynamic graph according to any one of claims 1 to 7 and / or the method for predicting traffic flow based on an adaptive dynamic graph according to claim 8 or 9.