A spatiotemporal graph learning approach for traffic demand forecasting
By constructing a time-series network snapshot and network change structure of traffic flow, using graph domain and time domain Transformer models to predict the future status of the traffic network, combined with auxiliary tasks and multi-task information, the problem of low traffic demand prediction accuracy under emergencies is solved, and the problem of low traffic demand prediction accuracy is achieved. Higher prediction accuracy and adaptability.
Patent Information
- Application Number
- CN202411025573.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2044-07-30
AI Technical Summary
When facing emergencies, the existing traffic demand prediction methods have poor time-varying characteristics, resulting in low prediction accuracy and difficulty in quickly adjusting the prediction results.
By constructing a time-series network snapshot of traffic flow, calculating the network change structure, using the graph domain and time domain dual Transformer model to predict the future network topology and node state, and designing auxiliary tasks and multi-task information aggregation mechanism, combining the composite loss function for model training.
The model's sensitivity to time-varying characteristics and its response ability to emergencies is improved, and the accuracy and adaptability of traffic demand prediction are significantly improved.
Smart Images

Figure CN118571018B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of traffic engineering, and in particular to a spatiotemporal graph learning method for traffic demand prediction. Background Art
[0002] With the rapid development of the smart transportation industry, traffic demand forecasting has become an increasingly important part of traffic management and planning in modern urban transportation systems. Accurate traffic demand forecasting can help transportation management departments effectively allocate resources, optimize traffic flow, and improve the quality of public transportation services. However, in real life, emergencies such as natural disasters, major events, or traffic accidents are common. Emergencies often lead to drastic fluctuations in traffic demand, but their actual impact is often difficult to predict and handle, which poses a huge challenge to existing traffic demand forecasting methods.
[0003] Traditional traffic demand forecasting is a forecasting method based on regression models. Because most of them are linear models, they cannot describe the randomness and nonlinear characteristics of traffic flow. In addition, they only consider traffic flow and lack the ability to integrate multi-source data that affect traffic demand, such as weather and events. Later, machine learning methods were gradually applied to traffic demand forecasting by virtue of their ability to mine complex data patterns. In 2014, Lv et al. proposed a neural network model based on stacked autoencoders, which significantly improved the prediction accuracy compared with traditional regression models. In 2016, Fu et al. used the recurrent network (RNN) structure to extract the time dependency and dynamic changes in the data based on the temporal characteristics of traffic flow sequences, further improving the prediction accuracy and robustness. In recent years, scholars have discovered the interdependence between traffic flow and traffic patterns between different geographical locations. Effectively capturing and utilizing these spatial correlations can significantly improve the accuracy and reliability of traffic demand forecasting. In 2020, Liu et al. used graph neural networks (GNNs) and attention frameworks to extract spatial correlations in actual traffic, and achieved obvious advantages in the task of predicting commuting travel demand; in 2022, Song et al. proposed a spatiotemporal graph attention network, which combines the advantages of RNNs and GNNs and achieves more accurate prediction results.
[0004] Although research on traffic demand forecasting has made some progress, the forecasting ability in the face of emergencies is still insufficient. Existing methods usually consider the spatial correlation characteristics of the entire system and its overall temporal variation law. They are less sensitive to the local fast-changing spatiotemporal characteristics caused by emergencies, making it difficult to quickly adjust the forecast results, resulting in low forecast accuracy. Summary of the invention
[0005] In view of the above analysis, an embodiment of the present invention aims to provide a spatiotemporal graph learning method for traffic demand prediction, so as to solve the problems of poor sensitivity to time-varying features and low accuracy of traffic demand prediction under emergencies in the prior art.
[0006] The purpose of the present invention is mainly achieved through the following technical solutions:
[0007] A spatiotemporal graph learning method for traffic demand prediction includes the following steps:
[0008] Using historical traffic data, based on network nodes at different times, the connection relationship between nodes and the traffic demand of each node, we can obtain the traffic flow time series network snapshots at different times and calculate the changing network structure;
[0009] Based on the traffic flow time series network snapshot, the main task of predicting the future network structure and node status is established to obtain the prediction results of the future network structure and future network node status;
[0010] Based on the changing network structure, an auxiliary task is established to predict the future changes of network structure under different conditions, and the prediction results of future changes of network structure are obtained;
[0011] The prediction results of the main task and the auxiliary task are combined with the current network structure, input into the neural network for multi-task information aggregation, and the final network structure and the corresponding preliminary traffic demand prediction results are obtained;
[0012] Calculate the multi-task composite loss function, use the composite loss function to assist in learning the training network, and obtain the trained traffic demand forecasting model and traffic demand forecasting results.
[0013] Furthermore, the prediction step of the main task specifically includes:
[0014] Based on the traffic flow time series network snapshot, Laplace feature vectors are used to perform graph structure position encoding and graph embedding to obtain initial graph embedding features;
[0015] Based on the initial graph embedding features, the self-attention module of the graph domain Transformer module is used to extract the overall information of the network structure to obtain a low-dimensional graph embedding feature;
[0016] Based on the low-dimensional graph embedding features, the cross-attention module of the graph domain Transformer module is used to extract information about structural changes generated under different conditions to obtain optimized graph embedding features;
[0017] Inputting the optimized graph embedding features into a feedforward network to obtain embedding results of each node, and aggregating the embedding results of each node using a linear neural network layer of the feedforward network to obtain an overall graph embedding result;
[0018] Based on the overall graph embedding result, the time domain Transformer module is used to predict the future network structure and the status of each node in the future network.
[0019] Furthermore, the prediction step of the auxiliary task specifically includes:
[0020] Based on the changed network structure, Laplace feature vectors are used to perform graph structure position encoding and graph embedding, thereby obtaining auxiliary initial graph embedding features;
[0021] Based on the auxiliary initial graph embedding features, the cross attention module of the graph domain Transformer module is used to extract the impact of the local change structure on the global network, and the auxiliary optimized graph embedding features are obtained;
[0022] Inputting the auxiliary optimized graph embedding features into a feedforward network to obtain auxiliary embedding results of each node, and aggregating the auxiliary embedding results using a linear neural network layer of the feedforward network to obtain auxiliary overall graph embedding results;
[0023] Based on the auxiliary overall graph embedding results, the time domain Transformer module is used to predict future network structure changes under different conditions.
[0024] Furthermore, the self-attention module extracts information based on the following formula:
[0025] ,
[0026] ,
[0027] ,
[0028] in, Indicates that Node of time , its Layer Group self-attention calculation results; Indicates that Node of time , its The self-attention results of each group in the layer are concatenated and linearly mapped to obtain the final output result; Express The result obtained by residual calculation and layer normalization; express Time Node No. The initial embedding feature vector of the layer; express Time Node No. The initial embedding feature vector of the layer; , , is the total number of encoder layers in Transformer, is the number of attention heads; The neighbor set of For the transportation network network nodes; All are parameter matrices; represents the vector concatenation function; and Represents the layer normalization function; d is the dimension of the embedding vector.
[0029] Furthermore, the cross attention module extracts information based on the following formula:
[0030] ,
[0031] ,
[0032] ,
[0033] in, express Node of time , its Layer Group cross attention calculation results; Indicates that Node of time , its The cross-attention results of each layer are concatenated and linearly mapped to obtain the final output result; Express The result obtained by residual calculation and layer normalization; express -1 moment node No. The output obtained by linearly mapping the self-attention results of each group in the layer; is a time-varying feature mask, and , is a tunable hyperparameter, are parameter matrices.
[0034] Furthermore, the multi-task information aggregation is to combine the prediction results of the future network structure and the prediction results of the future network structure change with the current network structure, input them into a multi-layer perceptron for information aggregation, and obtain a preliminary prediction result of the final network structure; combine the preliminary prediction result with the prediction result of the future network node state, input them into another multi-layer perceptron for information aggregation, and obtain a preliminary prediction result of the traffic demand corresponding to the final network structure. The expression of the preliminary prediction result of the traffic demand is:
[0035] ,
[0036] ,
[0037] in, Represents the preliminary prediction results of the final network structure; It represents the preliminary prediction results of the traffic demand corresponding to the final network structure; All are parameter matrices; Represents the prediction result of the future network structure; express The adjacency matrix corresponding to the traffic network structure at the time; Represents the prediction results of future network structure changes under different conditions; Represents the prediction result of future network node status; is the ReLU activation layer function.
[0038] Furthermore, the composite loss function is expressed as:
[0039] ,
[0040] ,
[0041] ,
[0042] ,
[0043] in, represents the composite loss function; is an adjustable training parameter; Represents the loss function of the final network structure prediction; Represents the loss function for predicting future network structure changes; Represents the loss function for traffic demand prediction.
[0044] Furthermore, the specific steps of predicting the future network structure and the status of each node in the future network include:
[0045] Performing temporal position encoding on the overall graph embedding result to obtain initial embedding features;
[0046] Extracting time series information using a self-attention module and a feed-forward neural network of a temporal Transformer module based on the initial embedding features;
[0047] Decoding the future network structure and the prediction results of the states of each node in the future network by using a graph decoder;
[0048] The calculation formula of the temporal position coding is:
[0049] ,
[0050] ,
[0051] ,
[0052] ,
[0053] in, for Initial embedding features at time for The overall graph embedding result at each moment; for The location characteristics of the moment; is the embedding vector dimension.
[0054] Furthermore, the calculation formula for extracting the timing information is:
[0055] ,
[0056] ,
[0057] ,
[0058] in, Indicates Layer Group self-attention calculation results; Indicates The final output obtained by concatenating and linearly mapping the self-attention results of each group in the layer and normalizing the result; Express The result obtained by normalization of the linear layer of the feedforward neural network; Indicates The initial time domain embedding features of the layer; are parameter matrices.
[0059] Furthermore, the traffic flow time series network snapshot is expressed as: , the corresponding network change structure is: ,
[0060] in, Represents a snapshot of the traffic flow time series network; express The corresponding changes in the network structure; Represents a node in a transportation network; express The connection relationship between any nodes at any time; express The traffic demand of each node at the moment.
[0061] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:
[0062] 1. The present invention proposes to construct a traffic flow time series network snapshot based on historical traffic data and calculate the network change structure; use the graph domain and time domain dual Transformer to predict the future network topology, the status of each node and the future network structure changes caused by different conditions; and use a neural network to aggregate multi-task information to obtain the final network topology and traffic demand forecast results. On the one hand, by designing auxiliary learning tasks for the prediction of changing network structures, the problem of time-varying features being diluted during overall embedding is solved, the sensitivity of the model to time-varying features is improved, and the accuracy of traffic demand forecasting under emergencies is improved; on the other hand, a composite loss function is designed based on the correlation between multiple tasks to train the model, maximize the use of known information, and significantly improve the prediction effect of the model.
[0063] 2. By designing a temporal cross-attention module when embedding the spatiotemporal graph, we can pay attention to the impact of local fast-changing structures when the entire network is embedded, and combine the changing network structure to extract and predict information, thereby improving the responsiveness and adaptability to emergencies.
[0064] In the present invention, the above-mentioned technical solutions can also be combined with each other to achieve more preferred combination solutions. Other features and advantages of the present invention will be described in the subsequent description, and some advantages can become obvious from the description, or can be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained through the contents particularly pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] The accompanying drawings are only used for the purpose of illustrating specific embodiments and are not to be considered as limiting the present invention. In the entire drawings, the same reference symbols represent the same components;
[0066] Figure 1 A flow chart of a spatiotemporal graph learning method for traffic demand prediction according to an embodiment of the present invention;
[0067] Figure 2 A schematic diagram of a city traffic timing network according to an embodiment of the present invention;
[0068] Figure 3 This is a model diagram of the spatiotemporal graph learning method for traffic demand prediction according to an embodiment of the present invention. DETAILED DESCRIPTION
[0069] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0070] A specific embodiment of the present invention discloses a spatiotemporal graph learning method for traffic demand prediction, such as Figure 1 As shown, the following steps are included:
[0071] Step S1, using historical traffic data to extract information, based on the network nodes at different times, the connection relationship between nodes and the traffic demand related data of each node, construct the traffic flow time series network snapshots at different times, and calculate the network change structure corresponding to each snapshot;
[0072] Step S2: Based on the time-series network snapshot, a main task of predicting the future network structure and node status is established to obtain the prediction results of the future network structure and future network node status;
[0073] Step S3: Based on the changed network structure, an auxiliary task for predicting future network structure changes under different conditions is established to obtain the prediction results of future network structure changes;
[0074] Step S4, combining the prediction results of the main task and the auxiliary task with the current network structure, inputting the results into the neural network for multi-task information aggregation, and obtaining the final network structure and the corresponding preliminary prediction results of traffic demand;
[0075] Step S5, calculating the multi-task composite loss function, using the composite loss function to assist in learning the training network, and obtaining the trained traffic demand prediction model and traffic demand prediction results.
[0076] It should be noted that the main task of step S2 and the auxiliary task of step S3 are parallel prediction tasks, and the prediction processes are performed simultaneously.
[0077] Through the above method, an auxiliary learning task for predicting the changing network structure is established to solve the problem of dilution of time-varying features during overall embedding, thereby improving the sensitivity of the model to time-varying features, and thus improving the accuracy of traffic demand prediction under emergencies; utilizing the correlation between multiple tasks and training the model through a composite loss function to maximize the use of known information, significantly improve the prediction effect of the model, and make up for the poor sensitivity of the existing technology to time-varying features and the low accuracy of traffic demand prediction under emergencies.
[0078] For example, the urban traffic timing network diagram of this embodiment is as follows: Figure 2 As shown, in step S1, the historical traffic data is divided according to equal time intervals, and the traffic flow time series network snapshots at different times reflecting historical normal conditions and emergency conditions are obtained as follows:
[0079] ,
[0080] The corresponding change network structure expression is calculated as follows:
[0081] ,
[0082] in, express Traffic flow time series network snapshot at the moment; express The corresponding changes in the network structure; Represents the node in the transportation network corresponding to the actual station (or area); is the total number of network nodes; express The connection relationship between any nodes at any time; express The traffic demand of each node at the moment.
[0083] The known information obtained using historical data is expressed as: ,
[0084] The results to be predicted are expressed as: ,
[0085] in, is the length of the historical network snapshot; without loss of generality, this embodiment assumes .
[0086] In step S2, the main task prediction step based on the network snapshot specifically includes:
[0087] Step S21, obtaining a corresponding adjacency matrix according to the connection relationship of the network topology;
[0088] For example, The corresponding adjacency matrix is ,in .
[0089] Step S22: Use the normalized magnetic Laplace operator to encode the network topology position, and the calculation formula is:
[0090] ,
[0091] in, represents the normalized magnetic Laplace operator; represents the Hadamard product; and Represent the normalized in-degree matrix and adjacency matrix respectively; represents the identity matrix; is the imaginary identity element; the phase matrix , the charge constant , ; They represent the eigenvalues and eigenvectors obtained after eigendecomposition.
[0092] For example, , and get the corresponding eigenvalue ,make As a node exist Network topology position encoding at the moment;
[0093] Step S23, combining the traffic demand of each node and the network topology after position encoding through a linear neural network, performing graph embedding to obtain an initial graph embedding feature vector of each node;
[0094] For example, through the linear neural network layer Graph embedding is performed to obtain the initial graph embedding vector of each node. The calculation formula is:
[0095] ,
[0096] in, Indicates mapping the input to dimensional linear mapping; express Time Node The initial graph embedding feature vector of express Time Node transportation needs.
[0097] Correspondingly, the set of initial graph embedding feature vectors of each node is obtained as the initial graph embedding feature .
[0098] Step S24: Based on the initial graph embedding features, the self-attention module of the graph domain Transformer module is used to extract the overall information of the network structure to obtain a low-dimensional graph embedding feature;
[0099] Specifically, the graph domain Transformer module includes an input layer, an encoder, and an output layer.
[0100] For example, let the encoder of the graph domain Transformer contain layers, each of which contains a self-attention module, a cross-attention module, and a feedforward neural network. Initial embedding features of the layer Through the self-attention module, the calculation formula for extracting the overall structural information of the network is:
[0101] ,
[0102] ,
[0103] ,
[0104] in, Indicates that Node of time , its Layer Group self-attention calculation results; Indicates that Node of time , its The self-attention results of each group in the layer are concatenated and linearly mapped to obtain the final output result; Express The result obtained by residual calculation and layer normalization; express Time Node No. The initial embedding feature vector of the layer; express Time Node No. The initial embedding feature vector of the layer; , The neighbor set of The first traffic network corresponding to the city station (or area) network nodes, , is the number of attention heads; All are parameter matrices; represents the vector concatenation function; and Represents the layer normalization function; d is the dimension of the embedding vector.
[0105] Step S25, extracting information about structural changes generated under different conditions from the low-dimensional graph embedding features through a cross-attention module to obtain optimized graph embedding features;
[0106] Among them, different conditions refer to emergency conditions, which will lead to different network associations at different times. The calculation formula for extracting structural change information generated under different conditions through the cross-attention module is:
[0107] ,
[0108] ,
[0109] ,
[0110] in, express Node of time , its Layer Group cross attention calculation results; Indicates that Node of time , its The cross-attention results of each layer are concatenated and linearly mapped to obtain the final output result; Express The result obtained by residual calculation and layer normalization; All are parameter matrices; is a time-varying feature mask, and , is a tunable hyperparameter.
[0111] It should be noted that the time-varying feature mask is transformed by changing the network structure To control the adjustment.
[0112] Step S26, inputting the optimized graph embedding features into the feedforward network to obtain the embedding results of each node, and aggregating the embedding results of each node using a linear neural network layer of the feedforward network to obtain the overall graph embedding result;
[0113] Exemplarily, the calculation formula for obtaining the final embedding result of each node through the feedforward network is:
[0114] ,
[0115] ,
[0116] in, Indicates that Node of time , its Embedding result of the layer; Express The result obtained by residual calculation and layer normalization; are parameter matrices, is the ReLU activation layer function;
[0117] Through a linear neural network layer Directly aggregate to obtain the final overall graph embedding result , expressed as:
[0118] ,
[0119] Step S27: Based on the overall graph embedding result, the time domain Transformer module is used to predict the network structure and the status of each node in the future network.
[0120] Specifically, the time domain Transformer module includes an input layer, an encoder, a decoder, and an output layer.
[0121] For example, let the time domain Transformer contain Layer encoder, each layer contains a self-attention module and a feedforward neural network. For the decoder of downstream task prediction, a feedforward neural network is set.
[0122] The time domain Transformer module is used to predict the network structure and the status of each node in the future network, which specifically includes the following steps:
[0123] Step S271, perform temporal position encoding on the overall graph embedding result output by the graph domain Transformer to obtain initial embedding features;
[0124] For example, using trigonometric functions Perform temporal position encoding to obtain initial embedding features , and its calculation formula is:
[0125] ,
[0126] ,
[0127] ,
[0128] ,
[0129] in, for The overall graph embedding result at each moment; for The location characteristics of the moment; is the embedding vector dimension.
[0130] Step S272, extracting time series information using the self-attention module and feed-forward neural network of the time domain Transformer based on the initial embedded features;
[0131] Specifically, the initial time domain corresponding to the historical network snapshot sequence is embedded in the feature Through the self-attention module and feedforward neural network of the temporal Transformer, the calculation formula for extracting temporal information is:
[0132] ,
[0133] ,
[0134] ,
[0135] in, Indicates Layer Group self-attention calculation results; Indicates The final output obtained by concatenating and linearly mapping the self-attention results of each group in the layer and normalizing the result; Express The result obtained by normalization of the linear layer of the feedforward neural network; Indicates The initial time domain embedding features of the layer; are parameter matrices.
[0136] Step S273: Decoding through a graph decoder obtains prediction results of the future topology network and the status of each node in the future network.
[0137] Exemplarily, after passing through the graph decoder, The calculation formula for the embedding features of each node at time +1 is:
[0138] ,
[0139] in, is the parameter matrix; Indicated in The prediction results of the embedded features of each node at time +1; Indicates The initial temporal embedding features of the layer.
[0140] At the same time, the predicted output is:
[0141] ,
[0142] in, It is a two-layer ELU fully connected neural network; ; Indicated in +1 time node Prediction results of embedded features; Indicated in +1 time node Prediction results of embedded features.
[0143] It should be noted that when the input is When the predicted output , and obtain the corresponding prediction result of the future network structure .
[0144] At this point, the calculation formula for predicting the future state of network nodes through a linear neural network layer is:
[0145] ,
[0146] in, Represents the prediction result of future network node status; is the parameter matrix.
[0147] In order to prevent the time-varying features from being diluted, step S3 establishes an auxiliary task for predicting future changes in network structure under different conditions based on the changing network structure. The specific steps include:
[0148] Step S31: Based on the changed network structure, Laplace feature vectors are used to perform graph structure position encoding and graph embedding to obtain auxiliary initial graph embedding features;
[0149] It should be noted that the graph embedding principle of the auxiliary task is the same as that of the main task. Combined with the graph embedding calculation formula of steps S21-S23, when the input changes the network structure When , we get the corresponding adjacency matrix ,in ,based on Perform network topology position encoding and graph embedding to obtain auxiliary initial graph embedding features.
[0150] Step S32: Based on the auxiliary initial graph embedding features, the cross attention module of the graph domain Transformer module is used to extract the impact of the local change structure on the global network, and obtain the auxiliary optimized graph embedding features;
[0151] Step S33, inputting the auxiliary optimized graph embedding features into the feedforward network to obtain the auxiliary embedding results of each node, and aggregating the auxiliary embedding results using a linear neural network layer of the feedforward network to obtain the auxiliary overall graph embedding results;
[0152] In step S34, based on the auxiliary overall graph embedding result, the time domain Transformer module is used to predict future network structure changes under different conditions.
[0153] Similarly, in step S34, the process of predicting future network structure changes under different conditions is combined with the calculation formula of time domain prediction in the main task to encode the auxiliary overall graph embedding features in time sequence position to obtain the corresponding auxiliary initial embedding features; and input the self-attention module of the time domain Transformer model to extract the time sequence information; the prediction output decoded by the graph decoder , and obtain the prediction results of future network structure changes under different conditions .
[0154] In step S4, , Combined with the current network structure Input the multi-layer perceptron to aggregate information and obtain the preliminary prediction results of the final network structure ,Will Combination Input into another multi-layer perceptron for information aggregation to obtain the prediction results of the traffic demand of each node in the final network structure.
[0155] Specifically, the calculation formula for predicting the final network structure and the traffic demand of each node is:
[0156] ,
[0157] ,
[0158] in, Represents the preliminary prediction results of the final network structure; It represents the preliminary prediction results of the traffic demand corresponding to the final network structure; express The adjacency matrix corresponding to the traffic network structure at the time; are parameter matrices.
[0159] The multi-task composite loss function in step S5 includes the loss functions of future network structure prediction, future structure change prediction and traffic demand prediction, and its calculation formula is:
[0160] ,
[0161] ,
[0162] ,
[0163] in, Represents the loss function of the final network structure prediction; Represents the loss function for predicting future network structure changes; represents the loss function of traffic demand prediction; express The result obtained by residual calculation and layer normalization.
[0164] Considering the sparsity of the actual network, the loss function used in the global network prediction of the main task is the Focal Loss loss function to emphasize the accurate prediction of positive samples; for structural change prediction, it is necessary to focus on the changed edges, so the binary cross entropy loss function is used for the prediction results of the changed positive and negative samples; for traffic demand prediction, the prediction mean square error can be directly used as the loss function. Finally, the calculation formula of the composite loss function is obtained:
[0165] ,
[0166] in, represents the composite loss function; is an adjustable training parameter.
[0167] The composite loss function is used for auxiliary learning to train the network and update the model parameters until the model converges or reaches the maximum number of training iterations to obtain the final traffic demand forecast model, and then obtain the final traffic demand forecast result. .
[0168] The model diagram of the spatiotemporal graph learning method for traffic demand prediction according to the embodiment of the present invention is as follows: Figure 3 The prediction performance of the spatiotemporal graph learning method (AGT) is compared with that of other existing baseline method structures, as shown in Table 1. By comparing the results on different temporal network datasets, it can be seen that the AUC and PRC values of the prediction results of the AGT method proposed in the present invention are significantly higher than those of other existing methods.
[0169] Table 1
[0170]
[0171] Among them, other baseline methods include RNN-based spatiotemporal graph learning methods GloDyNE, GC-LSTM, and attention mechanism-based spatiotemporal graph learning method DySAT.
[0172] Compared with the prior art, the spatiotemporal graph learning method for traffic demand prediction provided in this embodiment finally realizes the traffic network structure and traffic demand prediction by constructing a multi-task prediction framework of temporal network snapshots and network change structures. On the one hand, the method not only utilizes the evolution law of the entire network, but also extracts and predicts information for the change structure through auxiliary tasks. At the same time, it pays attention to the impact of local structural changes on the future through the cross-attention module, explores the ripple effect it produces, and has a faster response ability and better adaptability in the face of emergencies; on the other hand, it uses the correlation of multiple tasks to obtain a composite loss function to learn and train the model, providing an effective solution for traffic demand prediction.
[0173] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0174] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A spatiotemporal graph learning method for traffic demand forecasting, characterized in that: The steps include: Using historical traffic data, based on network nodes at different times, the connection relationship between nodes and the traffic demand of each node, we can obtain the traffic flow time series network snapshots at different times and calculate the changing network structure; Based on the traffic flow time series network snapshot, the main task of predicting the future network structure and node status is established to obtain the prediction results of the future network structure and future network node status; Based on the changing network structure, an auxiliary task is established to predict the future changes of network structure under different conditions, and the prediction results of future changes of network structure are obtained; The prediction results of the main task and the auxiliary task are combined with the current network structure, input into the neural network for multi-task information aggregation, and the final network structure and the corresponding preliminary traffic demand prediction results are obtained; Calculate the multi-task composite loss function, use the composite loss function to assist in learning and training the network, and obtain the trained traffic demand forecasting model and traffic demand forecasting results; The prediction steps of the main task specifically include: Based on the traffic flow time series network snapshot, Laplace feature vectors are used to perform graph structure position encoding and graph embedding to obtain initial graph embedding features; Based on the initial graph embedding features, the self-attention module of the graph domain Transformer module is used to extract the overall information of the network structure to obtain a low-dimensional graph embedding feature; Based on the low-dimensional graph embedding features, the cross-attention module of the graph domain Transformer module is used to extract information about structural changes generated under different conditions to obtain optimized graph embedding features; Inputting the optimized graph embedding features into a feedforward network to obtain embedding results of each node, and aggregating the embedding results of each node using a linear neural network layer of the feedforward network to obtain an overall graph embedding result; Based on the overall graph embedding result, the future network structure and the status of each node in the future network are predicted using a time domain Transformer module; The prediction steps of the auxiliary task specifically include: Based on the changed network structure, Laplace feature vectors are used to perform graph structure position encoding and graph embedding to obtain auxiliary initial graph embedding features; Based on the auxiliary initial graph embedding features, the cross attention module of the graph domain Transformer module is used to extract the impact of the local change structure on the global network, and the auxiliary optimized graph embedding features are obtained; Inputting the auxiliary optimized graph embedding features into a feedforward network to obtain auxiliary embedding results of each node, and aggregating the auxiliary embedding results using a linear neural network layer of the feedforward network to obtain auxiliary overall graph embedding results; Based on the auxiliary overall graph embedding result, the time domain Transformer module is used to predict future network structure changes under different conditions; The multi-task information aggregation is to combine the prediction results of the future network structure and the prediction results of the future network structure change with the current network structure, input them into a multi-layer perceptron for information aggregation, and obtain a preliminary prediction result of the final network structure; combine the preliminary prediction results with the prediction results of the future network node state, input them into another multi-layer perceptron for information aggregation, and obtain a preliminary prediction result of the traffic demand corresponding to the final network structure. The expression of the preliminary prediction result of the traffic demand is: , , in, Represents the preliminary prediction results of the final network structure; It represents the preliminary prediction results of the traffic demand corresponding to the final network structure; All are parameter matrices; Represents the prediction result of the future network structure; express The adjacency matrix corresponding to the traffic network structure at the time; Represents the prediction results of future network structure changes under different conditions; Represents the prediction result of future network node status; is the ReLU activation layer function.
2. A spatiotemporal graph learning method for traffic demand prediction according to claim 1, characterized in that: The self-attention module extracts information based on the following formula: , , , in, Indicates that Node of time , its Layer Group self-attention calculation results; Indicates that Node of time , its The self-attention results of each group in the layer are concatenated and linearly mapped to obtain the final output result; Express The result obtained by residual calculation and layer normalization; express Time Node No. The initial embedding feature vector of the layer; express Time Node No. The initial embedding feature vector of the layer; , , is the total number of encoder layers in Transformer, is the number of attention heads; The neighbor set of For the transportation network network nodes; All are parameter matrices; represents the vector concatenation function; and Represents the layer normalization function; d is the dimension of the embedding vector.
3. A spatiotemporal graph learning method for traffic demand prediction according to claim 2, characterized in that: The criss-cross attention module extracts information based on the following formula: , , , in, express Node of time , its Layer Group cross attention calculation results; Indicates that Node of time , its The cross-attention results of each layer are concatenated and linearly mapped to obtain the final output result; Express The result obtained by residual calculation and layer normalization; express -1 moment node No. The output result is obtained by concatenating the self-attention results of each group in the layer and performing linear mapping, and then performing residual calculation and layer normalization to obtain the result; is a time-varying feature mask, and , is a tunable hyperparameter, are parameter matrices.
4. A spatiotemporal graph learning method for traffic demand prediction according to claim 1, characterized in that: The composite loss function is expressed as: , , , , in, represents the composite loss function; is an adjustable training parameter; Represents the loss function of the final network structure prediction; Represents the loss function for predicting future network structure changes; Represents the loss function for traffic demand prediction.
5. A spatiotemporal graph learning method for traffic demand prediction according to claim 1, characterized in that: The specific steps of predicting the future network structure and the status of each node in the future network include: Performing temporal position encoding on the overall graph embedding result to obtain initial embedding features; Extracting time series information using a self-attention module and a feed-forward neural network of a temporal Transformer module based on the initial embedding features; Decoding the future network structure and the prediction results of the states of each node in the future network by using a graph decoder; The calculation formula of the temporal position coding is: , , , , in, for Initial embedding features at the moment; for The overall graph embedding result at each moment; for The location characteristics of the moment; is the embedding vector dimension.
6. A spatiotemporal graph learning method for traffic demand prediction according to claim 5, characterized in that: The calculation formula for extracting the timing information is: , , , in, Indicates Layer Group self-attention calculation results; Indicates The final output obtained by concatenating and linearly mapping the self-attention results of each group in the layer and normalizing the result; Express The result obtained by normalization of the linear layer of the feedforward neural network; Indicates The initial time domain embedding features of the layer; are parameter matrices.
7. A spatiotemporal graph learning method for traffic demand prediction according to claim 1, characterized in that: The traffic flow time series network snapshot is expressed as: , the corresponding network change structure is: , in, Represents a snapshot of the traffic flow time series network; express The corresponding changes in the network structure; Represents a node in a transportation network; express The connection relationship between any nodes at any time; express The traffic demand of each node at the moment.
Citation Information
Patent Citations
Traffic flow prediction method
CN114299723A
Traffic flow prediction method based on Transform space-time diagram convolutional network
CN114330671A
Intercity online car-hailing multi-route demand prediction method and system based on space-time attention
CN118154244A
Traffic flow forecasting method based on multi-mode dynamic residual graph convolution network
US20230334981A1
