Traffic demand forecasting method, system, electronic device and computer storage medium

Extracting spatiotemporal features through multi-head gated self-attention and recursive graph attention modules, combined with the graph attention network, solves the problem of insufficient exploration of spatiotemporal features in existing traffic demand forecasting methods, and achieves highly accurate traffic demand forecasting.

CN115938112BInactive Publication Date: 2024-08-23HUAQIAO UNIVERSITY
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202211470118.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-23
Publication Date
2024-08-23
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing traffic demand forecasting methods fail to fully exploit spatiotemporal feature information, and have low scalability and solution accuracy, making it difficult to accurately predict urban traffic demand.

Method used

The multi-head gated self-attention extraction module and the multi-head gated recursive graph attention module are used to obtain global and local temporal feature matrices through temporal information encoding and spatial feature extraction, and are combined with the graph attention network to capture unstructured spatial dependencies and construct Codecs for traffic demand forecasting.

Benefits of technology

It achieves fast and accurate urban traffic demand forecasting, improves the accuracy and scalability of forecasts, and is superior to traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115938112B
    Figure CN115938112B
Patent Text Reader

Abstract

The present invention relates to a traffic demand prediction method, system, electronic device and computer storage medium, and relates to the field of intelligent traffic technology. The method comprises obtaining time series features in traffic data; encoding time series information according to the time series features to obtain an input feature matrix; extracting features using a multi-head gated self-attention extraction module in time according to the input feature matrix to obtain a feature matrix with time features; extracting features using a multi-head gated recursive graph attention module in space according to the feature matrix with time features to obtain a feature matrix with time features and space features; obtaining preset time traffic data; and determining a prediction result according to the preset time traffic data and the feature matrix with time features and space features. The present invention fully exploits the spatiotemporal features in traffic data, thereby realizing rapid and accurate prediction of urban traffic demand.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent transportation technology, and in particular to a traffic demand forecasting method, system, electronic equipment and computer storage medium. Background Art

[0002] In recent years, with the rapid development of urban transportation, people's transportation needs have increased day by day, and more and more cities are committed to developing intelligent transportation systems (ITS). This has also caused many scholars to study related issues, such as urban traffic light timing optimization, rail transit line planning, and personalized travel route recommendations. The basic problem that needs to be solved is traffic demand prediction. By predicting the number of traffic demands in various areas of the city, traffic resources can be reasonably allocated in advance, thereby alleviating traffic congestion, saving travelers' travel time, and avoiding the waste of public resources. In order to provide better services for people's daily travel and maximize the use of traffic resources, it is very necessary to predict traffic demand.

[0003] Later, with the widespread application of convolutional neural networks (CNN) and recurrent neural networks (RNN) in the fields of computer image processing and natural language processing (NLP), more and more research works began to apply deep neural networks to traffic forecasting. These research works can be divided into methods based on convolutional neural networks, methods based on recurrent neural networks, and methods that combine convolutional neural networks and recurrent neural networks. Compared with the traditional parameter model methods and traditional machine learning methods, these deep learning-based methods can achieve better results without over-reliance on manual work. Although these methods can achieve certain success, there are still problems that need to be solved for accurate and long-term predictions. As we all know, urban traffic demand data is a kind of spatiotemporal data, which describes the traffic demand generated by different areas or stations in the city along the time dimension. The problem that needs to be solved is how to model this spatiotemporal data while considering both the time and space dimensions.

[0004] For feature extraction in the time dimension, existing research works either use recurrent neural networks or one-dimensional convolutional neural networks. Existing research works based on recurrent neural networks use long short-term memory (LSTM) or gated recurrent units (GRU) to capture time correlation, but RNN is easily affected by gradient vanishing when capturing time correlation, which is particularly serious in long-term prediction problems. Existing research works based on convolutional neural networks use one-dimensional convolution, and the receptive field of the convolution kernel is limited, so the dependency relationship in the time series can only be observed locally.

