A spatiotemporal traffic flow prediction method based on hidden spatiotemporal feature mining
By using a method based on hidden spatio-temporal feature mining, the self-attention function and the Transformer mechanism are used to capture the spatial and spatio-temporal features of the traffic situation, and generate a multi-traffic situation frame matrix, which solves the traffic situation capture problems and data privacy security issues in the existing technology. Improved accuracy of traffic flow prediction.
Patent Information
- Application Number
- CN202311602798.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-28
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2043-11-28
AI Technical Summary
Existing technologies are difficult to capture traffic situations at a fine-grained level and deal with issues such as uneven traffic task complexity and data privacy security. In particular, there are deficiencies in spatiotemporal correlation mining.
Using a method based on hidden spatio-temporal feature mining, road intersections are used as road network nodes to construct a traffic situation embedding matrix. The self-attention function and the Transformer multi-head self-attention mechanism are used to capture the spatial and spatio-temporal characteristics of the traffic situation, and generate a multi-traffic situation frame matrix. , combine linear transformation and nonlinear activation function for prediction.
It effectively solves the problem of uneven complexity of prediction tasks, improves the accuracy of traffic flow prediction, captures dynamic spatio-temporal correlation while ensuring data privacy and security, and improves the accuracy of prediction results.
Smart Images

