Traffic prediction method and system based on spatiotemporal fusion graph neural network

By constructing a spatiotemporal fusion graph neural network, combining the spatiotemporal adjacency matrix and road network matrix, the problem that existing traffic data prediction methods are difficult to retain spatiotemporal features is solved, and higher traffic data prediction accuracy and spatiotemporal correlation capture are achieved.

CN115641720BActive Publication Date: 2025-06-06CHONGQING UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211334070.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-28
Publication Date
2025-06-06
Estimated Expiration
2042-10-28

AI Technical Summary

Technical Problem

Existing traffic data prediction methods are difficult to preserve the spatiotemporal characteristics of traffic data intact, resulting in limited modeling capabilities for complex traffic data and the inability to effectively capture nonlinear connections and dynamic feature changes between road connections.

Method used

The traffic prediction method based on the spatiotemporal fusion graph neural network is adopted to construct a spatiotemporal adjacency matrix by calculating the similarity of historical data sequences between each traffic node, and a lower triangular matrix is ​​composed of the original road network adjacency matrix, and the input full connection layer and spatiotemporal convolution reconstruction layer are used for feature dimensioning and reconstruction, and finally the prediction result is obtained through the output layer.

Benefits of technology

This method can more fully preserve the spatial and temporal characteristics of traffic data, improve the prediction accuracy of traffic data, capture hidden spatial and temporal correlation information, and enhance the prediction ability of traffic flow data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115641720B_ABST
    Figure CN115641720B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of traffic prediction, and specifically discloses a traffic prediction method and system based on a spatiotemporal fusion graph neural network, which utilizes the historical traffic flow data of each traffic node; calculates the similarity of the historical data sequences between each traffic node, and constructs a spatiotemporal adjacency matrix; forms a lower triangular matrix based on the original road network adjacency matrix and the spatiotemporal adjacency matrix; inputs the historical traffic flow data into a fully connected layer for feature dimension upgrading, and sets a spatiotemporal convolution reconstruction layer with multiple sublayers, and uses the dimension upgraded data and the lower triangular matrix as inputs to the spatiotemporal convolution reconstruction layer; aggregates the output of each sublayer of the spatiotemporal convolution reconstruction layer, and inputs the aggregated data into the output layer to obtain a prediction result. The adoption of this technical solution can more completely retain the spatiotemporal characteristics of traffic data and optimize the accuracy of traffic data prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of traffic prediction, and relates to a traffic prediction method and system based on a spatiotemporal fusion graph neural network. Background Art

[0002] In recent years, intelligent transportation systems (ITS) have been developed in many countries around the world. Traffic prediction is the core of ITS. The goal of traffic prediction is to predict recent traffic data through the physical transportation network and combine past and current traffic data. Accurately predicting traffic data at different times of the day in a busy city can help residents arrange their trips effectively, recommend time-saving routes for drivers, and avoid traffic jams. Therefore, the problem of traffic prediction has great research value.

[0003] Traffic data prediction is mainly affected by three characteristics: (1) temporal correlation, where the traffic data of each area can also directly affect itself in the next time step; (2) spatial correlation, where the traffic data of each area can directly affect its spatially adjacent areas at the same time step; and (3) spatiotemporal correlation, where the traffic data of each area can also affect the spatially adjacent areas in the subsequent time steps.

[0004] Early methods proposed to solve traffic data prediction are based on simple time series models, but these methods rely heavily on the assumption of data stationarity, resulting in limited modeling capabilities for complex traffic data. Models based on traditional machine learning methods are used for traffic prediction to model more complex data. Although these methods improve the prediction level, they still cannot effectively capture the nonlinear connections and dynamic feature changes between road connections; and the performance of these models is usually limited by feature engineering and relies on historical experience.

[0005] In recent years, with the rapid development of deep learning, neural network models can well capture the nonlinear connections and dynamic characteristics of traffic data. Models such as recursive neural networks and their variants can effectively use self-loop mechanisms to learn time correlations and obtain better prediction results. Although these models take time correlations into account, they ignore spatial correlations. In order to better characterize spatial characteristics, the traffic network can be modeled as an unstructured graph model, and graph neural network related technologies can be used to more accurately obtain the spatiotemporal correlations between the traffic network and historical time series data.