[0005] For feature extraction in the spatial dimension, existing research works either use convolutional neural networks or graph convolutional neural networks. Researchers have tried to grid the entire traffic study area and use convolutional neural networks to extract spatial correlations. However, due to the topological structure of the road network, the relationship between stations is often a non-Euclidean spatial relationship. Traditional convolutional neural networks cannot correctly extract features from such unstructured data, that is, traditional discrete convolutions cannot maintain translation invariance on non-Euclidean structured data. Later, because graph convolutional neural networks (GCNs) have excellent performance in processing non-Euclidean structured data, they can establish topological associations and effectively extract spatial features, so in recent years, graph convolutional neural networks have also been widely used in the transportation field. However, in graph convolution operations, expensive matrix operations are often required and they are overly dependent on the structural information of the graph, so it is also difficult to achieve satisfactory results.

[0006] The existing methods fail to fully mine the spatiotemporal feature information, and have shortcomings such as poor scalability and low solution accuracy. Summary of the invention

[0007] The purpose of the present invention is to provide a traffic demand forecasting method, system, electronic device and computer storage medium, which can realize rapid and accurate forecasting of urban traffic demand by fully mining the spatiotemporal characteristics in traffic data.

[0008] To achieve the above object, the present invention provides the following solutions:

[0009] A traffic demand forecasting method, comprising:

[0010] Obtaining time series features in traffic data;

[0011] Encode the time series information according to the time series features to obtain an input feature matrix; the input feature matrix includes a global time feature matrix and a local time feature matrix;

[0012] Extracting features using a temporal multi-head gated self-attention extraction module according to the input feature matrix to obtain a feature matrix with temporal features;

[0013] Extracting features using a multi-head gated recursive graph attention module in space according to the feature matrix with time features to obtain a feature matrix with time features and space features;

[0014] Get traffic data at preset time;

[0015] The prediction result is determined according to the preset time traffic data and the feature matrix with time characteristics and space characteristics.

[0016] Optionally, the input feature matrix is ​​expressed as:

[0017] X t (0) =X t +GE t +PE t

[0018] Among them, X t (0) is the input feature matrix, X t is the traffic demand characteristic matrix at time step t, GE t is the global time feature matrix, PE t is the local time feature matrix, and t is the time step.

[0019] Optionally, the extracting features using a multi-head gated self-attention extraction module in time according to the input feature matrix to obtain a feature matrix with time features specifically includes:

[0020] Processing the input feature matrix using a self-attention mechanism to obtain time series data;

[0021] A gating operation is performed according to the time series data to obtain a feature matrix with time characteristics; the gating operation includes linear projection and sigmoid operation.

[0022] Optionally, determining the prediction result according to the preset time traffic data and the feature matrix with time features and space features specifically includes:

[0023] Embedding the traffic data at the preset time with global time features and local time features to obtain a decoder input;

[0024] Processing the decoder input using multi-head gated self-attention with occlusion in time to obtain timing information;

[0025] Determine the output result of the temporal multi-head gated self-attention extraction module using the temporal multi-head gated self-attention extraction module according to the timing information and the feature matrix with temporal features and spatial features;

[0026] The prediction result is determined by using the spatial multi-head gated recursive graph attention module according to the output result of the temporal multi-head gated self-attention extraction module and the feature matrix with temporal features and spatial features.

[0027] The present invention also provides a traffic demand prediction system, comprising:

[0028] A time series feature acquisition module is used to acquire time series features in traffic data;

[0029] A time series information encoding module, used to encode the time series information according to the time series features to obtain an input feature matrix; the input feature matrix includes a global time feature matrix and a local time feature matrix;

[0030] A multi-head gated self-attention extraction module is used to extract features according to the input feature matrix using the multi-head gated self-attention extraction module in time to obtain a feature matrix with time features;

[0031] A multi-head gated recursive graph attention module module is used to extract features using a multi-head gated recursive graph attention module in space according to the feature matrix with time features, so as to obtain a feature matrix with time features and space features;

[0032] A preset time traffic data acquisition module is used to acquire preset time traffic data;

[0033] The prediction module is used to determine the prediction result according to the preset time traffic data and the feature matrix with time characteristics and space characteristics.

[0034] Optionally, the input feature matrix is ​​expressed as:

[0035]

[0036] in, is the input feature matrix, X t is the traffic demand characteristic matrix at time step t, GE t is the global time feature matrix, PE t is the local time feature matrix, and t is the time step.

[0037] Optionally, the multi-head gated self-attention extraction module specifically includes:

[0038] A self-attention mechanism unit, used to process the input feature matrix using a self-attention mechanism to obtain time series data;