Figure CN117496715B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of intelligent transportation, and in particular relates to a spatiotemporal traffic flow prediction method based on hidden spatiotemporal feature mining. Background Art
[0002] There is no relevant research on the problem of fine-grained traffic situation pixelization in the field of traffic flow prediction. The research on fine-grained pixelization mainly focuses on the field of user interest mining. The IF4REC model designed in the literature Interest HD: An Interest Frame Model for Recommendation Based on HD Image Generation uses a multi-head attention mechanism to generate high-definition interest portraits. The literature Interaction-Enhanced and Time-Aware Graph Convolutional Network for Successive Point-of-Interest Recommendation in Traveling Enterprises proposes an improved graph convolutional network that can learn dynamic representations of users and POIs. The literature A multi-agent based model for user interest mining on Sina Weibo proposes an adaptive model for user interest mining based on a multi-agent system. The literature Learning Dynamic User Interest Sequence in Knowledge Graphs for Click-Through Rate Prediction proposes a multi-granular dynamic interest sequence learning method based on knowledge-enhanced path mining and interest fluctuation signal discovery. At present, the above research mainly focuses on the fields of social network analysis and e-commerce recommendation. Due to the uneven distribution of traffic data, there are differences in the granularity of traffic situation. It is difficult to capture traffic conditions at the pixel level, which requires further research.
[0003] The paper uses multi-traffic situation frame to solve the problem of uneven traffic task complexity. The paper Short-Term Traffic Flow Forecasting Method With MB-LSTM Hybrid Network builds an online self-learning network to learn and balance the statistical distribution of traffic flow, so as to reduce the impact of distribution imbalance and overfitting problems in the network learning process. The paper Meta-Wrapper: Differentiable Wrapping Operator for User Interest Selection in CTR Prediction regards user interest modeling as user interest selection, and uses differentiable modules as wrapping operators to solve the optimization problem. The paper Bidirectional Spatial-Temporal Adaptive Transformer for Urban Traffic Flow Forecasting proposes a bidirectional spatiotemporal adaptive Transformer to dynamically process traffic flow according to task complexity. According to the above research, the current problem of uneven distribution of complex traffic tasks is mainly solved by temporal and spatial dependencies; interest frames are mainly used to solve the problem of uneven distribution of user interests. Therefore, how to use the method of multi-traffic situation frame to deal with the problem of uneven task complexity still needs further research.
[0004] Focusing on the problem of traffic privacy data leakage and dynamic spatiotemporal correlation. The paper Short-Term Traffic Flow Prediction Based on Graph Convolutional Networks and Federated Learning proposed a traffic flow prediction model based on community detection federated learning and graph convolutional network (FCGCN), which reduces the time cost of global GCN, the high communication cost and mitigates data privacy risks; the paper FedSTN: Graph Representation Driven Federated Learning for Edge Computing Enabled Urban Traffic Flow Prediction proposed a spatiotemporal long-term network (FedSTN) based on federated learning, which captures long-term spatiotemporal information while sharing hidden spatiotemporal hidden information. The paper Spatio-Temporal AutoEncoder for Traffic Flow Prediction proposed a traffic flow prediction method based on autoencoder, which is used to learn fixed spatial distribution, topological correlation and temporal periodicity from traffic flow data; the paper Modeling Dynamic Traffic Flow as Visibility Graphs: A Network-Scale Prediction Framework for Lane-Level Traffic Flow Based on LPR Data proposed a deep learning framework that transforms the time-dependent learning task into mining spatial correlation on a temporal complex network.
[0005] The above studies have made outstanding contributions in capturing the spatiotemporal characteristics of road networks or data privacy and security issues. However, how to effectively mine the dynamic spatiotemporal correlations implied in traffic data while ensuring data privacy and security still needs further research. Summary of the invention
[0006] In order to solve the above technical problems, the present invention proposes a spatiotemporal traffic flow prediction method based on hidden spatiotemporal feature mining, comprising the following steps:
[0007] S1: Take the road intersection as the road network node, construct data containing N nodes and M features through the historical time series length of the node, and obtain the historical traffic data D of the road network node 0 , the historical traffic data D 0 Transformed into traffic situation embedding matrix E through embedding operation;
[0008] S2: Merge the granularity information Trans with the traffic situation embedding matrix E to obtain the traffic situation pixel matrix TSPE;
[0009] S3: The traffic situation embedding matrix E is weighted and summed through the self-attention function to obtain the traffic situation vector a representing the correlation of the traffic situation, and the tensor representation v of the traffic situation image is generated according to the traffic situation vector a u ;
[0010] S4: The traffic situation vector a and the traffic situation picture tensor representation v u Converted into a multi-traffic situation frame vector A, and converted into a multi-traffic situation frame matrix MT according to the traffic situation pixel matrix TSPE;
[0011] S5: Capture the hidden spatial features in the road network through MTS-GAT, concatenate the captured spatial features and perform dimension transformation operations to obtain the road network spatial features Y 2 ;
[0012] S6: Mark the time position of historical traffic data through linear transformation to obtain the time position coding matrix D 1 , the road network spatial feature Y 2 Embed the traffic situation frame matrix MT to obtain the spatial position information matrix D 2 , the time position encoding matrix D 1 and spatial position information matrix D 2 After splicing, it is embedded into the traffic situation matrix MT through the linear layer to obtain the node flow matrix Y e ;
[0013] S7: Based on the long-term dependencies and dynamic spatiotemporal changes hidden in traffic data and road networks, the Transformer multi-head self-attention mechanism is used to extract the node flow matrix Y e The dynamic spatiotemporal relationship of the , and the extracted features are spliced to obtain the spatiotemporal dependency information;
[0014] S8: The spatiotemporal dependency information is obtained through a nonlinearly activated feedforward neural network, and the predicted future traffic flow matrix Y is obtained through a two-layer linear mapping and ReLU activation function of the feedforward neural network.
[0015] Beneficial effects of the present invention:
[0016] The present invention mines atomic-level traffic situations from multiple dimensions such as time, space, and traffic semantics, and maps the traffic situation weights of multiple adjacent road sections to fill multiple traffic situation pixel clusters, and maps the traffic situation picture according to each traffic situation pixel cluster, effectively solving the problem of uneven complexity of prediction tasks;
[0017] The present invention aims at the leakage of traffic privacy data and dynamic spatiotemporal correlation, takes into account the non-uniform bidirectional propagation characteristics of traffic flow, captures the hidden spatiotemporal dependencies in traffic data, and introduces the Transformer multi-head attention mechanism to effectively capture the dynamic changing relationship between long-term dependencies and multi-dimensional features, thereby effectively improving the prediction accuracy of traffic flow. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 The present invention is a flow chart of a method for predicting spatiotemporal traffic flow based on mining hidden spatiotemporal features. DETAILED DESCRIPTION
[0019] 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.
[0020] A spatiotemporal traffic flow prediction method based on hidden spatiotemporal feature mining, such as Figure 1 As shown, including:
[0021] S1: Take the road intersection as the road network node, construct data containing N nodes and M features through the historical time series length of the node, and obtain the historical traffic data D of the road network node 0 , the historical traffic data D 0 Transformed into traffic situation embedding matrix E through embedding operation;
[0022] S2: Merge the granularity information Trans with the traffic situation embedding matrix E to obtain the traffic situation pixel matrix TSPE;
[0023] S3: The traffic situation embedding matrix E is weighted and summed through the self-attention function to obtain the traffic situation vector a representing the correlation of the traffic situation, and the tensor representation v of the traffic situation image is generated according to the traffic situation vector a u ;
[0024] S4: The traffic situation vector a and the traffic situation picture tensor representation v u Converted into a multi-traffic situation frame vector A, and converted into a multi-traffic situation frame matrix MT according to the traffic situation pixel matrix TSPE;
[0025] S5: Capture the hidden spatial features in the road network through MTS-GAT, concatenate the captured spatial features and perform dimension transformation operations to obtain the road network spatial features Y 2 ;
[0026] S6: Mark the time position of historical traffic data through linear transformation to obtain the time position coding matrix D 1 , the road network spatial feature Y 2 Embed the traffic situation frame matrix MT to obtain the spatial position information matrix D 2 , the time position encoding matrix D 1 and spatial position information matrix D 2 After splicing, it is embedded into the traffic situation matrix MT through the linear layer to obtain the node flow matrix Y e ;
[0027] S7: Based on the long-term dependencies and dynamic spatiotemporal changes hidden in traffic data and road networks, the Transformer multi-head self-attention mechanism is used to extract the node flow matrix Y e The dynamic spatiotemporal relationship of the , and the extracted features are spliced to obtain the spatiotemporal dependency information;
[0028] S8: The spatiotemporal dependency information is obtained through a nonlinearly activated feedforward neural network, and the predicted future traffic flow matrix Y is obtained through a two-layer linear mapping and ReLU activation function of the feedforward neural network.
[0029] In the embodiment of the present invention, the problem of inconsistent granularity caused by the heterogeneity of traffic data is solved. Inspired by the position coding technology, it is believed that this problem is determined by two factors: the time factor and the density relationship of the roads in the time period. The denser the traffic flow in the time period, the finer the granularity contained in the road section, and the higher the weight in extracting the traffic situation picture. At the same time, if the traffic situation in a certain time period lasts for a long time, that is, the time interval is short, it will be considered that the data in this time period is more stable and more representative, and will be given a higher weight when extracting the traffic situation picture.
[0030] The historical traffic data D 0 Transformed into traffic situation embedding matrix E, including:
[0031] E=Embedding(D 0 )
[0032] Where E represents the embedding matrix, D 0 Represents historical traffic data, and Embedding represents the embedding operation.
[0033] In the embodiment of the present invention, the granularity information Trans is integrated with the traffic situation embedding matrix E to obtain the traffic situation pixel matrix TSPE, including:
[0034]
[0035] Among them, TSPE represents the traffic situation pixel matrix, EN Represents the Nth element in the traffic situation embedding matrix E, Trans N Indicates the traffic data granularity information of the Nth node.
[0036] In an embodiment of the present invention, the traffic situation mining of the time and space dimensions of the traffic data is performed, and the granular information is integrated to analyze the traffic situation, so as to achieve pixel-level traffic situation capture. However, even if TSPE mines the traffic situation from multiple dimensions, the introduction of multidimensional features often leads to learning bias in the model during the model learning process, that is, it tends to predict categories with a larger number. Therefore, the problem of uneven distribution of the complexity of the prediction task still needs to be overcome. Therefore, the present invention proposes a TP2TS method that improves the self-attention mechanism and uses the attention function to calculate the traffic situation weights of several adjacent road sections, thereby filling multiple traffic situation pixel clusters, and mapping out the traffic situation picture based on each traffic situation pixel cluster, to solve the problem of uneven complexity of the prediction task.
[0037] In order to capture the dependencies between various traffic situations, the self-attention function is introduced to perform weighted summation on the traffic situation embedding matrix E to obtain the traffic situation vector a representing the correlation of traffic situations, and the tensor representation v of the traffic situation picture is generated according to the traffic situation vector a. u ,include:
[0038] Traffic situation vector a:
[0039]
[0040] The tensor representation of the traffic situation picture v u :
[0041] v u =TSPE*a
[0042] Where a represents the traffic situation vector, W1 and W2 represent the first and second training parameter matrices respectively, E represents the traffic situation embedding matrix, T represents the matrix transpose, and v u The tensor representation of the traffic situation picture, TSPE represents the traffic situation pixel matrix.
[0043] In this way, it is possible to model the relationship between each input traffic situation and weight its importance, so as to achieve global attention, that is, not only pay attention to the local situation or adjacent traffic situation information, but also pay attention to the traffic conditions at different locations at the same time, including traffic flow and congestion level.
[0044] In the embodiment of the present invention, in order to represent multiple traffic situation frames, the traffic situation frame vector a∈R N Transformed into a multi-traffic situation frame matrix A∈R d*K, the traffic situation vector a and the traffic situation picture tensor v u Transformed into a multi-traffic situation frame vector A, including:
[0045] S41: Determine each traffic situation frame v u The dimension d and the number of frames K;
[0046] S42: Create an empty multi-traffic situation frame vector A, the size of which is d*K, and initially, all elements are set to 0;
[0047] S43: Fill the elements in the traffic situation frame vector a into the multi-traffic situation frame vector A one by one to obtain a complete multi-traffic situation frame vector A.
[0048] In the embodiment of the present invention, the multi-traffic situation frame vector A is converted into the multi-traffic situation frame matrix MT according to the traffic situation pixel matrix TSPE, including:
[0049] MT=TSPE*A
[0050] Among them, MT represents the multi-traffic situation frame matrix, TSPE represents the traffic situation pixel matrix, A represents the multi-traffic situation frame vector, and * represents the multiplication operation.
[0051] In the embodiment of the present invention, the complexity of the road topology makes the traffic flow have non-uniform bidirectional propagation characteristics, which leads to the non-uniform traffic flow density at different locations. Therefore, obtaining complex spatial features is an indispensable condition in the traffic flow prediction task.
[0052] The hidden spatial features in the road network are captured by MTS-GAT, and the captured spatial features are spliced and dimensionally transformed to obtain the road network spatial features Y 2 ,include:
[0053] S51: Based on the traffic situation vector set of road nodes The traffic situation vector of adjacent road nodes in the calculation of the attention coefficient between nodes: in, represents the traffic situation vector of the Nth road node, represents the traffic situation vector of the i-th road node, represents the traffic situation vector of the jth road node, K i represents the adjacent node set of the i-th road node, and k represents the adjacent node set K i The index of each node in represents the weight vector determined by the attention mechanism through the weight, T represents the matrix transpose, W represents the linear transformation parameter matrix, Represents the traffic status data of the kth time slice of the road node, R F represents an F-dimensional real vector space;
[0054] S52: According to the attention coefficient α between adjacent nodes ij Perform two-order domain aggregation of nodes (input feature vector h, calculate attention weight αij according to the connection relationship information in G, then weight the node features according to the attention weight, and then perform nonlinear transformation on the weighted node features through the activation function σ), and obtain the MTS-GAT network: Among them, h represents the input node feature vector, G represents the connection relationship and spatial topological structure between nodes;
[0055] S53: Extracting spatial information hidden in traffic situations through MTS-GAT network And perform dimension transformation to obtain the spatial characteristics of the road network
[0056] The neighborhood aggregation includes:
[0057]
[0058] in, Represents the traffic situation vector of the Nth road node after domain aggregation, represents the traffic situation vector of the i-th road node after domain aggregation, and W represents the linear transformation parameter matrix.
[0059] In the embodiment of the present invention, the linear transformation of sin and cos is used to mark the time position of the data. First, the position pos is encoded as a length d model Then, we calculate a vector of length M, which is equal to the number of input time slices. model dimensional vector and perform linear transformation, and perform tiling operation along the spatial axis. Finally, the time position coding matrix D is obtained 1 ∈R M×N .
[0060] The time position coding matrix D is obtained by marking the time position of historical traffic data through linear transformation. 1 ,include:
[0061]
[0062] Among them, PE (pos,i) Denotes the time position encoding matrix D 1 The time position pos of the i-th historical traffic data in d modelis the length of the encoding vector, i is even means that the i-th historical traffic data is an even number, and i is odd means that the i-th historical traffic data is an odd number.
[0063] In the embodiment of the present invention, the road network spatial feature Y 2 Embed the traffic situation frame matrix MT to obtain the spatial position information matrix D 2 ,include:
[0064] D 2 =Embedding(Y 2 +MT)
[0065] Among them, D 2 Represents the spatial position information matrix, Y 2 represents the spatial characteristics of the road network, MT represents the traffic situation frame matrix, and Embedding represents the embedding operation.
[0066] In the embodiment of the present invention, further, complex traffic situations often have obvious time periodicity, such as congestion during peak hours in the morning and evening, increased travel flow during holidays, etc. Making full use of time characteristics can help the model better understand the periodic changes in traffic flow, thereby improving the accuracy of traffic flow prediction. The present invention uses the Transformer module to capture time-related traffic situations. The process of capturing time periodicity includes:
[0067] Transformer can capture the spatiotemporal dependency information in the traffic flow feature matrix. Its core is to obtain the long-term dependency between individual nodes through the dot product between the query key and the index key through the self-attention mechanism. At the same time, the index vector obtained by mapping the input feature is divided The root value of the dimension Prevent the calculation result from being too large, and ensure that the attention distribution during the back propagation process is more even, rather than concentrated on a certain situation. Finally, the result is normalized into a probability distribution using the softmax function, and then multiplied by the input feature to map the value vector The attention weight representation score of each situation can be obtained, which is used to evaluate the weighted importance of situation features. After multiple iterative operations, the relative importance of each traffic situation in different time periods and important traffic parameters such as the corresponding average time length are finally determined. The attention calculation formula is as follows:
[0068]
[0069] in, The query vector, index vector and value vector are mapped to the input features of all nodes respectively. iTake it as an example and linearly map it into query vector, index vector and value vector:
[0070]
[0071] in, are the projection matrices of the Q, K, and V vectors to be learned.
[0072] Aiming at the long-term dependencies and dynamic spatiotemporal changes hidden in traffic data and road networks, the Transformer multi-head self-attention mechanism is used to extract the node flow matrix Y e The dynamic spatiotemporal relationship features of the network are extracted, and the extracted features are spliced to obtain spatiotemporal dependency information, including:
[0073] Use Transformer multi-head self-attention mechanism to extract node traffic matrix Y in parallel e Dynamic spatiotemporal relationship characteristics:
[0074]
[0075] The extracted dynamic spatiotemporal relationship features are spliced to obtain spatiotemporal dependency information:
[0076]
[0077] Among them, head h represents the hth attention head of the Transformer multi-head self-attention mechanism, express, and denotes the weight matrices of query, key, and value for each attention head, d k represents the dimensions of the query and key, represents the spatiotemporal dependency information obtained by performing multi-head self-attention operations, W o Represents the weight matrix used to linearly transform the concatenated feature vector.
[0078] In the embodiment of the present invention, the spatiotemporal dependency information is used to obtain the predicted future traffic flow matrix Y through a nonlinearly activated feedforward neural network, including:
[0079] The residual connection is used to directly transfer the input spatiotemporal dependency information to the output of the feedforward neural network, and the input spatiotemporal dependency information is added to the output of the feedforward neural network through the skip connection to retain the original input information. The residual connection is expressed as:
[0080] Residual Connection=Add(Sublayer(X),X)
[0081] Where X represents input, Sublayer represents the computational operation of the sublayer, that is, a feedforward neural network, and Add represents a residual connection;
[0082] The output of the sub-layer is normalized, and the layer normalization is expressed as:
[0083] Layer Normalization=LayerNorm(Add(result,X))
[0084] Where X represents input, Add represents residual connection, and result represents the output of the sub-layer;
[0085] The output is the predicted future traffic flow matrix Y.
[0086] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A spatiotemporal traffic flow prediction method based on hidden spatiotemporal feature mining, characterized in that: include: S1: Take the road intersection as the road network node, construct data containing N nodes and M features through the historical time series length of the node, and obtain the historical traffic data D of the road network node 0 , the historical traffic data D 0 Transformed into traffic situation embedding matrix E through embedding operation; S2: Merge the granularity information Trans with the traffic situation embedding matrix E to obtain the traffic situation pixel matrix TSPE; The granularity information Trans is integrated with the traffic situation embedding matrix E to obtain the traffic situation pixel matrix TSPE, which includes: Among them, TSPE represents the traffic situation pixel matrix, E N Represents the Nth element in the traffic situation embedding matrix E, Trans N Indicates the traffic data granularity information of the Nth node; S3: The traffic situation embedding matrix E is weighted and summed through the self-attention function to obtain the traffic situation vector a representing the correlation of the traffic situation, and the tensor representation v of the traffic situation image is generated according to the traffic situation vector a u ; The traffic situation embedding matrix E is weighted and summed through the self-attention function to obtain the traffic situation vector a representing the correlation of the traffic situation, and the tensor representation v of the traffic situation image is generated according to the traffic situation vector a u ,include: Traffic situation vector a: The tensor representation of the traffic situation picture v u : v u =TSPE*a Where a represents the traffic situation vector, W1 and W2 represent the first and second training parameter matrices respectively, E represents the traffic situation embedding matrix, T represents the matrix transpose, and v u A tensor representation of the traffic situation picture; S4: The traffic situation vector a and the traffic situation picture tensor representation v u Converted into a multi-traffic situation frame vector A, and converted into a multi-traffic situation frame matrix MT according to the traffic situation pixel matrix TSPE; The traffic situation vector a and the traffic situation picture tensor v u Transformed into a multi-traffic situation frame vector A, including: S41: Determine each traffic situation frame v u The dimension d and the number of frames K; S42: Create an empty multi-traffic situation frame vector with a size of d*K. Initially, all elements are set to 0. S43: filling the elements in the traffic situation frame vector a into the empty multi-traffic situation frame vector one by one to obtain a complete multi-traffic situation frame vector A; According to the traffic situation pixel matrix TSPE, the multi-traffic situation frame vector A is converted into a multi-traffic situation frame matrix MT, including: MT=TSPE*A Among them, MT represents the multi-traffic situation frame matrix, and * represents multiplication operation; S5: Capture the hidden spatial features in the road network through MTS-GAT, concatenate the captured spatial features and perform dimension transformation operations to obtain the road network spatial features Y 2 ; The hidden spatial features in the road network are captured by MTS-GAT, and the captured spatial features are spliced and dimensionally transformed to obtain the road network spatial features Y 2 ,include: S51: Based on the traffic situation vector set of road nodes The traffic situation vector of adjacent road nodes in the calculation of the attention coefficient between nodes: in, represents the traffic situation vector of the Nth road node, represents the traffic situation vector of the i-th road node, represents the traffic situation vector of the jth road node, K i represents the adjacent node set of the i-th road node, and k represents the adjacent node set K i The index of each node in represents the weight vector determined by the attention mechanism through the weight, W represents the linear transformation parameter matrix, Represents the traffic status data of the kth time slice of the road node, R F represents an F-dimensional real vector space; S52: According to the attention coefficient α between adjacent nodes ij Perform two-order domain aggregation of nodes to obtain the MTS-GAT network: Among them, h represents the input node feature vector, G represents the connection relationship and spatial topological structure between nodes, and σ represents the activation function; S53: Extracting spatial information hidden in traffic situations through MTS-GAT network And perform dimension transformation to obtain the spatial characteristics of the road network S6: Mark the time position of historical traffic data through linear transformation to obtain the time position coding matrix D 1 , the road network spatial feature Y 2 Embed the traffic situation frame matrix MT to obtain the spatial position information matrix D 2 , the time position encoding matrix D 1 and spatial position information matrix D 2 After splicing, it is embedded into the traffic situation matrix MT through the linear layer to obtain the node flow matrix Y e ; S7: Based on the long-term dependencies and dynamic spatiotemporal changes hidden in traffic data and road networks, the Transformer multi-head self-attention mechanism is used to extract the node flow matrix Y e The dynamic spatiotemporal relationship of the , and the extracted features are spliced to obtain the spatiotemporal dependency information; S8: The spatiotemporal dependency information is obtained through a nonlinearly activated feedforward neural network, and the predicted future traffic flow matrix Y is obtained through a two-layer linear mapping and ReLU activation function of the feedforward neural network.
2. The method for predicting spatiotemporal traffic flow based on hidden spatiotemporal feature mining according to claim 1 is characterized in that: The historical traffic data D 0 Transformed into traffic situation embedding matrix E, including: E=Embedding(D 0 ) Where E represents the embedding matrix, D 0 Represents historical traffic data, and Embedding represents the embedding operation.
3. The method for predicting spatiotemporal traffic flow based on hidden spatiotemporal feature mining according to claim 1 is characterized in that: The time position coding matrix D is obtained by marking the time position of historical traffic data through linear transformation. 1 ,include: Among them, PE (pos,i) Denotes the time position encoding matrix D 1 The time position pos of the i-th historical traffic data in d model is the length of the encoding vector, i is even means that the i-th historical traffic data is an even number, and i is odd means that the i-th historical traffic data is an odd number.
4. The method for predicting spatiotemporal traffic flow based on hidden spatiotemporal feature mining according to claim 1 is characterized in that: The road network spatial feature Y 2 Embed the traffic situation frame matrix MT to obtain the spatial position information matrix D 2 ,include: D 2 =Embedding(Y 2 +MT) Among them, D 2 Represents the spatial position information matrix, Y 2 represents the spatial characteristics of the road network, MT represents the traffic situation frame matrix, and Embedding represents the embedding operation.
5. The method for predicting spatiotemporal traffic flow based on hidden spatiotemporal feature mining according to claim 1, characterized in that: Aiming at the long-term dependencies and dynamic spatiotemporal changes hidden in traffic data and road networks, the Transformer multi-head self-attention mechanism is used to extract the node flow matrix Y e The dynamic spatiotemporal relationship features of the network are extracted, and the extracted features are spliced to obtain spatiotemporal dependency information, including: Use Transformer multi-head self-attention mechanism to extract node traffic matrix Y in parallel e Dynamic spatiotemporal relationship characteristics: The extracted dynamic spatiotemporal relationship features are spliced to obtain spatiotemporal dependency information: Among them, head h represents the hth attention head of the Transformer multi-head self-attention mechanism, Represents the road network node e i The traffic matrix, and denotes the weight matrices of query, key, and value for each attention head, d k represents the dimensions of the query and key, represents the spatiotemporal dependency information obtained by performing multi-head self-attention operations, W o Represents the weight matrix used to linearly transform the concatenated feature vector.