[0006] The above studies are based on two independent components to capture temporal correlation and spatial correlation. They input the spatial representation into the temporal modeling module to indirectly capture the third effect: spatiotemporal correlation. If the model can directly capture the above three characteristics at the same time, it will be very effective for spatiotemporal data prediction, because this modeling method reveals the basic way of generating spatiotemporal network data. Therefore, constructing a spatiotemporal graph and directly modeling the traffic network and time series data has become a feasible and effective way. However, the spatiotemporal correlation hidden in traffic time series data is organically unified and cannot be separated. The two independent components can only capture the spatial and temporal correlations separately in their respective modules, and cannot fully retain the spatiotemporal characteristics of traffic data. The hidden spatiotemporal correlation information between data will be lost during the training process. Summary of the invention

[0007] The purpose of the present invention is to provide a traffic prediction method and system based on a spatiotemporal fusion graph neural network, which can more completely retain the spatiotemporal characteristics of traffic data and improve the prediction accuracy of traffic data.

[0008] In order to achieve the above object, the basic scheme of the present invention is: a traffic prediction method based on spatiotemporal fusion graph neural network, comprising the following steps:

[0009] Obtain historical traffic flow data for each traffic node;

[0010] Calculate the similarity of historical data sequences between traffic nodes and construct a spatiotemporal adjacency matrix;

[0011] According to the original road network adjacency matrix and the spatiotemporal adjacency matrix, a lower triangular matrix is ​​formed;

[0012] The historical traffic flow data is input into the fully connected layer for feature dimension upgrading, and a spatiotemporal convolutional reconstruction layer with multiple sublayers is set up. The dimension-enhanced data and the lower triangular matrix are used as the input of the spatiotemporal convolutional reconstruction layer.

[0013] The output of the previous sublayer of the spatiotemporal convolutional reconstruction layer is the input of the next sublayer, and each sublayer reconstructs its input;

[0014] The output of each sublayer of the spatiotemporal convolutional reconstruction layer is aggregated, and the data after the aggregation operation is input into the output layer to obtain the prediction result.

[0015] The working principle and beneficial effects of this basic solution are: calculating the distance between the time data series of each node, and forming a lower triangular space-time adjacency matrix together with the original road network adjacency matrix, which fully considers the cumulative impact of historical data. The space-time adjacency matrix can more completely retain the space-time characteristics of traffic data to obtain hidden associated space-time correlations. Capture the space-time correlation of traffic flow data and predict traffic flow through historical time series data. Stack multiple layers of space-time convolutional layers, each layer aggregates the time feature information of historical moments by reconstructing the space-time adjacency matrix, further increasing the prediction accuracy.

[0016] Furthermore, the method for calculating the similarity of the historical data sequences between each traffic node is as follows:

[0017] Given two time series data sequences U and V:

[0018] U=(u 1 ,u 2 ,...,u p ), V=(v 1 ,v 2 ,...,v q )

[0019] Among them, p and q are the lengths of the time series data sequence, and u p is the pth element of the time series data sequence U, v q is the qth element of the time series data sequence V;

[0020] The original distance matrix M∈R p*q is initialized to:

[0021] M(i,j)=|u i -v j |

[0022] Where i∈p, j∈q, p and q are positive integers, R p*q is a matrix with p rows and q columns;

[0023] The final distance matrix M c ∈R p*q Defined as:

[0024] M c (i, j) = M (i, j) + min (M c (i, j-1)M c (i-1,j),M c (i,j))

[0025] M c (p,q) is the distance between the time series data sequences U and V. The closer the distance, the higher the similarity.

[0026] The similarity of historical data sequences between nodes is calculated to obtain the temporal and spatial correlation of hidden associations in traffic data, which is beneficial for subsequent use.

[0027] Furthermore, based on the original road network adjacency matrix and the spatiotemporal adjacency matrix, the lower triangular matrix A is formed st The method is as follows:

[0028] Construct the original road network adjacency matrix A according to the distance of each traffic node s :

[0029]

[0030] Among them, ∈ 1 is a hyperparameter, d ij is the node distance; i∈p, j∈q, p, q are the lengths of the time series data sequence, p, q are positive integers; according to the DTW algorithm, the similarity of the historical time series data sequence between each traffic node is calculated to construct the spatiotemporal adjacency matrix A d :

[0031] A d(i,j) =1,DTW(i,j)<∈ 2

[0032] A d(i,j) =0,DTW(i,j)≥∈ 2

[0033] According to the original road network adjacency matrix A s and the spatiotemporal adjacency matrix A d , forming a lower triangular matrix, as follows:

[0034]

[0035] Among them, ∈ 2 is a hyperparameter; A s ∈R N*N is the original road network adjacency matrix, A d ∈R N*N is the space-time adjacency matrix, T is the number of space-time cycles, and N is the number of nodes;