[0039] A gating operation unit is used to perform a gating operation according to the time series data to obtain a feature matrix with time characteristics; the gating operation includes linear projection and sigmoid operation.

[0040] Optionally, the prediction module specifically includes:

[0041] An embedding unit, used for embedding the traffic data at the preset time with global time features and local time features to obtain a decoder input;

[0042] A timing information determination unit, configured to process the decoder input using multi-head gated self-attention with occlusion in time to obtain timing information;

[0043] A decoder temporal multi-head gated self-attention extraction module output result determination unit is used to determine the temporal multi-head gated self-attention extraction module output result using the temporal multi-head gated self-attention extraction module according to the timing information and the feature matrix with temporal features and spatial features;

[0044] A prediction unit is used to determine a prediction result using the spatial multi-head gated recursive graph attention module according to the output result of the temporal multi-head gated self-attention extraction module and the feature matrix with temporal features and spatial features.

[0045] The present invention also provides an electronic device, comprising:

[0046] one or more processors;

[0047] a storage device having one or more programs stored thereon;

[0048] When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement any of the methods described above.

[0049] The present invention also provides a computer storage medium having a computer program stored thereon, wherein the computer program implements any of the above methods when executed by a processor.

[0050] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0051] The present invention obtains time series features in traffic data; encodes time series information according to the time series features to obtain an input feature matrix; the input feature matrix includes a global time feature matrix and a local time feature matrix; extracts features according to the input feature matrix using a multi-head gated self-attention extraction module in time to obtain a feature matrix with time features; extracts features according to the feature matrix with time features using a multi-head gated recursive graph attention module in space to obtain a feature matrix with time features and space features; obtains traffic data at a preset time; determines a prediction result according to the traffic data at the preset time and the feature matrix with time features and space features, and fully exploits the spatiotemporal features in the traffic data, thereby realizing rapid and accurate prediction of urban traffic demand. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0053] Figure 1 An overview of the traffic demand forecasting method provided by the present invention;

[0054] Figure 2 Schematic diagram of the multi-head gated self-attention extraction module provided by the present invention;

[0055] Figure 3 A schematic diagram of a multi-head gated recursive graph attention module provided by the present invention;

[0056] Figure 4 This is a flow chart of the traffic demand forecasting method provided by the present invention. DETAILED DESCRIPTION

[0057] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0058] The purpose of the present invention is to provide a traffic demand forecasting method, system, electronic device and computer storage medium, which can realize rapid and accurate forecasting of urban traffic demand by fully mining the spatiotemporal characteristics in traffic data.

[0059] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0060] like Figure 1 and Figure 4 As shown, the present invention provides a traffic demand forecasting method, which is specifically applicable to multivariate time series forecasting of traffic demand, comprising:

[0061] Step 101: Obtain time series features in traffic data.

[0062] Step 102: Encode the time series information according to the time series features to obtain an input feature matrix; the input feature matrix includes a global time feature matrix and a local time feature matrix.

[0063] Temporal information encoding: This is accomplished by designing a temporal information encoding module, which uses a scheme to embed local and global temporal information. Assume that at time step t, there is a feature matrix X t , and the information of the minute, hour, day, week, month and other dimensions of the time step t can be obtained from the time step t. The dimension can be projected to the f′ dimension through the linear layer to obtain the global time feature matrix of the traffic demand at the time step t N is the number of virtual regions that need to be predicted; and the acquisition of the local time feature matrix uses relative position encoding, as shown in formula (1):

[0064]

[0065] Where pos∈{1,2,...} represents the position in the time series, and pi∈{1,2,...,f′} represents the position in the feature series. The local time feature matrix of the traffic demand at time step t can be obtained by formula (1): Then at time step t, the input feature matrix containing global time features and local time features embedded is It can be calculated by formula (2):

[0066]

[0067] in, is the input feature matrix, X t is the traffic demand characteristic matrix at time step t, GE t is the global time feature matrix, PE t is the local time feature matrix, and t is the time step.

[0068] Step 103: Perform feature extraction using a temporal multi-head gated self-attention extraction module based on the input feature matrix to obtain a feature matrix with temporal features.

[0069] Step 103 specifically includes: using the self-attention mechanism to process the input feature matrix to obtain time series data; performing a gating operation on the time series data to obtain a feature matrix with time features; the gating operation includes linear projection and sigmoid operation.

[0070] Temporal feature extraction: By designing a Figure 2 The multi-head gated self-attention extraction module shown in the figure is completed, which is mainly composed of self-attention mechanism and gating operation. The self-attention mechanism is a variant of the attention mechanism, which reduces the dependence on external information and is better at capturing the internal correlation of data. Its definition is shown in formula (3):

[0071]

[0072] Among them, Q, K, V and f′ represent query, key, value and their dimensions respectively. In the time dimension T, the dimensions of key and value are the same, and the dimension of query can be different from that of key value, such as Figure 2 The time length T q and T v Can be unequal, Q, K, and V are all two-dimensional feature matrices of the site along the time dimension, Attention(Q,K,V) is the self-attention calculation formula.

[0073] The use of a multi-head self-attention mechanism allows this method to simultaneously focus on information from different representation subspaces at different locations. In order to reduce the impact of weakly correlated information, an output gate is added to control the linear projection and sigmoid operation of the time series data, so that a pattern can be learned to control the output results of the multi-head self-attention mechanism. The definition of the multi-head gated self-attention module in time is shown in formula (4):

[0074]

[0075] Where h is the number of heads, d = f′ / h, d is the dimension size in a single head, ⊙ is the Hadamard product, Q i =QW i Q i={1,2,...,h},K i =KW i K , V i =VW i V , Q i ′=QW i Q′ , parameter matrix W i Q , W iK , W i V and head i is the gated self-attention calculation of the i-th head. i ′ is the query value mapping calculation of the i-th head, σ is the Sigmoid calculation, and GatedSelfAttention is the gated multi-head self-attention calculation value.

[0076] Step 104: Perform feature extraction using a spatial multi-head gated recursive graph attention module based on the feature matrix with temporal features to obtain a feature matrix with temporal features and spatial features.

[0077] Spatial feature extraction: By designing a Figure 3 The multi-head gated recursive graph attention module in the space shown is completed, which is mainly composed of GAT and GRU. Like GCN, GAT can generalize the traditional convolution operation from structured data to graph structured data, and can capture the unstructured information hidden in the graph. The overall idea of ​​GAT is to use the attention network to aggregate the node information in the neighborhood, that is, to use the sub-network to calculate the importance of the neighboring nodes to the target node, and then aggregate the neighboring nodes according to the calculated importance, and the sub-network is learnable, which enhances the generalization ability. In the method of the present invention, given the input feature matrix of t time steps in Represents the characteristic information of node i at time step t, the correlation between target node i and all neighbor nodes j (j = 1, 2, ..., N) The calculation is as follows:

[0078]

[0079] Among them, || represents the splicing operation, and the parameter matrix f″ is the hidden feature dimension. And use multi-head attention, that is, call C groups of independent correlation calculations on the above formula, and then splice their output results, as shown in the following formula:

[0080]

[0081] in, are independent correlation calculation results, C is the total number of calculation groups, is the weight coefficient calculated from the correlation of group c, and the parameter matrix The characteristic matrix of node i at time step t can be calculated Formally, the long GAT can be defined as follows:

[0082]

[0083] The above formula can be used to calculate the characteristic matrix of all nodes

[0084] If graph attention is used to extract spatial features from data at different time points, it is assumed that the spatial feature distributions at different time points are independent, which is not true. Because the spatial feature distribution of this time step affects the spatial feature distribution of the next time step, it is necessary to use the spatial feature distribution information of the previous time step to capture the spatial feature distribution of this time step. In order to capture this dynamic information across spatial dimensions, a gated recurrent graph attention unit (GRGAU) is further designed, and the calculation formula is defined as follows:

[0085]

[0086] in, and are the input and output feature matrices, R t To reset the gate, Z t is the update gate, W xr , W xz , W xh , Whr, W hz and b r 、b z and They are all parameter matrices, which are the parameters in the calculation process, tanh is the activation function, X t ′ is the multi-head gated graph attention calculation result, is the hidden state at time t.

[0087] Step 105: Obtain traffic data at a preset time.

[0088] Step 106: Determine a prediction result according to the preset time traffic data and the feature matrix with time features and space features.

[0089] Step 106 specifically includes:

[0090] The preset time traffic data is embedded with global time features and local time features to obtain a decoder input.

