A traffic flow prediction method based on spatiotemporal series
Through the combination of multi-model fusion and specific embedding and attention modules, the shortcomings of existing traffic flow prediction methods in spatiotemporal dependence modeling are solved, and higher prediction accuracy and stability are achieved.
Patent Information
- Application Number
- CN202510040601.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2045-01-10
AI Technical Summary
When the existing deep learning-based traffic flow prediction method deals with complex spatiotemporal dependencies in traffic flow, the model parameters are large and the calculation overhead is high, making it difficult to achieve real-time prediction, and may ignore the true topology of the traffic network or it is difficult to capture long and short-term time dependencies.
Using multi-model fusion, we use open source network traffic flow data for preprocessing, and use the data embedding layer for periodic and adaptive spatiotemporal embedding, combining the distance space attention module and the gated time convolution attention module for spatial and time-dependent modeling, and finally predicting traffic flow through the output layer.
It improves the accuracy and stability of traffic flow prediction, enhances the modeling ability of complex spatiotemporal characteristics of traffic flow, reduces error accumulation, and thus improves prediction accuracy.
Smart Images

Figure CN119479312B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of traffic prediction, and in particular relates to a traffic flow prediction method based on spatiotemporal sequences. Background Art
[0002] With the surge in the number of motor vehicles, the existing urban road infrastructure faces huge challenges, and the pressure on the urban transportation system is gradually increasing. The imbalance between supply and demand of urban road resources has become more prominent, traffic congestion has become more severe, and the situation is becoming increasingly serious. As the problem of traffic congestion becomes increasingly serious, the traditional response measures used in the past, such as limiting the number of vehicles, adding lanes or widening roads, have been unable to fundamentally solve this dilemma. In the face of this challenge, the introduction of intelligent transportation systems has become a key way to solve urban traffic congestion. By optimizing traffic management through scientific and technological means, intelligent transportation is expected to provide sustainable solutions in the longer term. Traffic forecasting is the cornerstone of intelligent transportation systems (ITS), which aims to understand and develop optimal transportation systems and minimize traffic congestion. By predicting future traffic, it provides a reference for urban planning and traffic management, thereby reducing congestion, improving traffic efficiency, and providing early warning for public safety emergency management. This task is directly related to urban traffic management and planning, and its accuracy directly affects the operating efficiency of the urban transportation system and the travel experience of residents. Therefore, accurately predicting traffic conditions has become an urgent need in today's urban management. By making traffic forecasts based on historical observation data, traffic management agencies can better regulate traffic flow and rationally plan road resources, thereby reducing traffic congestion and improving the operating efficiency and service quality of urban transportation systems.
[0003] The development of traffic flow prediction methods can be roughly divided into two categories: traditional methods and methods based on deep learning. Traditional methods mainly include dynamic modeling methods and data-driven methods. Dynamic modeling is based on physical and mathematical models for prediction, and uses the basic laws of the traffic system for modeling. Data-driven methods use statistical models and traditional machine learning models, which capture the time-dependent characteristics of traffic flow by analyzing historical data. With the advancement of big data and deep learning technology, traffic flow prediction has gradually turned to deep learning-based methods. Deep learning methods use the powerful computing power of neural networks to effectively capture the spatiotemporal dependencies of traffic data. This type of method is mainly divided into models based on grid data and graph-structured data. The grid-based method divides the city into multiple regions and uses a deep learning architecture to model the traffic flow in each region in a spatiotemporal manner. The graph-structured data model uses a graph neural network to process the topological structure of the traffic network, better reflecting the complex spatial dependencies in the traffic network.
[0004] Although the existing deep learning-based traffic flow prediction methods have achieved significant improvements in accuracy, they still have some obvious drawbacks. First, when dealing with complex spatiotemporal dependencies in traffic flow, these methods often need to design complex network structures, resulting in a large number of model parameters and high computational overhead. Especially when dealing with large-scale traffic data, the time cost of training and reasoning is high, which limits its application in real-time prediction. Secondly, grid-based models may ignore the true topological structure of the traffic network, resulting in the loss or insufficiency of spatial information. Although graph-based models can better capture spatial relationships, the complexity of the model and the requirements for computing resources are high. In addition, many deep learning models fail to fully consider the long-term and short-term temporal dependencies or dynamic change characteristics in traffic flow, and their performance is limited when dealing with emergencies and non-periodic traffic fluctuations. Summary of the invention
[0005] In view of the above-mentioned deficiencies in the prior art, the present invention provides a traffic flow prediction method based on spatiotemporal sequences. The present invention can effectively overcome the deficiencies of the existing methods in spatiotemporal dependency modeling, and adopts a multi-model fusion approach to predict traffic flow, which can effectively improve the accuracy of traffic flow prediction.
[0006] In order to achieve the above objectives, the technical solution adopted by the present invention is: a traffic flow prediction method based on spatiotemporal sequence, comprising the following steps:
[0007] S1. Obtain open source network traffic flow data and perform preprocessing to obtain traffic flow sequence;
[0008] S2, input the traffic flow sequence into the data embedding layer to obtain a high-dimensional representation of the input features, and perform periodic embedding and adaptive spatiotemporal embedding, and connect the three embeddings to obtain a hidden spatiotemporal representation;
[0009] S3, input the hidden spatiotemporal representation into the spatiotemporal encoder to model the spatial and temporal dependencies and obtain the hidden state;
[0010] S4. Input the hidden state into the output layer and output the traffic flow prediction result.
[0011] The beneficial effects of the present invention are as follows: by combining step-by-step embedding with multiple modules, the modeling capability of complex spatiotemporal characteristics of traffic flow is enhanced. First, through periodic embedding, the model can flexibly capture daily and weekly traffic periodic characteristics in the time dimension, and can adaptively construct hidden spatiotemporal representations from the data through adaptive spatiotemporal embedding. Secondly, through the distance space attention module, the model can effectively capture the spatial dependency characteristics of neighboring nodes and long-distance similar nodes, and realize the fine modeling of different distance dependency features. The introduction of the gated time convolution attention module further enhances the model's ability to capture long-term dependency features, which helps to alleviate the gradient explosion problem. Finally, the application of the fusion module ensures the effective integration of the outputs of different attention modules, and adopts a multi-step prediction method to reduce error accumulation, thereby improving prediction accuracy and stability. In summary, this method can effectively improve the ability to capture spatiotemporal features and the accuracy of traffic prediction, and enhance the generalization ability of the model in complex traffic scenarios.
[0012] Furthermore, the S1 is specifically:
[0013] Get open source network traffic data;
[0014] The acquired open source network traffic flow data is sliced to obtain a traffic flow sequence, where each time slice contains 12 time steps.
[0015] The beneficial effect of the above further scheme is that by slicing the traffic flow data, the model can more effectively learn the rules of different time periods, and to a certain extent reduce the noise and redundant information brought by long-term sequences.
[0016] Furthermore, the S2 is specifically:
[0017] Input the traffic flow sequence into the data embedding layer to obtain feature embedding ;
[0018] Compute two embeddings covering weekly and daily periodicity respectively , ,in, and Respectively indicate the time t Functions to convert to week index and minute index respectively;
[0019] By connecting all T The embedding of time slices results in the periodic embedding and daily cycle embedding ;
[0020] The learnable adaptive spatiotemporal embedding is represented as ,in, Can be shared among different traffic time series;
[0021] Embedding the Weekly Cycle , daily cycle embedding and adaptive spatiotemporal embedding Connect and get the hidden space-time representation .
[0022] The beneficial effect of the above further scheme is that by introducing weekly cycle embedding, daily cycle embedding and adaptive spatiotemporal embedding, it can help the model effectively capture the hidden spatiotemporal representation in traffic flow data.
[0023] Furthermore, the space-time encoder comprises:
[0024] The distance space attention module is used to capture the spatial dependency features of neighboring nodes and distant similar nodes based on the hidden spatiotemporal representation using a dynamic masking matrix;
[0025] A gated temporal convolutional attention module for extracting temporally dependent features based on hidden spatiotemporal representations via a dilated causal convolutional network;
[0026] The fusion module is used to fuse the spatial dependency features of neighbors, the spatial dependency features of distant similar nodes, and the time dependency features to obtain the hidden state.
[0027] The beneficial effect of the above further scheme is that through the combination of the distance space attention module and the gated time convolution attention module, the spatial dependency features of neighboring nodes and distant nodes can be captured at the same time, and complex temporal dependencies can be extracted. The fusion module further integrates these spatiotemporal features, effectively improving the accuracy of the model in predicting traffic flow.
[0028] Furthermore, the dynamic masking matrix is used to capture the spatial dependency characteristics of neighboring and distant similar nodes, which is specifically:
[0029] Generate two dynamic masking matrices and , the two dynamic masking matrices and They are used to capture the regional features close to the current node and the features of the distant regions with similarities;
[0030] In time t Based on the hidden spatiotemporal representation, a linear layer is used to obtain the self-attention operation Q matrix, K Matrix and V matrix;
[0031] calculate Q Matrix and KThe dot product of the matrix and the attention score is obtained by scaling A ;
[0032] The attention score A With two dynamic masking matrices and Make the product and get the close attention score and the long-distance attention score one by one;
[0033] The near-distance attention score and the long-distance attention score are converted into corresponding attention weights through the Softmax function;
[0034] The corresponding attention weights are respectively V Matrix multiplication, one-to-one correspondence to obtain the regional features close to the current node and similar long-distance regional features , complete the acquisition of spatial dependency features of neighboring nodes and spatial dependency features of distant similar nodes.
[0035] The beneficial effect of the above further scheme is that by utilizing the combination of the dynamic masking matrix and the attention mechanism, the neighboring spatial dependency characteristics of the current node and the spatial characteristics of distant similar nodes can be captured, thereby improving the model's ability to model spatial dependencies.
[0036] Furthermore, the time-dependent features are extracted by dilating the causal convolutional network, which is specifically:
[0037] Based on the hidden spatiotemporal representation, a dilated causal convolutional network is used to perform dilated causal convolution operations;
[0038] Based on the dilated causal convolution results, we use the gated network to process and get ,in, Represents the spatiotemporal feature representation after being processed by the filter and gating mechanism;
[0039] Will Input to the linear layer and get the self-attention operation matrix, Matrix and matrix;
[0040] calculate Matrix and The dot product of the matrix and the attention score is obtained by scaling ;
[0041] The attention score , converted into attention weights through the Softmax function, and the attention weights are combined with Multiply the matrices to get , complete the extraction of time-dependent features, where Represents the spatiotemporal feature representation after weighted processing by the temporal attention mechanism.
[0042] The beneficial effects of the above further scheme are: by introducing the dilated causal convolutional network, it can better capture the temporal dependency over a long period of time, which helps to accurately model the temporal variation trend of traffic flow. Combining the gating mechanism and the self-attention module can effectively improve the model's ability to process temporal features.
[0043] Furthermore, the S4 is specifically:
[0044] The hidden state is used as input, a skip connection consisting of 1*1 convolution is used, and the traffic flow prediction result is obtained by using two fully connected layers to obtain the prediction dimension.
[0045] The beneficial effect of the above further scheme is that by using 1x1 convolutional skip connections and fully connected layers, multi-dimensional information in the hidden state can be efficiently integrated while reducing the computational burden. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 The present invention is a flow chart of the method.
[0047] Figure 2 Schematic diagram of the traffic flow prediction model structure.
[0048] Figure 3 Schematic diagram of the distance space attention module structure.
[0049] Figure 4 Schematic diagram of the gated temporal convolutional attention module structure. DETAILED DESCRIPTION
[0050] The specific implementation modes of the present invention are described below so that those skilled in the art can understand the present invention. However, it should be clear that the present invention is not limited to the scope of the specific implementation modes. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations utilizing the concept of the present invention are protected.
[0051] Example
[0052] like Figure 1 As shown, the present invention provides a traffic flow prediction method based on spatiotemporal sequence, and its implementation method is as follows:
[0053] S1. Obtain open source network traffic flow data and preprocess it to obtain the traffic flow sequence, which is specifically:
[0054] Get open source network traffic data;
[0055] The acquired open source network traffic flow data is sliced to obtain a traffic flow sequence, where each time slice contains 12 time steps;
[0056] S2. Input the traffic flow sequence into the data embedding layer to obtain a high-dimensional representation of the input features, and perform periodic embedding and adaptive spatiotemporal embedding. Connect the three embeddings to obtain a hidden spatiotemporal representation, which is specifically:
[0057] Input the traffic flow sequence into the data embedding layer to obtain feature embedding ;
[0058] Compute two embeddings covering weekly and daily periodicity respectively , ,in, and Respectively indicate the time t Functions to convert to week index and minute index respectively;
[0059] By connecting all T The embedding of time slices results in the periodic embedding and daily cycle embedding ;
[0060] The learnable adaptive spatiotemporal embedding is represented as ,in, Can be shared among different traffic time series;
[0061] Embedding the Weekly Cycle , daily cycle embedding and adaptive spatiotemporal embedding Connect and get the hidden space-time representation ;
[0062] S3, input the hidden spatiotemporal representation into the spatiotemporal encoder to model the spatial and temporal dependencies and obtain the hidden state;
[0063] The spatiotemporal encoder consists of a range-space attention module, a gated temporal convolutional attention module, and a fusion module.
[0064] In this embodiment, the distance space attention module is used to capture the spatial dependency features of neighboring nodes and the spatial dependency features of distant similar nodes based on the hidden spatiotemporal representation using a dynamic masking matrix, which is specifically:
[0065] Generate two dynamic masking matrices and , the two dynamic masking matrices and They are used to capture the regional features close to the current node and the features of the distant regions with similarities;
[0066] In time t Based on the hidden spatiotemporal representation, a linear layer is used to obtain the self-attention operation Q matrix, K Matrix and V matrix;
[0067] calculate Q Matrix and K The dot product of the matrix and the attention score is obtained by scaling A ;
[0068] The attention score A With two dynamic masking matrices and Make the product and get the close attention score and the long-distance attention score one by one;
[0069] The near-distance attention score and the long-distance attention score are converted into corresponding attention weights through the Softmax function;
[0070] The corresponding attention weights are respectively V Matrix multiplication, one-to-one correspondence to obtain the regional features close to the current node and similar long-distance regional features , complete the acquisition of spatial dependency features of neighboring nodes and spatial dependency features of distant similar nodes;
[0071] In this embodiment, the gated temporal convolutional attention module is used to extract time-dependent features through a dilated causal convolutional network based on hidden spatiotemporal representation, which is specifically:
[0072] Based on the hidden spatiotemporal representation, a dilated causal convolutional network is used to perform dilated causal convolution operations;
[0073] Based on the dilated causal convolution results, we use the gated network to process and get ,in, Represents the spatiotemporal feature representation after being processed by the filter and gating mechanism;
[0074] Will Input to the linear layer and get the self-attention operation matrix, Matrix and matrix;
[0075] calculate Matrix and The dot product of the matrix and the attention score is obtained by scaling ;
[0076] The attention score , converted into attention weights through the Softmax function, and the attention weights are combined with Multiply the matrices to get , complete the extraction of time-dependent features, where Represents the spatiotemporal feature representation after weighted processing by the temporal attention mechanism.
[0077] In this embodiment, the fusion module is used to fuse the spatial dependency features of the neighbors, the spatial dependency features of the distant similar nodes, and the time dependency features to obtain the hidden state;
[0078] S4, input the hidden state to the output layer, and output the traffic flow prediction result, which is specifically:
[0079] The hidden state is used as input, a skip connection consisting of 1*1 convolution is used, and the traffic flow prediction result is obtained by using two fully connected layers to obtain the prediction dimension.
[0080] In this embodiment, for example, California highway sensor data is obtained as a data set for training and testing. The specific preprocessing is as follows: the data is sliced, each time slice contains 12 time steps, i.e., one hour of data, and the data set is divided into a training set and a test set, and the constructed traffic flow prediction model is trained and tested using the training set and the test set.
[0081] In this embodiment, a traffic flow prediction model based on spatiotemporal sequences is constructed, and the traffic flow prediction model structure includes a data embedding layer, a spatiotemporal encoder layer, and an output layer. The data embedding layer generates periodic embeddings by connecting daily and weekly embeddings, obtains feature embeddings by transforming the dimensions of the input data (i.e., the traffic flow sequence), and shares the embedding representation of the multi-dimensional traffic sequence through adaptive embedding; the spatiotemporal encoder layer includes a distance space attention module and a gated time convolution attention module. The distance space attention module uses a dynamic masking matrix to capture the spatial dependency features of neighboring and distant similar nodes, and the gated time convolution module extracts time dependency features through an expanded causal convolutional network; finally, the final prediction result is obtained by adjusting the dimension of the output layer.
[0082] In this embodiment, Figure 2 As shown in Figure 1, from top to bottom, they are the data embedding layer (including feature embedding, daily cycle embedding, weekly cycle embedding, and spatiotemporal adaptive embedding), the spatiotemporal encoder layer, and the output layer. The spatiotemporal encoder layer includes a spatial algorithm model based on the distance attention mechanism (i.e., the distance spatial attention module) and a temporal algorithm model based on the gated temporal convolutional attention mechanism (i.e., the gated temporal convolutional attention module). The distance spatial attention module structure is shown in Figure 1. Figure 3As shown in Figure 1, it mainly consists of two dynamic masking matrix calculation parts, short-distance spatial attention and long-distance spatial attention. The structure of the gated temporal convolutional attention module is shown in Figure 1. Figure 4 As shown in the figure, it is mainly composed of a temporal convolutional network, a gating network, and a temporal attention part. The fusion module fuses the three heads, and then passes through the feedforward network to get the output of one layer. Each spatiotemporal encoder layer is then connected by a skip connection consisting of 1*1 convolutions, and then the output of each skip connection layer is summed to obtain the final hidden state. In the output layer, the fully connected layer is directly used to convert the final hidden state into the required prediction dimension to obtain the traffic flow prediction result. Figure 4 middle, represents the tangent function, represents the Hadamard product, represents the sigmoid function, and Represents a dilated causal convolution operation.
[0083] In this example, the input data (traffic flow sequence) is embedded in a fully connected layer. Secondly, two embeddings are calculated to cover weekly and daily periodicity, expressed as and , and Indicates the time t Convert to week index (1 to 7) and minute index (1 to 288) respectively, and then concatenate all T The embedding of time slices results in the embedding of cycles and daily cycle embedding The learnable spatiotemporal adaptive embedding is represented as , which can be shared among different traffic time series. Finally, the weekly period is embedded in , daily cycle embedding and adaptive spatiotemporal embedding Connect to get hidden spatiotemporal representation , the hidden space-time representation Input to the spatiotemporal encoder layer.
[0084] In this embodiment, Figure 3 As shown in Figure 1, in the distance space attention module (including short-distance space attention and long-distance space attention), first, two dynamic masking matrices are generated to assist in capturing the important features of the current node's close-range area and the features of the similar long-range area. Masking matrix for capturing the important features of the current node's close-range area It is calculated by calculating the distance between each node and the current node (here is the number of hops). When the distance does not exceed the hop count threshold hThe value is 1 when , otherwise it is 0. The masking matrix is used to capture the characteristics of distant regions with similarity. It is calculated by using the weighted dynamic time warping algorithm, first calculating the historical traffic similarity between each node and the current node, and then selecting the one with the highest similarity K The value of each node is 1, and the others are 0. Secondly, the attention submodule, in the time slice t First, the input data (hidden spatiotemporal representation) is passed through a linear layer to obtain the self-attention operation Q matrix, K Matrix and V The matrix is then calculated Q Matrix and K The dot product of the matrix and through ( d represents the dimension of the hidden layer) to obtain the attention score A , and then the attention score A With two dynamic masking matrices and The Hadamard product is performed to obtain the near-distance attention score and the far-distance attention score, and then converted into attention weights through the Softmax function and then combined with V Matrix multiplication obtains the important features of the close-range area and the features of the distant area with similarity (that is, the regional features close to the current node are obtained) and similar long-distance regional features ), and finally the output of the distance space attention module is: ; ,in, represents the Hadamard product.
[0085] In this embodiment, in the gated temporal convolutional attention module, the input data (hidden spatiotemporal representation) is first passed through the dilated causal convolutional network, given the input sequence X and filter f , at time t The calculation formula of the dilated causal convolution at is: ,in, represents the hidden space-time representation, represents the convolution operation, represents the filter, K represents the number of parameters in the filter, k represents the filter index, Represents the expansion factor.
[0086] The result of the convolution passes through a gating network, which consists of a filter and a gate structure: ; ; ,in, It means the nonlinear features obtained by applying the tanh activation function after the convolution operation. It represents the output obtained by applying the sigmoid activation function after the convolution operation. express and The result obtained by Hadamard product.
[0087] Then get Input to the linear layer to obtain the self-attention operation matrix, Matrix and The matrix, then, is calculated Matrix and The dot product of the matrix and through Zoom in to get the attention score , then converted into attention weights through the Softmax function and then After matrix multiplication, the output of the final gated temporal convolutional attention module is .
[0088] In this embodiment, the fusion module connects the outputs of the above three attention modules: .
[0089] In this embodiment, the output layer uses a 1*1 jump connection and uses two fully connected layers to obtain the final prediction dimension. In order to improve the prediction accuracy, a multi-step prediction method (i.e., simultaneously predicting the traffic flow in multiple time steps in the future) is used here to reduce the impact of error accumulation. The final output dimension corresponds to the prediction dimension.
[0090] In summary, the present invention enhances the modeling capability of complex spatiotemporal characteristics of traffic flow by combining step-by-step embedding and multiple modules. First, through periodic embedding, the traffic flow prediction model can flexibly capture the daily and weekly traffic periodic characteristics in the time dimension, and can adaptively construct a more accurate hidden spatiotemporal representation from the data through adaptive spatiotemporal embedding. Secondly, through the distance space attention module, the traffic flow prediction model can effectively capture the spatial dependency characteristics of neighboring nodes and long-distance similar nodes, and realize the fine modeling of different distance dependency features. The introduction of the gated time convolution attention module further enhances the ability of the traffic flow prediction model to capture long-term dependency features, helps to alleviate the gradient explosion problem, and improves computational efficiency and parallelism. Finally, the application of the fusion module ensures the effective integration of the outputs of different attention modules, and adopts a multi-step prediction method to reduce error accumulation, thereby improving prediction accuracy and stability. In summary, the present invention can effectively improve the ability to capture spatiotemporal features and the accuracy of traffic prediction, and enhance the generalization ability of the traffic flow prediction model in complex traffic scenarios.
Claims
1. A traffic flow prediction method based on spatiotemporal series, characterized in that: The following steps are involved: S1. Obtain open source network traffic flow data and perform preprocessing to obtain traffic flow sequence; S2, input the traffic flow sequence into the data embedding layer to obtain a high-dimensional representation of the input features, and perform periodic embedding and adaptive spatiotemporal embedding, and connect the three embeddings to obtain a hidden spatiotemporal representation; S3, input the hidden spatiotemporal representation into the spatiotemporal encoder to model the spatial and temporal dependencies and obtain the hidden state; The space-time encoder comprises: The distance space attention module is used to capture the spatial dependency features of neighboring nodes and distant similar nodes based on the hidden spatiotemporal representation using a dynamic masking matrix; A gated temporal convolutional attention module for extracting temporally dependent features based on hidden spatiotemporal representations via a dilated causal convolutional network; The fusion module is used to fuse the spatial dependency features of the nearest neighbors, the spatial dependency features of the distant similar nodes, and the time dependency features to obtain the hidden state; The dynamic masking matrix is used to capture the spatial dependency characteristics of neighboring and distant similar nodes, which is specifically: Generate two dynamic masking matrices and , the two dynamic masking matrices and They are used to capture the regional features close to the current node and the features of the distant regions with similarities; In time t Based on the hidden spatiotemporal representation, a linear layer is used to obtain the self-attention operation Q matrix, K Matrix and V matrix; calculate Q Matrix and K The dot product of the matrix and the attention score is obtained by scaling A ; The attention score A With two dynamic masking matrices and Make the product and get the close attention score and the long-distance attention score one by one; The near-distance attention score and the long-distance attention score are converted into corresponding attention weights through the Softmax function; The corresponding attention weights are respectively V Matrix multiplication, one-to-one correspondence to obtain the regional features close to the current node and similar long-distance regional features , complete the acquisition of spatial dependency features of neighboring nodes and spatial dependency features of distant similar nodes; The time-dependent features are extracted by dilating the causal convolutional network, which is specifically: Based on the hidden spatiotemporal representation, a dilated causal convolutional network is used to perform dilated causal convolution operations; Based on the dilated causal convolution results, we use the gated network to process and get ,in, Represents the spatiotemporal feature representation after being processed by the filter and gating mechanism; Will Input to the linear layer and get the self-attention operation matrix, Matrix and matrix; calculate Matrix and The dot product of the matrix and the attention score is obtained by scaling ; The attention score , converted into attention weights through the Softmax function, and the attention weights are combined with Multiply the matrices to get , complete the extraction of time-dependent features, where Represents the spatiotemporal feature representation after weighted processing by the temporal attention mechanism; S4. Input the hidden state into the output layer and output the traffic flow prediction result.
2. The traffic flow prediction method based on spatiotemporal sequence according to claim 1 is characterized in that: The S1 is specifically: Get open source network traffic data; The acquired open source network traffic flow data is sliced to obtain a traffic flow sequence, where each time slice contains 12 time steps.
3. The traffic flow prediction method based on spatiotemporal sequence according to claim 1 is characterized in that: The S2 is specifically: Input the traffic flow sequence into the data embedding layer to obtain feature embedding ; Compute two embeddings covering weekly and daily periodicity respectively , ,in, and Respectively indicate the time t Functions to convert to week index and minute index respectively; By connecting all T The embedding of time slices results in the embedding of cycles and daily cycle embedding ; The learnable adaptive spatiotemporal embedding is represented as ,in, Can be shared among different traffic time series; Embedding the Weekly Cycle , daily cycle embedding and adaptive spatiotemporal embedding Connect and get the hidden space-time representation .
4. The traffic flow prediction method based on spatiotemporal sequence according to claim 1 is characterized in that: The S4 is specifically: The hidden state is used as input, a skip connection consisting of 1*1 convolution is used, and the traffic flow prediction result is obtained by using two fully connected layers to obtain the prediction dimension.
Citation Information
Patent Citations
Commodity sales volume fusion prediction model constructed based on AdaBoost algorithm
CN116245563A
Traffic flow prediction method based on time-space diagram attention and computing device
CN116596151A