[0036] A st Each submatrix of is an N*N matrix, A st The whole is a lower triangular matrix; the traffic flow of a node at a specific timestamp t is affected by the traffic data of the previous (t-1) timestamps. In order to predict the traffic flow at timestamp t, the ideal model should aggregate the traffic features from previous timestamps rather than the traffic features from future timestamps. The lower triangular matrix A st Each submatrix A above the main diagonal st(i,j) = 0, where i < j and j ∈ (2,...,T). On the other hand, for the lower triangular matrix A st each sub - element A st (i,j) = A d , where i > j and i ∈ (2,...,T), represents the traffic flow characteristics of the self - node and neighbor nodes at the (t - 1) time stamps before each node aggregates at time stamp t;

[0037] For the lower triangular matrix A st the sub - matrix A st (i,i) = A s ∈R N*N , where i ∈ (1, 2,...,T), represents the traffic flow characteristics of each node aggregating from its 1 - hop spatial neighbors at time stamp t.

[0038] The DTW algorithm is used to calculate the distance between the time - data sequences of each node, and together with the original road network adjacency matrix, it forms a lower - triangular spatio - temporal adjacency matrix, fully considering the cumulative impact of historical data.

[0039] Furthermore, a graph multiplication module is provided within the sub - layer of the spatio - temporal convolution reconstruction layer. The input of this sub - layer and the lower triangular matrix are input into the graph multiplication module:

[0040] h l+1 =(A st *h l *W 1 +b 1 )☉σ(A st *h l *W 2 +b 2 )

[0041] where A st ∈R NT*NT is the lower triangular matrix, T is the spatio - temporal period number, N is the number of nodes; h l ∈R NT*C is the input of this sub - layer, h l+1 is the output of this sub - layer; W 1 , W 2 ∈R C*C and b 1 , b 2 ∈R C are the trainable parameters of the model, C is the feature dimension; ⊙ is the Hadamard product, and σ(·) is the sigmoid activation function;

[0042] The core part of the graph multiplication module A st *h lCharacteristics: The traffic flow of a node at a specific timestamp t is affected by the traffic data of the previous t-1 timestamps, and aggregates the traffic flow characteristics from its 1-hop spatial neighbors at the current moment:

[0043]

[0044] Among them, x t ∈R N*C is the parameter in the time series data sequence, t∈(1, 2, ..., T-1, T); A s ∈R N*N is the original road network adjacency matrix, A d ∈R N*N is the spatiotemporal adjacency matrix; the product of the first row is A s *x 1 , the product of the second row is A d *x 1 +A s *x 2 , the product of the third row is A d *x 1 +A d *x 2 +A s *x 3 , and so on, the product of the Tth row is A d *x 1 +A d *x 2 +...+A d *x T-1 +A s *x T ; Each node at timestamp t accumulates the spatiotemporal correlation of traffic data from the previous t-1 timestamps, and aggregates the traffic flow characteristics from its 1-hop spatial neighbors at the current moment.

[0045] The structure is simple and easy to use.

[0046] Furthermore, each sublayer reconstructs its input as follows:

[0047] The input of the sublayer is:

[0048]

[0049] Among them, p t ∈R N*C is a submatrix, t∈(1, 2, ..., T-1, T), that is, the data of N nodes at the same time are first arranged in the order of node numbers, and then the N nodes as a whole are arranged in the order of timestamps;

[0050] To aggregate the time feature information of a single node for T periods, hl+1 Reconstructed as z l ∈R TN*C :

[0051]

[0052] Each sub-matrix q n ∈R T*C ,n∈(1,2,...,N-1,N), that is, first adjust the data of each node at T moments to be adjacent in sequence, and then arrange the N nodes in the order of node numbers to facilitate feature aggregation.

[0053] Simple operation and easy to use.

[0054] Furthermore, the method of aggregating the output of each sublayer of the spatiotemporal convolutional reconstruction layer is as follows:

[0055] Randomly initialize a learnable parameter matrix B∈R 1*T , N traffic nodes all share the parameter matrix, and each traffic node normalizes its features by multiplying it with the parameter matrix to obtain the output of the node:

[0056]

[0057] Where n∈(1, 2, ..., N-1, N), T is the number of space-time cycles, and Z l ∈R TN*C The reconstructed output of the spatiotemporal convolutional reconstruction layer sublayer;

[0058] Then the output of all N traffic nodes of the graph convolution sublayer is:

[0059]