[0091] The decoder input is processed using multi-head gated self-attention with occlusion in time to obtain timing information.

[0092] The output result of the temporal multi-head gated self-attention extraction module is determined by utilizing the temporal multi-head gated self-attention extraction module according to the timing information and the feature matrix with temporal features and spatial features.

[0093] The prediction result is determined by using the spatial multi-head gated recursive graph attention module according to the output result of the temporal multi-head gated self-attention extraction module and the feature matrix with temporal features and spatial features.

[0094] Constructing the codec structure: Like most codec structures, the encoder of the present invention consists of L e Each layer consists of two basic modules, namely, the multi-head gated self-attention module in time and the multi-head gated recursive graph attention module in space, which capture the characteristics of traffic demand data in the time dimension and the spatial dimension respectively. The decoder consists of L d The first module captures the timing information in the decoder input sequence and uses a masked mechanism to prevent each temporal position from paying attention to future sequence information; the second module is used to capture the decoder sequence (query) and the encoder output sequence (key-value ). The spatial multi-head gated recurrent graph attention module is also different from that in the encoder. The initial hidden state input is the hidden state of the encoder's final output. After the decoder L d After the layer, the output is Then the dimension f′ is mapped back to f through the linear layer, and the end T is truncated p The traffic demand characteristic matrix of time steps is used to obtain the final prediction result In the present invention, except for global time embedding and local time embedding, residual connections and layer normalization are used between other modules to ensure that the model can still be effectively trained when the number of layers is deepened.

[0095] In this paper, firstly, gated self-attention is used to extract temporal features in the sequence. Secondly, graph attention is used to capture the spatial dependencies between different variables in the unstructured space. Finally, it is proposed to use gated recurrent units combined with hidden spatial states to capture multi-level spatial dependencies.

[0096] This implementation example uses the New York City taxi dataset and the San Francisco Bay Area bicycle dataset for experimental analysis. The relevant information of the dataset is shown in Table 1.

[0097] Table 1 Dataset statistics

[0098]

[0099] The mean absolute error (MAE) and root mean square error (RMSE) are used to evaluate the prediction performance of different methods. The two are defined as follows:

[0100]

[0101]

[0102] in, is the total number of test samples, and X t are the predicted value of the traffic demand characteristic matrix and the traffic demand characteristic matrix at the corresponding time step t, respectively.

[0103] As shown in Table 2, the methods compared in the present invention are as follows: HA: Calculate the average of historical demand values ​​to predict future values. SVR: A method using a linear support vector machine to perform regression tasks. XGBoost: A method based on gradient boosting trees. FC-LSTM: A method combining LSTM and a feedforward neural network. LSTNet: A method combining a convolutional neural network and a recursive neural network. Graph WaveNet: A space-time graph convolutional network that combines diffuse graph convolution with dilated convolution. MTGNN: A graph neural network framework suitable for multivariate time series prediction, which designs a special graph learning module to extract dependencies between variables.

[0104] The present invention is set up as follows: all data sets are divided into training set, validation set and test set in a ratio of 7:1:2, and a standard normalization method is used. h Set to 12, prediction time step T p Set to 12, predict the previous T b The step size is set to T h / 2. The GSTGAT method is implemented using the Pytorch framework, with the learning rate set to 0.001 and the batch size set to 32. All methods are optimized by the Adam algorithm, using MSE as the loss function. The Early Stopping method is used to prevent overfitting, patience is set to 5, and the training epochs does not exceed 100. For all compared methods, their key parameters are adjusted to ensure the best performance.

[0105] All experiments are the average results of repeated training for 5 times. Table 2 shows the comparison results of the proposed method and other methods when the prediction time step is 12. The proposed method achieves the best performance results on both datasets. Since the demand for taxis in New York City is much greater than the demand for bicycles in the San Francisco Bay Area, the evaluation indicators calculated by various methods on the taxi dataset are larger than those on the bicycle dataset.

