CN115641720A - Traffic prediction method and system based on space-time fusion graph neural network - Google Patents

Traffic prediction method and system based on space-time fusion graph neural network Download PDF

Info

Publication number
CN115641720A
CN115641720A CN202211334070.1A CN202211334070A CN115641720A CN 115641720 A CN115641720 A CN 115641720A CN 202211334070 A CN202211334070 A CN 202211334070A CN 115641720 A CN115641720 A CN 115641720A
Authority
CN
China
Prior art keywords
time
traffic
data
space
matrix
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211334070.1A
Other languages
Chinese (zh)
Inventor
葛亮
李钦鸿
贾艺璇
叶小凤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing University
Original Assignee
Chongqing University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing University filed Critical Chongqing University
Priority to CN202211334070.1A priority Critical patent/CN115641720A/en
Publication of CN115641720A publication Critical patent/CN115641720A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention belongs to the technical field of traffic prediction, and particularly discloses a traffic prediction method and a system based on a space-time fusion graph neural network, wherein the method utilizes historical traffic flow data of each traffic node; calculating the similarity of historical data sequences among all traffic nodes, and constructing a space-time adjacency matrix; forming a lower triangular matrix according to the original road network adjacency matrix and the space-time adjacency matrix; inputting historical traffic flow data into a full-connection layer for feature dimension increasing, setting a space-time convolution reconstruction layer with a plurality of sub-layers, and taking the dimension-increased data and a lower triangular matrix as the input of the space-time convolution reconstruction layer; and performing aggregation operation on the output of each sub-layer of the time-space convolution reconstruction layer, and inputting the data subjected to the aggregation operation into the output layer to obtain a prediction result. By adopting the technical scheme, the space-time characteristics of the traffic data can be more completely reserved, and the traffic data prediction precision is optimized.

Description