[0060] Each sublayer will produce the output O of the layer. l , deeper levels can aggregate richer information.

[0061] Furthermore, the spatiotemporal convolutional reconstruction layer sets 4 sublayers, each of which generates the output o of all traffic nodes in the layer. l , l∈(0,1,2,3), for o l ∈R N*C Use max pooling as the aggregation operation:

[0062] o AGG =max(o 1 , o 2 ,o 3 ,o 4 )∈R N*C

[0063] o AGG∈R N*C Input to the output layer, the output layer is a fully connected layer, which directly performs multi-step prediction to avoid the error transmission caused by single-step prediction. The final calculated prediction result is:

[0064]

[0065] Where W∈R C*T , b∈R T are the parameters that need to be trained; Represents the traffic flow values ​​of all N road network nodes in the next T time periods.

[0066] Set an appropriate number of sub-layers in the spatiotemporal convolution reconstruction layer to facilitate use.

[0067] The present invention also provides a traffic prediction system based on a spatiotemporal fusion graph neural network, comprising a data acquisition module and a processing module. The data acquisition module is used to obtain historical traffic flow data of each traffic node. The output end of the data acquisition module is connected to the input end of the processing module. The processing module executes the method of the present invention to perform traffic prediction.

[0068] The system takes into account the cumulative impact of historical data and improves the prediction accuracy.

[0069] Furthermore, it also includes an evaluation module, which extracts a data set from the historical traffic flow data of each traffic node collected by the data collection module, and divides the data set into a training set, a verification set and a test set;

[0070] The mean absolute error, mean absolute percentage error and root mean square error are used as evaluation indicators for the prediction performance of the evaluation module, which are calculated as follows:

[0071]

[0072] in, is the predicted traffic flow result, Y is the actual traffic flow, y i is the true value of the traffic of a node at a certain moment, for y i The predicted value of the traffic at the corresponding node at the corresponding time, N is the number of all true values.

[0073] The evaluation module is used to evaluate the prediction performance of the prediction module and judge the reliability of the prediction module in order to use or improve the prediction module. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] Figure 1 It is a flow chart of the traffic prediction method based on spatiotemporal fusion graph neural network of the present invention. DETAILED DESCRIPTION

[0075] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0076] In the description of the present invention, it is necessary to understand that the terms "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating the orientation or position relationship, are based on the orientation or position relationship shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0077] In the description of the present invention, unless otherwise specified and limited, it should be noted that the terms "installed", "connected" and "connected" should be understood in a broad sense. For example, it can be a mechanical connection or an electrical connection, or it can be the internal connection between two components. It can be a direct connection or an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to the specific circumstances.

[0078] Most of the existing research on traffic data prediction is based on two independent components: using GCN to capture spatial dependencies and obtain spatial representations; using recurrent neural networks to build time modules to capture time dependencies; and then inputting the spatial representation into the time module to indirectly capture the third effect: spatiotemporal correlation. However, the spatiotemporal correlation hidden in traffic time series data is organically unified and cannot be separated. The above two independent components can only capture spatial and temporal correlations separately in their respective modules, and cannot fully retain the spatiotemporal characteristics of traffic data. During the training process, the hidden spatiotemporal correlation information between data will be lost.

[0079] The present invention discloses a traffic prediction method based on a spatiotemporal fusion graph neural network, constructs a new spatiotemporal adjacency matrix, uses the DTW algorithm to calculate the distance between the time data sequences of each node, and together with the original road network adjacency matrix, forms a lower triangular spatiotemporal adjacency matrix, which fully considers the cumulative impact of historical data. The spatiotemporal adjacency matrix can more completely retain the spatiotemporal characteristics of traffic data to obtain hidden associated spatiotemporal correlations. The present invention stacks multiple layers of spatiotemporal convolutional layers, and each layer aggregates the time feature information of historical moments by reconstructing the spatiotemporal adjacency matrix, further increasing the prediction accuracy.

[0080] like Figure 1 As shown in the figure, the traffic prediction method based on spatiotemporal fusion graph neural network includes the following steps:

[0081] Obtain historical traffic flow data for each traffic node;

[0082] Calculate the similarity of historical data sequences between traffic nodes and construct a spatiotemporal adjacency matrix;

[0083] According to the original road network adjacency matrix and the spatiotemporal adjacency matrix, a lower triangular matrix is ​​formed;

[0084] The historical traffic flow data is input into the fully connected layer for feature dimension upgrading, and a spatiotemporal convolutional reconstruction layer with multiple sublayers is set up. The dimension-enhanced data and the lower triangular matrix are used as the input of the spatiotemporal convolutional reconstruction layer.

[0085] The output of the previous sublayer of the spatiotemporal convolutional reconstruction layer is the input of the next sublayer, and each sublayer reconstructs its input;

[0086] The output of each sublayer of the spatiotemporal convolutional reconstruction layer is aggregated, and the data after the aggregation operation is input into the output layer to obtain the prediction result.

[0087] In a preferred embodiment of the present invention, based on the DTW (Dynamic Time Warping, DTW is a classic algorithm for calculating the similarity of two time series) algorithm, the method for calculating the similarity of the historical data series between each traffic node is as follows:

[0088] Given two time series data sequences U and V:

[0089] U=(u 1 ,u 2 ,...,u p ), V=(v 1 ,v 2 ,...,v q )

[0090] Among them, p and q are the lengths of the time series data sequence;

[0091] The original distance matrix M∈R p*q is initialized to:

[0092] M(i,j)=|u i -v j |

[0093] The final distance matrix M c ∈R p*q Defined as:

[0094] M c (i, j) = M (i, j) + min (M c (i, j-1)M c (i-1,j),Mc (i, j))

[0095] M c (p,q) is the distance between the time series data sequences U and V. The closer the distance, the higher the similarity.

[0096] In a preferred embodiment of the present invention, a lower triangular matrix A is formed based on the original road network adjacency matrix and the spatiotemporal adjacency matrix. st The method is as follows:

[0097] Construct the original road network adjacency matrix A according to the distance of each traffic node s :

[0098]

[0099] Among them, ∈ 1 is a hyperparameter, d ij is the node distance; i∈p, j∈q, p, q are the lengths of the time series data sequence, p, q are positive integers; according to the DTW algorithm, the similarity of the historical time series data sequence between each traffic node is calculated to construct the spatiotemporal adjacency matrix A d :

[0100] A d(i,j) =1,DTW(i,j)<∈ 2

[0101] A d(i,j) =0,DTW(i,j)≥∈ 2

[0102] According to the original road network adjacency matrix A s and the spatiotemporal adjacency matrix A d , forming a lower triangular matrix, as follows:

[0103]

[0104] Among them, ∈ 2 is a hyperparameter; A s ∈R N*N is the original road network adjacency matrix, A d ∈R N*N is the space-time adjacency matrix, T is the number of space-time cycles, and N is the number of nodes;

[0105] A st It is the lower triangular matrix that directly retains rich temporal and spatial hidden information; A st Each submatrix of is an N*N matrix, A stThe whole is a lower triangular matrix; the traffic flow of a node at a specific timestamp t is affected by the traffic data of the previous (t-1) timestamps. In order to predict the traffic flow at timestamp t, the ideal model should aggregate the traffic features from previous timestamps rather than the traffic features from future timestamps. The lower triangular matrix A st Each submatrix A above the main diagonal st (i, j) = 0, where i < j, j∈(2, ..., T), on the other hand, the lower triangular matrix A st Each sub-element A below the main diagonal st (i, j) = A d , where i>j, i∈(2,...,T), means that each node aggregates the traffic flow characteristics of its own node and neighbor nodes at the previous (t-1) timestamps at timestamp t; in summary, the spatiotemporal adjacency matrix comprehensively considers the impact of historical data and current data on the current node.

[0106] Lower triangular matrix A st Submatrix A on the main diagonal st (i, i) = A s ∈R N*N , where i∈(1,2,...,T), means that each node aggregates the traffic flow features from its 1-hop spatial neighbors at timestamp t.

[0107] In a preferred embodiment of the present invention, a graph multiplication module is provided in the sublayer of the spatiotemporal convolution reconstruction layer. In each spatiotemporal convolution reconstruction sublayer, the present invention replaces the Laplace decomposition in the graph convolution with a simpler and more time-saving operation: matrix multiplication. st It already contains rich spatiotemporal information of a long historical period. Matrix multiplication is both time-saving and simple, and can also extract sufficient spatiotemporal information. The graph multiplication module also uses a gating mechanism, which uses the nonlinear activation of the gated linear unit to generalize the features of the graph multiplication module, and inputs the input of this sub-layer and the lower triangular matrix into the graph multiplication module:

[0108] h l+1 =(A st *h l *W 1 +b 1 )☉σ(A st *h l *W 2 +b 2 )

[0109] Among them, A st ∈R NT*NT is a lower triangular matrix, T is the number of time-space cycles, N is the number of nodes; h l ∈R NT*Cis the input of this sublayer, h l+1 is the output of this sublayer; W 1 , W 2 ∈R C*C and b 1 , b 2 ∈R C is the trainable parameter of the model, C is the feature dimension; ⊙ is the Hadamard product, σ(·) is the sigmoid activation function;

[0110] The core part of the graph multiplication module A st *h l Characteristics: The traffic flow of a node at a specific timestamp t is affected by the traffic data of the previous t-1 timestamps, and aggregates the traffic flow characteristics from its 1-hop spatial neighbors at the current moment:

[0111]

[0112] Among them, x t ∈R N*C is the parameter in the time series data sequence, t∈(1,2,...,T-1,T); A s ∈R N*N is the original road network adjacency matrix, A d ∈R N*N is the spatiotemporal adjacency matrix; the product of the first row is A s *x 1 , the product of the second row is A d *x 1 +A s *x 2 , the product of the third row is A d *x 1 +A d *x 2 +A s *x 3 , and so on, the product of the Tth row is A d *x 1 +A d *x 2 +...+A d *x T-1 +A s *x T ; Each node at timestamp t accumulates the spatiotemporal correlation of traffic data from the previous t-1 timestamps, and aggregates the traffic flow characteristics from its 1-hop spatial neighbors at the current moment.

[0113] In a preferred embodiment of the present invention, the method for each sub-layer to reconstruct its input is:

[0114] The input of the sublayer is:

[0115]

[0116] Among them, p t ∈R N*C is a submatrix, t∈(1, 2, ..., T-1, T), that is, the data of N nodes at the same time are first arranged in the order of node numbers, and then the N nodes as a whole are arranged in the order of timestamps;

[0117] To aggregate the time feature information of a single node for T periods, h l+1 Reconstructed as z l ∈R TN*C :

[0118]

[0119] Each sub-matrix q n ∈R T*C ,n∈(1,2,,N-1,N), that is, first adjust the data of each node at T moments to be adjacent in sequence, and then arrange the N nodes in the order of node numbers to facilitate feature aggregation.

[0120] In a preferred embodiment of the present invention, the method for performing an aggregation operation on the output of each sublayer of the spatiotemporal convolutional reconstruction layer is as follows:

[0121] Randomly initialize a learnable parameter matrix B∈R 1*T , N traffic nodes all share the parameter matrix, and each traffic node normalizes its features by multiplying it with the parameter matrix to obtain the output of the node:

[0122]

[0123] Where n∈(1, 2, ..., N-1, N), T is the number of space-time cycles, z l ∈R TN*C The reconstructed output of the spatiotemporal convolutional reconstruction layer sublayer;

[0124] Then the output of all N traffic nodes of the graph convolution sublayer is:

[0125]

[0126] More preferably, the spatiotemporal convolutional reconstruction layer is configured with 4 sublayers, each of which generates outputs of all traffic nodes of the layer. l , deeper layers can aggregate richer information. l∈(0,1,2,3), for o l ∈R N*C Use maximum pooling as an aggregation operation to reduce information redundancy and prevent overfitting. The maximum aggregation operation can be expressed as:

[0127] oAGG =max(o 1 ,o 2 ,o 3 ,o 4 )∈R N*C

[0128] o AGG ∈R N*C Input to the output layer, the output layer is a fully connected layer, which directly performs multi-step prediction to avoid the error transmission caused by single-step prediction. The final calculated prediction result is:

[0129]

[0130] Where W∈R C*T , b∈R T are the parameters that need to be trained; Represents the traffic flow values ​​of all N road network nodes in the next T time periods.

[0131] The present invention also provides a traffic prediction system based on a spatiotemporal fusion graph neural network, including a data acquisition module and a processing module. The data acquisition module is used to obtain historical traffic flow data of each traffic node. The output end of the data acquisition module is electrically connected to the input end of the processing module. The processing module executes the method described in the present invention to perform traffic prediction.

[0132] In a preferred embodiment of the present invention, the traffic prediction system based on spatiotemporal fusion graph neural network also includes an evaluation module, which extracts a data set from the historical traffic flow data of each traffic node collected by the data acquisition module, and divides the data set into a training set, a validation set and a test set.

[0133] This solution constructs a new spatiotemporal adjacency matrix that can more completely preserve the spatiotemporal characteristics of traffic data to obtain the hidden spatiotemporal correlation of traffic data. The present invention stacks multiple spatiotemporal graph convolution reconstruction layers, each of which extracts the spatiotemporal information of traffic data at historical and current times by convolution, reconstruction, and aggregation of the spatiotemporal adjacency matrix, further increasing the prediction accuracy of traffic data.

[0134] The mean absolute error, mean absolute percentage error and root mean square error are used as evaluation indicators for the prediction performance of the evaluation module, which are calculated as follows:

[0135]

[0136] in, is the predicted traffic flow result, Y is the actual traffic flow, y i is the true value of the traffic of a node at a certain moment, for yi The predicted value of the traffic of the corresponding node at the corresponding time, N is the number of all true values, which means there are N nodes in total. The evaluation module is used to evaluate the prediction performance of the prediction module and judge the reliability of the prediction module in order to use or improve the prediction module.

[0137] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0138] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

Claims

1. A traffic prediction method based on spatiotemporal fusion graph neural network, It is characterized in that The steps include: Obtain historical traffic flow data for each traffic node; Calculate the similarity of historical data sequences between traffic nodes and construct a spatiotemporal adjacency matrix; According to the original road network adjacency matrix and the spatiotemporal adjacency matrix, a lower triangular matrix is ​​formed; The historical traffic flow data is input into the fully connected layer for feature dimension upgrading, and a spatiotemporal convolutional reconstruction layer with multiple sublayers is set up. The dimension-enhanced data and the lower triangular matrix are used as the input of the spatiotemporal convolutional reconstruction layer. The output of the previous sublayer of the spatiotemporal convolutional reconstruction layer is the input of the next sublayer, and each sublayer reconstructs its input; Aggregate the output of each sublayer of the spatiotemporal convolutional reconstruction layer, and input the aggregated data into the output layer to obtain the prediction result; According to the original road network adjacency matrix and the time-space adjacency matrix, the lower triangular matrix A is formed st The method is as follows: Construct the original road network adjacency matrix A according to the distance of each traffic node s : Among them, ∈ 1 is a hyperparameter, d ij is the node distance; i∈p, j∈q, p, q are the lengths of the time series data sequence, p, q are positive integers; according to the DTW algorithm, the similarity of the historical time series data sequence between each traffic node is calculated to construct the spatiotemporal adjacency matrix A d : A d(i,j) =1,DTW(i,j)<∈ 2 A d(i,j) =0,DTW(i,j)≥∈ 2 According to the original road network adjacency matrix A s and the spatiotemporal adjacency matrix A d , forming a lower triangular matrix, as follows: Among them, ∈ 2 is a hyperparameter; A s ∈R N*N is the original road network adjacency matrix, A d ∈R N*N is the space-time adjacency matrix, T is the number of space-time cycles, and N is the number of nodes; A st Each submatrix of is an N*N matrix, the lower triangular matrix A st Each submatrix A above the main diagonal st (i, j) = 0, where i < j, j∈(2, ..., T), the lower triangular matrix A st Each sub-element A below the main diagonal st (i, j) = A d , where i>j, i∈(2,...,T); Lower triangular matrix A st Submatrix A on the main diagonal st (i, i) = A s ∈R N*N , where i∈(1, 2, ..., T).

2. The traffic prediction method based on spatiotemporal fusion graph neural network as claimed in claim 1, It is characterized in that The method for calculating the similarity of historical data sequences between traffic nodes is as follows: Given two time series data sequences U and V: U=(u 1 ,u 2 ,...,u p ),V=(v 1 ,v 2 ,...,v q ) Among them, p and q are the lengths of the time series data sequence, and u p is the pth element of the time series data sequence U, v q is the qth element of the time series data sequence V; The original distance matrix M∈R p*q is initialized to: M(i,j)=|u i -v j |where i∈p, j∈q, p and q are positive integers, R p*q is a matrix with p rows and q columns; The final distance matrix M c ∈R p*q Defined as: M c (i,j)=M(i,j)+min(M c (i,j-1)M c (i-1,j),M c (i,j)) M c (p,q) is the distance between the time series data sequences U and V. The closer the distance, the higher the similarity.