[0106] HA, SVR, XGBoost, and FC-LSTM perform poorly because these methods only consider temporal correlation but not spatial correlation. LSTNet combines recursive neural networks and convolutional neural networks to capture both temporal and spatial correlations, so it performs better than the previous methods. GraphWaveNet and MTGNN use graph convolution to capture spatial correlation, so they perform better on such unstructured data. Although both methods propose adaptive adjacency matrices, neither method can effectively predict without a given graph adjacency matrix. On the New York City taxi dataset, the method provided by the present invention improves MAE and RMSE by 5.4% and 3.2% respectively over the nearest method MTGNN. On the San Francisco Bay Area bicycle data, the method provided by the present invention improves MAE and RMSE by 3.7% and 4.1% respectively over the nearest method MTGNN.

[0107] Table 2 Experimental comparison of different methods on New York taxi and San Francisco Bay Area bicycle datasets

[0108]

[0109] The present invention also provides a traffic demand prediction system, comprising:

[0110] The time series feature acquisition module is used to obtain the time series features in the traffic data.

[0111] The time series information encoding module is used to encode the time series information according to the time series characteristics to obtain an input feature matrix; the input feature matrix includes a global time feature matrix and a local time feature matrix.

[0112] The multi-head gated self-attention extraction module is used to perform feature extraction based on the input feature matrix using the multi-head gated self-attention extraction module in time to obtain a feature matrix with time characteristics.

[0113] The multi-head gated recursive graph attention module is used to extract features using the spatial multi-head gated recursive graph attention module according to the feature matrix with time features to obtain a feature matrix with time features and space features.

[0114] The preset time traffic data acquisition module is used to acquire the preset time traffic data.

[0115] The prediction module is used to determine the prediction result according to the preset time traffic data and the feature matrix with time characteristics and space characteristics.

[0116] As an optional implementation, the expression of the input feature matrix is:

[0117]

[0118] in, is the input feature matrix, X t is the traffic demand characteristic matrix at time step t, GE t is the global time feature matrix, PE t is the local time feature matrix, and t is the time step.

[0119] As an optional implementation, the multi-head gated self-attention extraction module specifically includes:

[0120] The self-attention mechanism unit is used to process the input feature matrix using the self-attention mechanism to obtain time series data.

[0121] A gating operation unit is used to perform a gating operation according to the time series data to obtain a feature matrix with time characteristics; the gating operation includes linear projection and sigmoid operation.

[0122] As an optional implementation manner, the prediction module specifically includes:

[0123] The embedding unit is used to embed the global time feature and the local time feature of the preset time traffic data to obtain a decoder input.

[0124] A timing information determination unit is used to process the decoder input using multi-head gated self-attention with occlusion in time to obtain timing information.

[0125] The decoder's temporal multi-head gated self-attention extraction module output result determination unit is used to determine the temporal multi-head gated self-attention extraction module output result using the temporal multi-head gated self-attention extraction module according to the timing information and the feature matrix with temporal features and spatial features.

[0126] A prediction unit is used to determine a prediction result using the spatial multi-head gated recursive graph attention module according to the output result of the temporal multi-head gated self-attention extraction module and the feature matrix with temporal features and spatial features.

[0127] The present invention also provides an electronic device, comprising:

[0128] One or more processors.

[0129] A storage device having one or more programs stored thereon.

[0130] When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement any of the methods described above.

[0131] The present invention also provides a computer storage medium having a computer program stored thereon, wherein the computer program implements any of the above-mentioned methods when executed by a processor.

[0132] The present invention discloses a method for predicting urban traffic demand based on gated spatiotemporal graph attention, which comprises the following steps in sequence: by designing a scheme that uses local time information and global time information to embed, the temporal information encoding is completed; by combining the self-attention mechanism with the scheme of gated operation, the temporal feature extraction is completed; by combining the scheme of graph attention network and gated recursive unit, the spatial feature extraction is completed; finally, by constructing a codec, the urban traffic demand prediction method is realized, which can realize end-to-end operation. The examples of the present invention also conduct experimental comparative analysis on the New York City taxi dataset and the San Francisco bicycle dataset, and make quantitative analysis through the two evaluation indicators of RMSE and MAE, thereby verifying the accuracy of the prediction of the proposed method. The present invention has high scalability, good robustness, and comprehensive practicality, which can provide necessary reference for smart city transportation, is very convenient for traffic operation management, and has a broad application space.