Traffic prediction method and system based on space-time fusion graph neural network
Technical Field
The invention belongs to the technical field of traffic prediction, and relates to a traffic prediction method and system based on a space-time fusion map neural network.
Background
In recent years, intelligent Transportation Systems (ITS) have been developed in many countries around the world, traffic prediction being the core of ITS, the goal of which is to predict recent traffic data through a physical traffic network, combining past and current traffic data. The method and the system can accurately predict traffic data of different time periods in a busy city day, help residents to effectively arrange a journey, recommend a time-saving path for a driver, and avoid traffic jam. Therefore, the traffic prediction problem has great research value.
Traffic data prediction is mainly affected by three characteristics: (1) Time correlation, the traffic data of each area can also directly affect itself at the next time step; (2) Spatial correlation, where traffic data for each region may directly affect its spatially adjacent regions at the same time step; (3) Spatio-temporal correlation, traffic data for each region may also affect spatially neighboring regions at subsequent time steps.
Early proposed methods for solving traffic data prediction were based on simple time series models, but these methods heavily rely on data stationary assumptions, resulting in limited modeling capability for complex traffic data. Models based on traditional machine learning methods are used for traffic prediction to model more complex data, and although these methods improve the prediction level, they still cannot effectively capture the non-linear connections and dynamic characteristic changes between road connections; and the performance of these models is often limited by feature engineering, relying on historical experience.
In recent years, with the rapid development of deep learning, the neural network model can well capture the non-linear connection and dynamic characteristics of traffic data. The model such as the recurrent neural network and the variant thereof can effectively utilize the self-circulation mechanism to learn the time correlation and obtain a better prediction result. While these models take into account temporal correlation, spatial correlation is ignored. In order to better represent spatial characteristics, a traffic network can be modeled into an unstructured graph model, and the time-space correlation between the traffic network and historical time-series data can be acquired more accurately by using a graph neural network correlation technology.
The above studies are all based on two independent components to capture the temporal and spatial correlations, which input the spatial representation to the temporal modeling module to indirectly capture the third kind of influence: spatio-temporal correlation. If the model can directly capture the above three characteristics at the same time, it will be very effective for spatio-temporal data prediction because this modeling method reveals the basic way of spatio-temporal network data generation. Therefore, constructing a space-time diagram and directly modeling the traffic network and the time series data uniformly becomes a feasible and effective mode. However, the spatial and temporal correlation hidden in the traffic time series data is organically unified and cannot be split. The two independent components can only capture space and time correlation independently in respective modules, the space-time characteristics of traffic data cannot be completely reserved, and hidden space-time correlation information among the data can be lost in the training process.
Disclosure of Invention
The invention aims to provide a traffic prediction method and a system based on a space-time fusion graph neural network, which can more completely retain the space-time characteristics of traffic data and improve the prediction accuracy of the traffic data.
In order to achieve the purpose, the basic scheme of the invention is as follows: a traffic prediction method based on a space-time fusion graph neural network comprises the following steps:
acquiring historical traffic flow data of each traffic node;
calculating the similarity of historical data sequences among all traffic nodes, and constructing a space-time adjacency matrix;
forming a lower triangular matrix according to the original road network adjacency matrix and the space-time adjacency matrix;
inputting historical traffic flow data into a full-connection layer for feature dimension increasing, setting a space-time convolution reconstruction layer with a plurality of sub-layers, and taking the dimension-increased data and a lower triangular matrix as the input of the space-time convolution reconstruction layer;
the output of the previous sub-layer of the space-time convolution reconstruction layer is the input of the next sub-layer, and each sub-layer reconstructs the input of the sub-layer;
and performing aggregation operation on the output of each sub-layer of the time-space convolution reconstruction layer, and inputting the data subjected to the aggregation operation into the output layer to obtain a prediction result.
The working principle and the beneficial effects of the basic scheme are as follows: and calculating the distance between the time data sequences of each node, and forming a lower triangular space-time adjacency matrix together with the original road network adjacency matrix, thereby fully considering the cumulative influence of historical data. The space-time adjacency matrix can more completely reserve the space-time characteristics of the traffic data to obtain the hidden associated space-time correlation. And capturing the time-space correlation of the traffic flow data, and predicting the traffic flow through historical time sequence data. And stacking a plurality of layers of space-time convolution layers, and further increasing the prediction precision of each layer by reconstructing the space-time adjacent matrix and aggregating the time characteristic information of the historical moment.
Further, the method for calculating the similarity of the historical data sequences among the traffic nodes is as follows:
given two time series data sequences U, V:
U=(u 1 ,u 2 ,...,u p ),V=(v 1 ,v 2 ,...,v q )
wherein p and q are the length of the time sequence data sequence, u p For the p-th element, v, of the time-series data sequence U q Is the q-th element of the time sequence data sequence V;
the original distance matrix M belongs to R p*q Is initialized to:
M(i,j)=|u i -v j |
wherein i belongs to p, j belongs to 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 Is 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, and the closer the distance, the higher the similarity.
And calculating the similarity of the historical data sequences among the nodes to obtain the time-space correlation of the hidden correlation of the traffic data, thereby being beneficial to subsequent use.
Further, a lower triangular matrix A is formed according to the adjacent matrix of the original road network and the space-time adjacent matrix st The method comprises the following steps:
constructing an original road network adjacency matrix A according to the distance of each traffic node s
Figure BDA0003914124130000041
Figure BDA0003914124130000042
Wherein e is 1 Is a hyperparameter, d ij Is the node distance; i belongs to p, j belongs to q, p and q are the length of the time sequence data sequence, and p and q are positive integers; according to the DTW algorithm, calculating the similarity of historical time sequence data sequences among all traffic nodes, and constructing a space-time adjacency matrix A d
A d(i,j) =1,DTW(i,j)<∈ 2
Ad (i,j) =0,DTW(i,j)≥∈ 2
According to the original road network adjacent matrix A s And a spatio-temporal adjacency matrix A d And forming a lower triangular matrix in the shape of:
Figure BDA0003914124130000051
wherein e is 2 Is a hyper-parameter; a. The s ∈R N*N For the original road network adjacency matrix, A d ∈R N*N Is a space-time adjacent matrix, T is the number of space-time periods, and N is the number of nodes;
A st each sub-matrix of (A) is an N x N matrix st The whole is a lower triangular matrix; the traffic flow at a particular time stamp t at a node is influenced by the flow data of the previous (t-1) time stamps, and in order to predict the traffic flow at the time stamp t, the ideal model should aggregate the flow characteristics from the previous time stamp, rather than the flow from the future time stampQuantity characteristic, spatio-temporal adjacency matrix A st Each sub-matrix A above the main diagonal st (i, j) =0, where i < j, j ∈ (2,..., T), and on the other hand, the spatio-temporal adjacency matrix a st Each sub-element A below the main diagonal st (i,j)=A d Wherein i>j, i e (2.. Multidot.T), meaning the traffic flow characteristics of the self node and the neighbor nodes of (T-1) time stamps before each node is aggregated at the time of the time stamp T;
spatio-temporal adjacency matrix A st Submatrix A on the main diagonal st (i,i)=A s ∈R N*N Where i e (1,2,..., T), means that each node aggregates traffic flow characteristics from its 1-hop spatial neighbor at a timestamp T.
The distance between the time data sequences of each node is calculated by using a DTW algorithm, and the distance and the original road network adjacent matrix form a lower triangular space-time adjacent matrix, so that the cumulative influence of historical data is fully considered.
Furthermore, a graph multiplication module is arranged in a sublayer of the space-time convolution reconstruction layer, and the input of the sublayer and the lower triangular matrix are input into the graph multiplication module:
h l+1 =(A st *h l *W 1 +b 1 )⊙σ(A st *h l *W 2 +b 2 )
wherein A is st ∈R NT*NT A lower triangular matrix, T is the number of space-time periods, and N is the number of nodes; h is l ∈R NT*c As input for this sublayer, h l+1 Is the output of the sublayer; w 1 ,W 2 ∈R C*C And b 1 ,b 2 ∈R C Is a trainable parameter of the model, C is a feature dimension; as being a hadamard product, sigma being a sigmoid activation function;
core part A of the graph multiplication module st *h l The characteristics are as follows: the traffic flow of a certain node at a specific time stamp t is influenced by the traffic data of the previous t-1 time stamps, and the traffic flow characteristics of the current time from the 1-hop spatial neighbor are aggregated:
Figure BDA0003914124130000061
wherein x is t ∈R N*C For a parameter in a time series data sequence, T e (1,2.., T-1,T); a. The s ∈R N*N For the original road network adjacency matrix, A d ∈R N*N Is a spatio-temporal adjacency matrix; the product of line 1 is A s *x 1 The product of line 2 is A d *x 1 +A s *x 2 The product of line 3 is A d *x 1 +A d *x 2 +A s *x 3 By analogy, the product of the T-th row is A d *x 1 +A d *x 2 +…+A d *x T-1 +A s *x T (ii) a Each node accumulates the spatio-temporal correlation of the traffic data of the previous t-1 timestamps at the timestamp t and aggregates the traffic flow characteristics from its 1-hop spatial neighborhood at the current time.
Simple structure and easy use.
Further, the method for reconstructing the input of each sublayer comprises the following steps:
the inputs to the sublayers are:
Figure BDA0003914124130000071
wherein p is t ∈R N*C The sub-matrix is a T epsilon (1,2., T-1,T), namely data of N nodes at the same moment are arranged according to a node number sequence, and then the N nodes are integrally arranged according to a time stamp sequence;
for aggregating the time characteristic information of T periods of a single node, h is added l+1 Is reconstructed as z l ∈R TN*C
Figure BDA0003914124130000072
Each sub-matrix q n ∈R T*C ,n∈(1,2,...,N-1,N), that is, the data of T moments of each node are adjusted to be adjacent in sequence, and then the N nodes are arranged according to the node numbering sequence, so as to facilitate feature aggregation.
The operation is simple and the use is convenient.
Further, the method for performing the aggregation operation on the output of each sub-layer of the time-space convolution reconstruction layer is as follows:
randomly initializing a learnable parameter matrix B e R 1*T The N traffic nodes share the parameter matrix, and each traffic node multiplies the parameter matrix to perform characteristic normalization to obtain the output of the node:
Figure BDA0003914124130000081
wherein N ∈ (1,2.., N-1,N), T is the number of space-time cycles, z l ∈R TN*C Reconstructing the reconstructed output of the sub-layers of the layers for the space-time convolution;
the output of all N traffic nodes of the graph convolution sub-layer is:
Figure BDA0003914124130000082
each sublayer producing an output o of the layer l Deeper levels can aggregate richer information.
Further, the space-time convolution reconstruction layer is provided with 4 sub-layers, and each sub-layer generates the output o of all traffic nodes of the layer l L is an element (0,1,2,3), for o l ∈R N*C Maximum pooling was used as polymerization operation:
o AGG =max(o 1 ,o 2 ,o 3 ,o 4 )∈R N*C
will o AGG ∈R N*C Inputting the data into an output layer, wherein the output layer is a fully-connected layer, multi-step prediction is directly carried out, error transmission brought by single-step prediction is avoided, and the finally calculated prediction result is as follows:
Figure BDA0003914124130000083
wherein W ∈ R C*T ,b∈R T Is a parameter that needs to be trained;
Figure BDA0003914124130000084
and the traffic flow values of all the N road network nodes in T time periods in the future are shown.
And the proper number of the sub-layers of the space-time convolution reconstruction layer is set, so that the use is facilitated.
The invention also provides a traffic prediction system based on the space-time fusion graph neural network, which comprises a data acquisition module and a processing module, wherein the data acquisition module is used for acquiring historical traffic flow data of each traffic node, the output end of the data acquisition module is connected with the input end of the processing module, and the processing module executes the method to perform traffic prediction.
The system considers the accumulative influence of historical data and improves the prediction precision.
The system further comprises an evaluation module, wherein the evaluation module extracts a data set from historical traffic flow data of each traffic node acquired by the data acquisition module and divides the data set into a training set, a verification set and a test set;
the mean absolute error, the mean percentage absolute error and the root mean square error are used as evaluation indexes for evaluating the predictive performance of the module, and are calculated as follows:
Figure BDA0003914124130000091
Figure BDA0003914124130000092
Figure BDA0003914124130000093
wherein the content of the first and second substances,
Figure BDA0003914124130000094
for predicted traffic flow results, Y is the actual traffic flow, Y i The actual value of the traffic of a certain node at a certain time,
Figure BDA0003914124130000095
is y i And (4) the predicted value of the flow of the corresponding node at the corresponding moment, wherein N is the number of all real values.
And evaluating the prediction performance of the prediction module by using the evaluation module, and judging the reliability of the prediction module so as to use or improve the prediction module.
Drawings
FIG. 1 is a flow chart diagram of a traffic prediction method based on a space-time fusion diagram neural network.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
In the description of the present invention, it is to be understood that the terms "longitudinal", "lateral", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. indicate orientations or positional relationships based on those shown in the drawings, and are merely for convenience of description and simplicity of description, but do not indicate or imply that the device or element referred to must have a particular orientation, be constructed in a particular orientation, and be operated, and thus, are not to be construed as limiting the present invention.
In the description of the present invention, unless otherwise specified and limited, it is to be noted that the terms "mounted," "connected," and "connected" are to be interpreted broadly, and may be, for example, a mechanical connection or an electrical connection, a communication between two elements, a direct connection, or an indirect connection via an intermediate medium, and specific meanings of the terms may be understood by those skilled in the art according to specific situations.
Most of the existing research on traffic data prediction is based on two independent components: acquiring a spatial representation by using GCN to capture spatial dependency; a time module is constructed by utilizing a recurrent neural network, and time dependence is captured; the spatial representation is then input to a temporal module to indirectly capture a third kind of influence: spatio-temporal correlation. However, the hidden space-time correlation in the traffic time sequence data is organically unified and cannot be split. The two independent components can only capture space and time correlation independently in the respective modules, the space-time characteristics of traffic data cannot be completely reserved, and hidden space-time correlation information among the data can be lost in the training process.
The invention discloses a traffic prediction method based on a space-time fusion graph neural network, which constructs a new space-time adjacency matrix, calculates the distance between time data sequences of all nodes by utilizing a DTW algorithm, and forms a lower triangular space-time adjacency matrix together with an original road network adjacency matrix, thereby fully considering the cumulative influence of historical data. The space-time adjacency matrix can more completely reserve the space-time characteristics of the traffic data to obtain the hidden associated space-time correlation. According to the invention, a plurality of layers of space-time convolution layers are stacked, and each layer further increases the prediction precision by aggregating the time characteristic information of the historical moment through the reconstruction of the space-time adjacent matrix.
As shown in fig. 1, the traffic prediction method based on the neural network of the spatio-temporal fusion map comprises the following steps:
acquiring historical traffic flow data of each traffic node;
calculating the similarity of historical data sequences among all traffic nodes, and constructing a space-time adjacency matrix;
forming a lower triangular matrix according to the original road network adjacency matrix and the space-time adjacency matrix;
inputting historical traffic flow data into a full-connection layer for feature dimension increasing, setting a space-time convolution reconstruction layer with a plurality of sub-layers, and taking the dimension-increased data and a lower triangular matrix as the input of the space-time convolution reconstruction layer;
the output of the last sub-layer of the space-time convolution reconstruction layer is the input of the next sub-layer, and each sub-layer reconstructs the input of the sub-layer;
and performing aggregation operation on the output of each sub-layer of the time-space convolution reconstruction layer, and inputting the data subjected to the aggregation operation into the output layer to obtain a prediction result.
In a preferred embodiment of the present invention, based on a DTW (Dynamic Time Warping, DTW is a classical algorithm for calculating similarity between two Time sequences) algorithm, a method for calculating similarity of historical data sequences between traffic nodes includes:
given two time series data sequences U, V:
U=(u 1 ,u 2 ,...,u p ),V=(v 1 ,v 2 ,...,v q )
wherein p and q are the length of the time sequence data sequence;
the original distance matrix M belongs to R p*q Is initialized to:
M(i,j)=|u i -v j |
the final distance matrix M c ∈R p*q Is 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, and the closer the distance, the higher the similarity.
In a preferred scheme of the invention, a lower triangular matrix A is formed according to an original road network adjacent matrix and a space-time adjacent matrix st The method comprises the following steps:
constructing an original road network adjacency matrix A according to the distance of each traffic node s
Figure BDA0003914124130000121
Figure BDA0003914124130000122
Wherein e is 1 Is a hyperparameter, d ij Is the node distance; i belongs to p, j belongs to q, p and q are the length of the time sequence data sequence, and p and q are positive integers; according to the DTW algorithm, calculating the similarity of historical time sequence data sequences among all traffic nodes, and constructing a space-time 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 adjacent matrix A s And a spatio-temporal adjacency matrix A d And forming a lower triangular matrix in the shape of:
Figure BDA0003914124130000123
wherein e is 2 Is a hyper-parameter; a. The s ∈R N*N For the original road network adjacency matrix, A d ∈R N*N Is a space-time adjacent matrix, T is the number of space-time periods, and N is the number of nodes;
A st that is, the space-time adjacency matrix of the rich space-time hidden information is directly reserved; a. The st Each sub-matrix of (A) is an N x N matrix st The whole is a lower triangular matrix; the traffic flow at a particular time stamp t for a node is affected by the flow data of the previous (t-1) time stamps. To predict traffic flow at time stamp t, the ideal model should aggregate flow features from previous time stamps, rather than flow features from future time stamps, the spatio-temporal adjacency matrix A st Each sub-matrix A above the main diagonal st (i, j) =0, where i < j, j ∈ (2,..., T), and on the other hand, the spatio-temporal adjacency matrix a st Each sub-element A below the main diagonal st (i,j)=A d Wherein i>j, i ∈ (2,..., T), meaning that each node is (T-1) before aggregating at time stamp T) The traffic flow characteristics of the self node and the neighbor node of each timestamp; in conclusion, the spatio-temporal adjacency matrix comprehensively considers the influence of historical data and current data on the current node.
Spatio-temporal adjacency matrix A st Submatrix A on the main diagonal st (i,i)=A s ∈R N*N Where i e (1,2.., T), means that each node aggregates traffic flow characteristics from its 1-hop spatial neighbor at time stamp T.
In a preferred scheme of the invention, a graph multiplication module is arranged in a sublayer of a space-time convolution reconstruction layer, and in each space-time convolution reconstruction sublayer, the Laplace decomposition in the graph convolution is operated by a simpler and more time-saving operation: matrix multiplication is substituted. Because of the spatio-temporal adjacency matrix A st The method already contains rich space-time information with long history period, and the matrix multiplication is time-saving and simple and can extract enough space-time information. The graph multiplication module also utilizes a gating mechanism, and the gating mechanism is used for the characteristic generalization of the graph multiplication module through the nonlinear activation of the gating linear unit, and inputs of the sub-layer and the lower triangular matrix into the graph multiplication module:
h l+1 =(A st *h l *W 1 +b 1 )⊙σ(A st *h l *W 2 +b 2 )
wherein A is st ∈R NT*NT A lower triangular matrix, T is the number of space-time periods, and N is the number of nodes; h is l ∈R NT*c Is the input of this sublayer, h l+1 Is the output of the sublayer; w 1 ,W 2 ∈R C*C And b 1 ,b 2 ∈R C Is a trainable parameter of the model, C is a feature dimension; as an example, it is the Hadamard product, σ is sigm. An id activation function;
core part A of the graph multiplication module st *h l The characteristics are as follows: the traffic flow of a certain node at a specific time stamp t is influenced by the traffic flow data of the previous t-1 time stamps, and the traffic flow characteristics from the 1-hop spatial neighbor at the current moment are aggregated:
Figure BDA0003914124130000141
wherein x is t ∈R N*C For a parameter in a time series data sequence, T e (1,2.., T-1,T); a. The s ∈R N*N For the original road network adjacency matrix, A d ∈R N*N Is a spatio-temporal adjacency matrix; the product of line 1 is A s *x 1 The product of line 2 is A d *x 1 +A s *x 2 The product of line 3 is A d *x 1 +A d *x 2 +A s *x 3 By analogy, the product of the T-th row is A d *x 1 +A d *x 2 +…+A d *x T-1 +A s *x T (ii) a Each node accumulates the spatio-temporal correlation of the traffic data of the previous t-1 timestamps at the timestamp t and aggregates the traffic flow characteristics from its 1-hop spatial neighborhood at the current time.
In a preferred embodiment of the present invention, the method for reconstructing the input of each sub-layer comprises:
the inputs to the sublayers are:
Figure BDA0003914124130000151
wherein p is t ∈R N*C The sub-matrix is a T epsilon (1,2., T-1,T), namely data of N nodes at the same moment are arranged according to a node number sequence, and then the N nodes are integrally arranged according to a time stamp sequence;
for aggregating the time characteristic information of T periods of a single node, h is added l+1 Is reconstructed as z l ∈R TN*C
Figure BDA0003914124130000152
Each sub-matrix q n ∈R T*C N ∈ (1,2.., N-1,N), i.e., data of T times of each node is adjusted to be in sequence firstAnd (4) arranging the N nodes according to the node number sequence so as to facilitate feature aggregation.
In a preferred embodiment of the present invention, the method for performing the polymerization operation on the output of each sublayer of the time-space convolutional reconstruction layer is as follows:
randomly initializing a learnable parameter matrix B e R 1*T The N traffic nodes share the parameter matrix, and each traffic node multiplies the parameter matrix to perform characteristic normalization to obtain the output of the node:
Figure BDA0003914124130000153
where N ∈ (1,2.., N-1,N), T is the number of space-time periods, z is l ∈R TN*C Reconstructing the reconstructed output of the sub-layers of the layers for the space-time convolution;
the output of all N traffic nodes of the graph convolution sublayer is:
Figure BDA0003914124130000161
more preferably, the space-time convolution reconstruction layer is provided with 4 sub-layers, each sub-layer generating the output o of all traffic nodes of the layer l Deeper levels can aggregate richer information. l is an e (0,1,2,3), for o l ∈R N*C Using maximal pooling as an aggregation operation reduces information redundancy and prevents overfitting. The maximum aggregation operation can be expressed as:
o AGG =max(o 1 ,o 2 ,o 3 ,o 4 )∈R N*C
mixing O with AGG ∈R N*C Inputting the data into an output layer, wherein the output layer is a fully-connected layer, multi-step prediction is directly carried out, error transmission brought by single-step prediction is avoided, and the finally calculated prediction result is as follows:
Figure BDA0003914124130000162
wherein W ∈ R C*T ,b∈R T Is a parameter that needs to be trained;
Figure BDA0003914124130000163
and the traffic flow values of all the N road network nodes in T time periods in the future are shown.
The invention also provides a traffic prediction system based on the space-time fusion graph neural network, which comprises a data acquisition module and a processing module, wherein the data acquisition module is used for acquiring historical traffic flow data of each traffic node, the output end of the data acquisition module is electrically connected with the input end of the processing module, and the processing module executes the method to perform traffic prediction.
In a preferred scheme of the invention, the traffic prediction system based on the space-time fusion graph neural network further comprises an evaluation module, wherein the evaluation module extracts a data set from historical traffic flow data of each traffic node acquired by the data acquisition module, and divides the data set into a training set, a verification set and a test set.
The scheme constructs a new space-time adjacency matrix which can more completely retain the space-time characteristics of the traffic data so as to obtain the space-time correlation of the hidden correlation of the traffic data. According to the invention, a plurality of layers of time-space graph convolution reconstruction layers are stacked, and each layer extracts the time-space information of traffic data at historical time and current time through convolution, reconstruction and aggregation of a time-space adjacent matrix, so that the prediction accuracy of the traffic data is further improved.
The mean absolute error, the mean absolute percentage error and the root mean square error are used as evaluation indexes for evaluating the predictive performance of the module, and are calculated as follows:
Figure BDA0003914124130000171
Figure BDA0003914124130000172
Figure BDA0003914124130000173
wherein the content of the first and second substances,
Figure BDA0003914124130000174
for predicted traffic flow results, Y is the actual traffic flow, Y i The actual value of the traffic of a certain node at a certain time,
Figure BDA0003914124130000175
is y i And (4) corresponding to the predicted value of the flow of the corresponding node at the moment, wherein N is the number of all real values, namely representing a total of N nodes. And evaluating the prediction performance of the prediction module by using the evaluation module, and judging the reliability of the prediction module so as to use or improve the prediction module.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