3. The traffic prediction method based on spatiotemporal fusion graph neural network as claimed in claim 1, It is characterized in that The sublayer of the spatiotemporal convolutional reconstruction layer is equipped with a graph multiplication module, into which the input of the sublayer and the lower triangular matrix are input: h l+1 =(A st *h l *W 1 +b 1 )⊙σ(A st *h l *W 2 +b 2 ) Among them, A st ∈R NT*NT is a lower triangular matrix, T is the number of time-space cycles, N is the number of nodes; h l ∈R NT*C is the input of the corresponding sub-layer, h l+1 is the output of this sublayer; W 1 , W 2 ∈R C*C and b 1 , b 2 ∈R C is the trainable parameter of the model, C is the feature dimension; ⊙ is the Hadamard product, σ is the sigmoid activation function; The core part of the graph multiplication module A st *h l Characteristics: The traffic flow of a node at a specific timestamp t is affected by the traffic data of the previous t-1 timestamps, and aggregates the traffic flow characteristics from its 1-hop spatial neighbors at the current moment: Among them, x t ∈R N*C is the parameter in the time series data sequence, t∈(1, 2, ..., T-1, T); A s ∈R N*N is the original road network adjacency matrix, A d ∈R N*N is the spatiotemporal adjacency matrix; the product of the first row is A s *x 1 , the product of the second row is A d *x 1 +A s *x 2 , the product of the third row is A d *x 1 +A d *x 2 +A s *x 3 , and so on, the product of the Tth row is A d *x 1 +A d *x 2 +...+A d *x T-1 +A s *x T ; Each node at timestamp t accumulates the spatiotemporal correlation of traffic data from the previous t-1 timestamps, and aggregates the traffic flow characteristics from its 1-hop spatial neighbors at the current moment.

4. The traffic prediction method based on spatiotemporal fusion graph neural network as claimed in claim 1, It is characterized in that Each sublayer reconstructs its input as follows: The input of the sublayer is: Among them, p t ∈R N*C is a submatrix, t∈(1,2,...,T-1,T), that is, the data of N nodes at the same time are first arranged in the order of node numbers, and then the N nodes as a whole are arranged in the order of timestamps; To aggregate the time feature information of a single node for T periods, h l+1 Reconstructed as z l ∈R TN*C : Each sub-matrix q n ∈R T*C , n∈(1,2,...,N-1,N), that is, first adjust the data of each node at T moments to be adjacent in sequence, and then arrange the N nodes in the order of node numbers to facilitate feature aggregation.

5. The traffic prediction method based on spatiotemporal fusion graph neural network as claimed in claim 1, It is characterized in that The method of aggregating the output of each sublayer of the spatiotemporal convolutional reconstruction layer is as follows: Randomly initialize a learnable parameter matrix B∈R 1*T , N traffic nodes all share the parameter matrix, and each traffic node normalizes its features by multiplying it with the parameter matrix to obtain the output of the node: Where n∈(1, 2, ..., N-1, N), T is the number of space-time cycles, z l ∈R TN*C The reconstructed output of the spatiotemporal convolution reconstruction layer sublayer; Then the output of all N traffic nodes of the spatiotemporal convolutional reconstruction layer sublayer is:

6. The traffic prediction method based on spatiotemporal fusion graph neural network as claimed in claim 1, It is characterized in that The spatiotemporal convolutional reconstruction layer has four sublayers, each of which generates the output of all traffic nodes in the layer. l , l∈(0,1,2,3), for o l ∈R N*C Use max pooling as the aggregation operation: the AGG =max(o 1 ,the 2 ,the 3 ,the 4 )∈R N*C o AGG ∈R N*C Input to the output layer, the output layer is a fully connected layer, which directly performs multi-step prediction to avoid the error transmission caused by single-step prediction. The final calculated prediction result is: Where W∈R C*T , b∈R T are the parameters that need to be trained; Represents the traffic flow values ​​of all N road network nodes in the next T time periods.

7. A traffic prediction system based on spatiotemporal fusion graph neural network, It is characterized in that It includes a data acquisition module and a processing module. The data acquisition module is used to obtain historical traffic flow data of each traffic node. The output end of the data acquisition module is connected to the input end of the processing module. The processing module executes the method described in one of claims 1-6 to perform traffic prediction.

8. The traffic prediction system based on spatiotemporal fusion graph neural network as claimed in claim 7, It is characterized in that It also includes an evaluation module, which extracts a data set from the historical traffic flow data of each traffic node collected by the data collection module, and divides the data set into a training set, a verification set and a test set; The mean absolute error, mean absolute percentage error and root mean square error are used as evaluation indicators for the prediction performance of the evaluation module, which are calculated as follows: in, is the predicted traffic flow result, Y is the actual traffic flow, y i is the true value of the traffic of a node at a certain moment, for y i The predicted value of the traffic at the corresponding node at the corresponding time, N is the number of all true values.

Citation Information

Patent Citations

  • Short-term traffic flow prediction method based on new deep space-time adaptive fusion graph network

    CN115019504A