[0133] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0134] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A traffic demand forecasting method, characterized in that: include: Obtaining time series features in traffic data; Encode the time series information according to the time series features to obtain an input feature matrix; the input feature matrix includes a global time feature matrix and a local time feature matrix; Extracting features using a temporal multi-head gated self-attention extraction module according to the input feature matrix to obtain a feature matrix with temporal features; Extracting features using a multi-head gated recursive graph attention module in space according to the feature matrix with time features to obtain a feature matrix with time features and space features; Get traffic data at preset time; Determine a prediction result according to the preset time traffic data and the feature matrix with time characteristics and space characteristics; The expression of the input feature matrix is: X t (0) =X t +GE t +PE t ; Among them, X t (0) is the input feature matrix, X t is the traffic demand characteristic matrix at time step t, GE t is the global time feature matrix, PE t is the local time feature matrix, t is the time step; The step of extracting features using a multi-head gated self-attention extraction module in time according to the input feature matrix to obtain a feature matrix with time features specifically includes: Processing the input feature matrix using a self-attention mechanism to obtain time series data; Performing a gating operation on the time series data to obtain a feature matrix with time characteristics; the gating operation includes linear projection and sigmoid operation; The determining of the prediction result according to the preset time traffic data and the feature matrix with time characteristics and space characteristics specifically includes: Embedding the traffic data at the preset time with global time features and local time features to obtain a decoder input; Processing the decoder input using multi-head gated self-attention with occlusion in time to obtain timing information; Determine the output result of the temporal multi-head gated self-attention extraction module using the temporal multi-head gated self-attention extraction module according to the timing information and the feature matrix with temporal features and spatial features; The prediction result is determined by using the spatial multi-head gated recursive graph attention module according to the output result of the temporal multi-head gated self-attention extraction module and the feature matrix with temporal features and spatial features.

2. A traffic demand forecasting system, characterized in that: include: A time series feature acquisition module is used to acquire time series features in traffic data; A time series information encoding module, used to encode the time series information according to the time series features to obtain an input feature matrix; the input feature matrix includes a global time feature matrix and a local time feature matrix; A multi-head gated self-attention extraction module is used to extract features according to the input feature matrix using the multi-head gated self-attention extraction module in time to obtain a feature matrix with time features; A multi-head gated recursive graph attention module is used to extract features according to the feature matrix with time features using a multi-head gated recursive graph attention module in space to obtain a feature matrix with time features and space features; A preset time traffic data acquisition module is used to acquire preset time traffic data; A prediction module, used for determining a prediction result according to the preset time traffic data and the feature matrix with time characteristics and space characteristics; The expression of the input feature matrix is: X t (0) =X t +GE t +PE t ; Among them, X t (0) is the input feature matrix, X t is the traffic demand characteristic matrix at time step t, GE t is the global time feature matrix, PE t is the local time feature matrix, t is the time step; The multi-head gated self-attention extraction module specifically includes: A self-attention mechanism unit, used to process the input feature matrix using a self-attention mechanism to obtain time series data; A gating operation unit, used for performing a gating operation according to the time series data to obtain a feature matrix with time characteristics; the gating operation includes a linear projection and a sigmoid operation; The prediction module specifically includes: An embedding unit, used for embedding the traffic data at the preset time with global time features and local time features to obtain a decoder input; A timing information determination unit, configured to process the decoder input using multi-head gated self-attention with occlusion in time to obtain timing information; A decoder temporal multi-head gated self-attention extraction module output result determination unit is used to determine the temporal multi-head gated self-attention extraction module output result using the temporal multi-head gated self-attention extraction module according to the timing information and the feature matrix with temporal features and spatial features; A prediction unit is used to determine a prediction result using the spatial multi-head gated recursive graph attention module according to the output result of the temporal multi-head gated self-attention extraction module and the feature matrix with temporal features and spatial features.

3. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method as claimed in claim 1 .

4. A computer storage medium, characterized in that: A computer program is stored thereon, wherein when the computer program is executed by a processor, the method according to claim 1 is implemented.

Citation Information

Patent Citations

  • Traffic flow prediction method and system for urban road network

    CN112183862A

  • Traffic prediction method and device

    CN113065690A

  • Transform-based adaptive space-time diagram neural network traffic flow prediction method and system

    CN114492992A

  • Multivariate time series prediction method and system, computer product and storage medium

    CN114493014A

  • Hybrid neural network training method, traffic flow prediction method, equipment and medium

    CN114742210A