Claims (9)

1. A traffic prediction method based on a space-time fusion graph neural network is characterized by comprising the following steps:
acquiring historical traffic flow data of each traffic node;
calculating the similarity of historical data sequences among all traffic nodes, and constructing a space-time adjacency matrix;
forming a lower triangular matrix according to the original road network adjacency matrix and the space-time adjacency matrix;
inputting historical traffic flow data into a full-connection layer for feature dimension increasing, setting a space-time convolution reconstruction layer with a plurality of sub-layers, and taking the dimension-increased data and a lower triangular matrix as the input of the space-time convolution reconstruction layer;
the output of the previous sub-layer of the space-time convolution reconstruction layer is the input of the next sub-layer, and each sub-layer reconstructs the input of the sub-layer;
and carrying out aggregation operation on the output of each sub-layer of the time-space convolution reconstruction layer, and inputting the data subjected to the aggregation operation into the output layer to obtain a prediction result.
2. The traffic prediction method based on the spatio-temporal fusion graph neural network as claimed in claim 1, characterized in that the method for calculating the similarity of the historical data sequence among the traffic nodes is as follows:
given two time series data sequences U, V:
U=(u 1 ,u 2 ,...,u p ),V=(v 1 ,v 2 ,...,v q )
wherein p and q are the length of the time sequence data sequence, u p For the p-th element, v, of the time-series data sequence U q Is the q-th element of the time sequence data sequence V;
the original distance matrix M ∈ R p*q Is initialized to:
M(i,j)=|u i -v j |
wherein i belongs to p, j belongs to q, p and q are positive integers, R p*q Is a matrix with p rows and q columns;
final distance matrix M c ∈R p*q Is 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 number of timesAccording to the distance between the sequences U and V, the closer the distance is, the higher the similarity is.
3. The traffic prediction method based on the spatio-temporal fusion graph neural network of claim 1, characterized in that a lower triangular matrix A is formed according to the original road network adjacency matrix and the spatio-temporal adjacency matrix st The method comprises the following steps:
constructing an original road network adjacency matrix A according to the distance of each traffic node s
Figure FDA0003914124120000021
Figure FDA0003914124120000022
Wherein e is 1 Is a hyperparameter, d ij Is the node distance; i belongs to p, j belongs to q, p and q are the length of the time sequence data sequence, and p and q are positive integers; according to the DTW algorithm, calculating the similarity of historical time sequence data sequences among all traffic nodes, and constructing a space-time 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 adjacent matrix A s And spatio-temporal adjacency matrix A d And forming a lower triangular matrix in the shape of:
Figure FDA0003914124120000023
wherein e is 2 Is a hyper-parameter; a. The s ∈R N*N For the original road network adjacency matrix, A d ∈R N*N Is a space-time adjacent matrix, T is the number of space-time periods, and N is the number of nodes;
A st each sub-matrix of (A) is an N x N matrix st The whole is a lower triangular matrix; the traffic flow of a node at a specific time stamp t is influenced by the traffic data of the previous (t-1) time stamps, and in order to predict the traffic flow at the time stamp t, an ideal model should aggregate the flow characteristics from the previous time stamp, not the flow characteristics from the future time stamp, and a spatio-temporal adjacency matrix a st Each sub-matrix A above the main diagonal st (i, j) =0, where i < j, j ∈ (2,..., T), and on the other hand, the spatio-temporal adjacency matrix a st Each sub-element A below the main diagonal st (i,j)=A d Wherein i > j, i ∈ (2...., T), meaning the traffic flow characteristics of the self and neighbor nodes of (T-1) timestamps before each node is aggregated at timestamp T;
spatio-temporal adjacency matrix A st Submatrix A on the main diagonal st (i,i)=A s ∈R N*N Where i e (1,2,..., T), means that each node aggregates traffic flow characteristics from its 1-hop spatial neighbor at a timestamp T.
4. The traffic prediction method based on the spatio-temporal fusion graph neural network as claimed in claim 1, wherein a graph multiplication module is arranged in a sub-layer of the spatio-temporal convolution reconstruction layer, and the input of the sub-layer and the lower triangular matrix are input into the graph multiplication module:
h l+1 =(A st *h l *W 1 +b 1 )⊙σ(A st *h l *W 2 +b 2 )
wherein, A st ∈R NT*NT A lower triangular matrix, T is the number of space-time periods, and N is the number of nodes; h is a total of l ∈R NT*C For input of the corresponding sublayer, h l+1 Is the output of the sublayer; w 1 ,W 2 ∈R C*C And b 1 ,b 2 ∈R C Is a trainable parameter of the model, C is a feature dimension; as being a hadamard product, sigma being a sigmoid activation function;
core part A of the graph multiplication module st *h l The characteristics are as follows: when the traffic flow of a certain node is t-1 times before the traffic flow of a specific time stamp tThe flow data of the timestamp influences and the traffic flow characteristics from 1-hop spatial neighbors of the current time are aggregated:
Figure FDA0003914124120000041
wherein x is t ∈R N*C For a parameter in a time series data sequence, T e (1,2.., T-1,T); a. The s ∈R N*N For the original road network adjacency matrix, A d ∈R N*N Is a space-time adjacency matrix; the product of line 1 is A s *x 1 The product of line 2 is A d *x 1 +A s *x 2 The product of line 3 is A d *x 1 +A d *x 2 +A s *x 3 By analogy, the product of the T-th row is A d *x 1 +A d *x 2 +...+A d *x T-1 +A s *x T (ii) a Each node accumulates the spatio-temporal correlation of the traffic data of the previous t-1 timestamps at the timestamp t and aggregates the traffic flow characteristics from its 1-hop spatial neighborhood at the current time.
5. The traffic prediction method based on the spatio-temporal fusion graph neural network as claimed in claim 1, wherein the method for reconstructing the input of each sub-layer comprises the following steps:
the inputs to the sublayers are:
Figure FDA0003914124120000042
wherein p is t ∈R N*C The sub-matrix is a T epsilon (1,2., T-1,T), namely data of N nodes at the same moment are arranged according to a node number sequence, and then the N nodes are integrally arranged according to a time stamp sequence;
for aggregating the time characteristic information of T periods of a single node, h is added l+1 Is reconstructed as z l ∈R TN*C
Figure FDA0003914124120000051
Each sublance drop q n ∈R T*C N ∈ (1,2., N-1,N), i.e., data of T moments of each node are adjusted to be adjacent in sequence, and then N nodes are arranged according to the node numbering sequence, so as to facilitate feature aggregation.
6. The traffic prediction method based on the spatio-temporal fusion graph neural network as claimed in claim 1, wherein the method of performing the aggregation operation on the output of each sub-layer of the spatio-temporal convolutional reconstruction layer is as follows:
randomly initializing a learnable parameter matrix B e R 1*T The N traffic nodes share the parameter matrix, and each traffic node multiplies the parameter matrix to perform characteristic normalization to obtain the output of the node:
Figure FDA0003914124120000052
where N ∈ (1,2.., N-1,N), T is the number of space-time periods, z is l ∈R TN*C Reconstructing the reconstructed output of the layer sub-layers for the space-time convolution;
the output of all N traffic nodes of the graph convolution sublayer is:
Figure FDA0003914124120000061
7. the method of claim 1, wherein the spatio-temporal convolution reconstruction layer is configured with 4 sub-layers, each sub-layer generating the output o of all traffic nodes of the layer l L is an element (0,1,2,3), for o l ∈R N*C Maximum pooling was used as polymerization operation:
o AGG =max(o 1 ,o 2 ,o 3 ,o 4 )∈R N*C
will o AGG ∈R N*C Inputting the data into an output layer, wherein the output layer is a fully-connected layer, multi-step prediction is directly carried out, error transmission brought by single-step prediction is avoided, and the finally calculated prediction result is as follows:
Figure FDA0003914124120000062
wherein W ∈ R C*T ,b∈R T Is a parameter that needs to be trained;
Figure FDA0003914124120000063
and the traffic flow values of all the N road network nodes in T time periods in the future are shown.
8. A traffic prediction system based on a space-time fusion graph neural network is characterized by comprising a data acquisition module and a processing module, wherein the data acquisition module is used for acquiring historical traffic flow data of each traffic node, the output end of the data acquisition module is connected with the input end of the processing module, and the processing module executes the method of one of claims 1 to 7 to perform traffic prediction.
9. The traffic prediction system based on the spatio-temporal fusion graph neural network as claimed in claim 8, further comprising an evaluation module, said evaluation module extracting data set from historical traffic flow data of each traffic node collected by said data collection module, dividing the data set into a training set, a validation set and a test set;
the mean absolute error, the mean absolute percentage error and the root mean square error are used as evaluation indexes for evaluating the predictive performance of the module, and are calculated as follows:
Figure FDA0003914124120000071
Figure FDA0003914124120000072
Figure FDA0003914124120000073
wherein the content of the first and second substances,
Figure FDA0003914124120000074
for predicted traffic flow results, Y is the actual traffic flow, Y i The actual value of the traffic of a certain node at a certain time,
Figure FDA0003914124120000075
is y i And (4) the predicted value of the flow of the corresponding node at the corresponding moment, wherein N is the number of all real values.
CN202211334070.1A 2022-10-28 2022-10-28 Traffic prediction method and system based on space-time fusion graph neural network Pending CN115641720A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211334070.1A CN115641720A (en) 2022-10-28 2022-10-28 Traffic prediction method and system based on space-time fusion graph neural network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211334070.1A CN115641720A (en) 2022-10-28 2022-10-28 Traffic prediction method and system based on space-time fusion graph neural network

Publications (1)

Publication Number Publication Date
CN115641720A true CN115641720A (en) 2023-01-24

Family

ID=84947013

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211334070.1A Pending CN115641720A (en) 2022-10-28 2022-10-28 Traffic prediction method and system based on space-time fusion graph neural network

Country Status (1)

Country Link
CN (1) CN115641720A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116071932A (en) * 2023-03-09 2023-05-05 华东交通大学 Traffic flow prediction method, system, storage medium and terminal equipment
CN116153089A (en) * 2023-04-24 2023-05-23 云南大学 Traffic flow prediction system and method based on space-time convolution and dynamic diagram

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116071932A (en) * 2023-03-09 2023-05-05 华东交通大学 Traffic flow prediction method, system, storage medium and terminal equipment
CN116153089A (en) * 2023-04-24 2023-05-23 云南大学 Traffic flow prediction system and method based on space-time convolution and dynamic diagram

Similar Documents

Publication Publication Date Title
CN113053115B (en) Traffic prediction method based on multi-scale graph convolution network model
Ta et al. Adaptive spatio-temporal graph neural network for traffic forecasting
CN115641720A (en) Traffic prediction method and system based on space-time fusion graph neural network
Bhardwaj et al. Estimation of solar radiation using a combination of Hidden Markov Model and generalized Fuzzy model
CN114299723B (en) Traffic flow prediction method
CN112767682A (en) Multi-scale traffic flow prediction method based on graph convolution neural network
CN114202122A (en) Urban traffic flow prediction method based on Markov cluster map attention network
CN115935796A (en) Time-space heterogeneous and synchronous graph convolution network traffic flow prediction method
CN116504060B (en) Diffusion diagram attention network traffic flow prediction method based on Transformer
Jin et al. Adaptive dual-view wavenet for urban spatial–temporal event prediction
CN114169649A (en) Traffic flow prediction method based on space-time data embedding
CN114692984A (en) Traffic prediction method based on multi-step coupling graph convolution network
CN115376317B (en) Traffic flow prediction method based on dynamic graph convolution and time sequence convolution network
CN112116137A (en) Student class dropping prediction method based on mixed deep neural network
CN116844041A (en) Cultivated land extraction method based on bidirectional convolution time self-attention mechanism
CN116011684A (en) Traffic flow prediction method based on space-time diagram convolutional network
CN117236492B (en) Traffic demand prediction method based on dynamic multi-scale graph learning
Li et al. Spatial–Temporal Traffic Modeling With a Fusion Graph Reconstructed by Tensor Decomposition
CN115953902A (en) Traffic flow prediction method based on multi-view space-time diagram convolution network
CN112633607B (en) Dynamic space-time event prediction method and system
CN114970336A (en) Traffic flow prediction method based on improved GCN-attention algorithm
CN115168327A (en) Large-scale data space-time prediction method based on multilayer tree long-short term memory network
CN114444813A (en) Traffic flow prediction method based on deep learning
CN115348182A (en) Long-term spectrum prediction method based on depth stack self-encoder
Prabowo et al. Traffic forecasting on new roads unseen in the training data using spatial contrastive pre-training

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination