Dynamic graph convolution long-term traffic flow prediction method based on time perception
By using the time-aware dynamic graph convolutional network model in traffic flow prediction, the problem that the relationship between time information and dynamic graphs is not effectively modeled is solved, the accuracy of long-term traffic flow prediction is improved, and stronger traffic flow prediction is provided. Management Reference.
Patent Information
- Application Number
- CN202410736746.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-10-08
AI Technical Summary
Existing long-term traffic flow prediction methods fail to effectively model the interrelationship between temporal information and dynamic graphs, resulting in a lack of temporal sensitivity and reduced prediction accuracy.
Adopt a time-aware dynamic graph convolutional network model to capture time and space by dividing traffic data into different periodic patterns and leveraging attention-driven dynamic adaptive graph convolutional network and time-aware joint multi-view temporal dependence encoder Dependencies enhance the time awareness of the model.
It improves the accuracy of traffic flow prediction, can capture spatiotemporal characteristics more effectively, and provides more powerful reference data to alleviate traffic congestion.
Smart Images

Figure CN118747951A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of traffic flow prediction, and in particular to a time-aware dynamic graph convolution long-term traffic flow prediction method. Background Art
[0002] In recent years, more and more motor vehicles have been put into use, which has brought great pressure to traffic management. By studying efficient traffic flow prediction algorithms, accurate data references can be provided for traffic managers, thereby supporting them to formulate reasonable traffic control strategies and alleviate traffic congestion. Traffic flow prediction, as one of the basic research fields of intelligent transportation systems, is an indispensable part of intelligent transportation systems. Its prediction results of traffic conditions in the future time interval of sensors provide important data support for intelligent transportation systems. In general, according to the time scale, traffic flow prediction can be divided into two scales: short-term prediction (0 to 60 minutes) and long-term prediction (more than 60 minutes). Among them, long-term prediction can provide a reference for people's travel plans and give more targeted traffic decision-making suggestions for the traffic conditions in a certain area.
[0003] The existing traffic flow prediction work is based on a data-driven approach to predict future traffic flow information. More specifically, it uses historical traffic flow data and some exogenous variables (such as weather, holidays, temperature, etc.) to predict future traffic flow data. In the early days, some classical statistical methods (such as vector autoregression models, etc.) and machine learning (support vector machines, etc.) were used to model time series data. However, with the improvement of hardware computing power and the rise of deep learning technology, some deep neural network models (such as convolutional neural networks, graph neural networks, and long short-term memory networks, etc.) have also been widely used in traffic flow prediction. Among them, the existing long-term traffic flow prediction methods have the following main problems:
[0004] 1) No in-depth modeling of temporal information: Traditional traffic prediction tasks mainly focus on modeling spatial features and temporal dependencies in traffic data, because spatial features reflect the topology of the traffic network, and temporal dependencies reveal the changing trends of traffic patterns. In fact, each temporal dependency (such as traffic flow, traffic speed, etc.) is accompanied by potential temporal information, which records the date and hour, minute, and second information when the temporal dependency is recorded. Temporal information indirectly reveals the similarity of temporal dependencies at different time steps. In recent years, most traffic prediction works have focused on modeling temporal dependencies. However, they ignore or only use simple methods (such as time encoding) to integrate temporal information, and ignoring specific temporal details will lead to a lack of time sensitivity. The lack of detailed date and time information will hinder the model's ability to capture subtle temporal dependency patterns and changes at specific moments. In addition, using simple time encoding methods will simplify the model but sacrifice semantic richness. Simple numerical encoding lacks the semantic understanding of time, such as the difference between weekdays and weekends. Ignoring the importance of temporal information will lead to a decrease in traffic prediction accuracy, especially for challenging tasks such as long-term traffic prediction;
[0005] 2) Failure to consider the interrelationships between dynamic graphs: In the early days, most studies focused on using static spatial dependencies (such as driving distance graphs and connectivity graphs) to model the topological structure of traffic networks. In reality, traffic networks are dynamically changing. However, existing methods ignore the high-dimensional interrelationships between dynamic graphs. If this high-dimensional interrelationship is not taken into account, the model may lose important insights into the extended impact and dynamic dependencies of different time steps, and this neglect will lose the potential global dynamic features, greatly reducing its performance. Summary of the invention
[0006] The purpose of the present invention is to provide a long-term traffic flow prediction method based on time-aware dynamic graph convolution. This method enhances the perception of time information, makes the prediction results more accurate, and can provide a more powerful and accurate reference for the management of traffic decision makers, greatly alleviating traffic congestion.
[0007] In order to achieve the above object, the present invention provides a time-aware dynamic graph convolution long-term traffic flow prediction method, the method comprising:
[0008] The original data set is divided into three periodic modes, namely closeness mode, trend mode and period mode, which correspond to the most recent data and the data of the previous day and the previous week of the corresponding forecast target part respectively; the historical traffic data of the three periodic modes are defined as:
[0009]
[0010] in, and Represents closeness, trend and period modes respectively, t trend and t period Corresponding to the number of time steps for a whole day and a whole week, P and Q represent the time step of the historical sequence and the time step of the predicted target sequence respectively; the static graph G is obtained from the driving distance of the non-Euclidean distance between each sensor of the basic data set;
[0011] A traffic flow model based on a time-aware dynamic graph convolutional network is established, and the processed dynamic graphs of three modes and a static graph are used as the input of the model to train the traffic flow prediction model to obtain the prediction effect of traffic flow information for a long time span in the future;
[0012] The graph embedding algorithm node2vec is used to model the static graph to mine the static spatial feature representation vector of the traffic flow, which is denoted as SE. At the same time, several dynamic spatial feature representation vectors DE are initialized and concatenated with the static spatial feature representation vector SE.
[0013] Determine the input and output variables of the traffic flow prediction model; the input variables include traffic flow data of three periodic modes: closeness, trend and period, and static spatial feature representation vectors; the output variables O st It is the traffic flow prediction value of the corresponding sensor in the future time period output by the final convolutional neural network CNN predictor;
[0014] The traffic flow prediction model TADGCN based on the time-aware dynamic graph convolutional network model includes: an attention-driven dynamic adaptive graph convolutional network ADAGCN and a time-aware joint multi-view time-dependent encoder TJMTE. The TADGCN model is composed of a plurality of ADAGCN and TJMTE modules stacked together, and a layer of convolutional neural network CNN is added after the last TJMTE module; wherein, the dynamic graph and static spatial feature representation vectors of the three modes are used as inputs of the attention-driven dynamic adaptive graph convolutional network ADAGCN, aiming to capture potential spatial dependencies, including dynamic and static spatial features and potential mutual correlations in dynamic spatial dependencies; the time-aware joint multi-view time-dependent encoder TJMTE extracts the temporal correlation of periodic patterns by combining the self-attention mechanism, and also enhances the temporal perception of the model by the time-aware matrix; the output result O is generated by stacking multiple ADAGCN and TJMTE and the last CNN. st .
[0015] Preferably, the attention-driven dynamic adaptive graph convolution network ADAGCN module includes multiple parallel adaptive graph convolution layers AGCN and dynamic multi-graph attention fusion DMAF components, wherein:
[0016] Multiple AGCNs receive the dynamic graph and the concatenation of the dynamic spatial feature representation vectors DE and SE as input, and obtain the output X after calculation processing. gc :
[0017]
[0018] in, and represents the output of the AGCN block, corresponding to the closeness, trend and period modes at time t respectively. The i subscript is the index of the AGCN block, and || represents the splicing operation. The outputs of all time steps of the AGCN block are spliced and input into the dynamic multi-graph attention fusion module to extract the intrinsic correlation in the dynamic spatial dependency. The processing process is:
[0019]
[0020] X gc =[X gc,period ||X gc,trend ||X gc,close ]
[0021] X adagcn =DMAF(X gc ,GE)
[0022] Among them, the splicing result of the parallel AGCN blocks is X gc GE is a feature matrix, which is composed of the stacked feature vectors of all dynamic graph embeddings. adagcn represents the output of the ADAGCN module; the DMAF is used to fuse the dynamic features at the graph level and consists of three core blocks, including the point-to-graph cross attention block N2G-CA, the multi-graph self-attention block MGSA and the graph-to-point cross attention block G2N-CA. The N2G-CA block uses GE to learn the dynamic features at the graph level from the dynamic features at the node level. The MGSA block captures the inter-correlation information of dynamic spatial dependencies from GE. The G2N-CA block is used to integrate the graph-level GE feature matrix that aggregates the inter-correlation information of dynamic spatial dependencies into the node-level input X gc In order to fully extract the spatial dependency information; the processing process of the DMAF module is:
[0023] GE'=FC(GE)
[0024] GE' N =LayerNorm(GE')
[0025]
[0026] Among them, the output of GE under the full connection layer calculation is GE', O N2G-CA , O MGSA and O G2N-CA They are represented as the outputs of N2G-CA block, MSGA block and G2N-CA block respectively, and the output of layer normalization is represented as GE' N , and The feature conversion at the point level and the graph level needs to rely on the N2G-CA block and the G2N-CA block; the MSGA block is used for graph feature fusion.
[0027] Preferably, the time-aware joint multi-view temporal-dependent encoder TJMTE module comprises a time-aware periodic joint attention component TPJA and a feed-forward neural network FFN; wherein,
[0028] The TPJA module uses the temporal information of historical sequences and target sequences to enhance the model's temporal perception through a time-aware matrix, while capturing joint periodic temporal patterns and retaining their intrinsic correlations. FFN introduces nonlinear mapping to enhance the model's expressiveness. Before the data enters the two components, layer normalization operations are added and residual connections are used to accelerate convergence and alleviate gradient vanishing. TPJA combines the attention mechanism with CNN to model long-span temporal correlations.
[0029] Preferably, the working principle of the TJMTE includes:
[0030] First, the fully connected layer maps the temporal information into the latent feature space; then, concatenate X adagcn and T t,X To integrate the time information and get the input of TJMTE, the splicing process is:
[0031] I tjmte =[X adagcn ||FC(T t,X )]
[0032] Will I tjmte , T t,X and T t,Y As input, TJMTE uses a fully connected layer to regularize I before TPJA and FFN processing. tjmte Dimensions;
[0033] The processing process of the TPJA component is:
[0034] I' tjmte =FC(I tjmte )
[0035]
[0036] Among them, the predicted value O generated by the TPJA component tjmte , T t,X and T t,Y The time information T corresponding to the historical observation sequence and the target sequence t , O TPJA represents the output of the TPJA block, The N superscript indicates the normalized output of the layer, O' TPJA Represents the output result after residual connection processing;
[0037] The calculation process of the FFN is:
[0038]
[0039] Among them, X tjmte Indicates the output result of the current TJMTE module calculation. The N superscript represents the normalized output of the layer.
[0040] Preferably, based on the function, the TPJA component is divided into a block PJ and a block TA, wherein the block PJ adopts an attention mechanism to jointly capture the cycle time correlation of each traffic mode, and the block PJ jointly models each traffic mode instead of modeling them separately to capture the inherent mutual correlation of each traffic mode without losing information; a fully connected layer receives the intermediate results of the PJ block to generate a fixed-size output;
[0041] Under the guidance of the time perception matrix, capturing the temporal correlation between the target sequence and the historical observation sequence is achieved through the TA block, and then the current prediction value is output; the integrated spatiotemporal correlation attention matrix and the time perception matrix are obtained through weighted calculation to enhance the model's perception of time;
[0042] The working principle of TPJA is:
[0043] The processing of the PJ block is as follows:
[0044]
[0045] O TPJA =FC(O PJ )
[0046] Among them, the output of the PJ block is O PJ , K PJ The characteristic dimension of is d k,PJ , Q PJ , K PJ and V PJRepresents the query, key, and value matrices in the attention mechanism;
[0047] The processing of the TA block includes:
[0048] Step 1: TA block O TPJA Input into a CNN predictor to generate the initial prediction value of the current TJMTE module The processing process is expressed as:
[0049]
[0050] in, represents the i-th step output of block TA;
[0051] Step 2: TA block reception and as input, and use cross attention to capture the spatiotemporal correlations between them; in this scenario, because It retains more detailed information of the previous layer, so As key and query feature representation instead of O TPJA , the processing process is expressed as:
[0052]
[0053] in, and is a trainable parameter, Q TA , K TA and V TA They are the query, key and value feature matrices in the attention mechanism, d k,TA It's K TA The characteristic dimension of
[0054] Step 3: The TA block uses the time-aware matrix generation algorithm Time-Aware Matrix Generation to generate a time-aware matrix, which is proportionally integrated into the attention matrix to aggregate the features of spatiotemporal correlation and time information. The processing process is expressed as:
[0055]
[0056] Step 4: The TA block uses another CNN predictor with a residual connection to generate the prediction value of the current TJMTE module; each TJMTE module outputs a prediction O tjmte , a hybrid model of shallow TADGCN and deep TADGCN can be obtained to enhance the expressiveness and robustness of the model; the processing process is expressed as:
[0057]
[0058] in, is the predicted value generated by the CNN predictor.
[0059] Preferably, the time perception ability of Transformer is enhanced by designing a time-aware matrix to more effectively mine spatiotemporal correlations;
[0060] Generating a time-aware matrix includes similarity distance calculation and pattern weighting, where
[0061] The similarity distance calculation is used to quantify the similarity coefficient between two time steps by time interval and calculate the time similarity coefficient of two time steps:
[0062]
[0063] Among them, W c and W k are two trainable parameters. △t represents the minimum time interval, and its value is related to the data set. TD(·) represents the calculation equation of the time similarity coefficient between historical data and target sequence. and Represent the hourly information of the corresponding t time step in the target sequence and the historical observation sequence, respectively. and Represent the minute information of the corresponding t time step in the target sequence and the historical observation sequence respectively; W c and W k Used to adaptively adjust the curve shape to better model the temporal similarity coefficient;
[0064] Mode weighting uses different weights to distinguish different traffic modes, and uses different weight coefficients to measure the differences between these traffic modes; among them, the closeness mode has 1 weight parameter, the trend mode has 2 weight parameters, and the period mode has 1 weight parameter. The processing process is:
[0065]
[0066]
[0067] Among them, T t,close , T t,trend and T t,period The time information T corresponding to the closeness, trend and period traffic mode in the historical observation data X t , and Represents the day of the week of the current trend mode and the time step t corresponding to the target sequence. If it is a weekend, it is 0, that is, It means that the time step t corresponding to the trend pattern and the target sequence is on the weekend; and Respectively represent whether the t time step corresponding to the current trend mode and the target sequence is Saturday or Sunday of the week. If it is a weekday, it is 0, that is, represents that the trend pattern and the target sequence correspond to the same time step t on the weekday, W close , W period , and are four trainable parameters, and TMG(·) represents the function of the time-aware matrix generation algorithm.
[0068] According to the above technical scheme, the time-aware dynamic graph convolution long-term traffic flow prediction model proposed in the present invention includes two main modules: an attention-driven dynamic adaptive graph convolution network module, which aims to capture the potential correlations in dynamic spatial dependencies; a time-aware joint multi-view temporal dependency encoder module, which uses a joint self-attention mechanism to extract the temporal correlation of periodic patterns and uses a time-aware matrix to enhance the model's perception of temporal information; finally, the two modules are fused to model spatiotemporal correlation to obtain accurate prediction results, providing a more powerful and accurate reference for the management of traffic decision makers.
[0069] Other features and advantages of the present invention will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present invention but do not constitute a limitation of the present invention. In the accompanying drawings:
[0071] Figure 1 It is an overall flow chart of the time-aware dynamic graph convolution long-term traffic flow prediction method provided by the present invention;
[0072] Figure 2 It is a schematic diagram of the overall framework of the time-aware dynamic graph convolution long-term traffic flow prediction method provided by the present invention;
[0073] Figure 3 It is a schematic diagram of a dynamic multi-graph attention fusion component in a time-aware dynamic graph convolution long-term traffic flow prediction method provided by the present invention;
[0074] Figure 4It is a schematic diagram of the time-aware periodic joint attention component in the time-aware dynamic graph convolution long-term traffic flow prediction method provided by the present invention. DETAILED DESCRIPTION
[0075] The specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the present invention, and is not used to limit the present invention.
[0076] See also Figure 1 The present invention provides a time-aware dynamic graph convolution long-term traffic flow prediction method, comprising:
[0077] S1. Obtain the original data set collected by the sensor and preprocess the original data set to obtain historical traffic flow data and driving distance adjacency matrix of three different cycle modes. The three cycle modes are respectively based on the previous day of the corresponding prediction target part, the previous week as the cycle and the most recent data. The data set includes several records, which cover the data recorded by the sensor within one month. Each record is 5 minutes apart. Its characteristics include: traffic flow, average speed and average occupancy within a time period. Among them,
[0078] S11. Explanation of average occupancy: Occupancy is divided into time occupancy and space occupancy, which is an important indicator to measure the degree of road utilization and also the degree of congestion. Among them, space occupancy refers to the ratio of the total road area occupied by each vehicle in the observed section to the total road area in the region during the observation time; time occupancy refers to the ratio of the cumulative time of passing a certain section of the road during the observation time to the time of that section;
[0079] S12, preprocessing the original data set, including: preprocessing the original data set according to the previous day as a cycle, the previous week as a cycle and the recent historical traffic data as the current cycle, and sorting out three traffic flow time series data of close mode, period mode and trend mode. and
[0080]
[0081] Where R represents the set of real numbers, t trend and t period The length P of the historical observation sequence is set to 24, and the length Q of the predicted target sequence is set to 24, corresponding to the number of time steps for a whole day and a whole week respectively, which means that the historical observation data of the past 2 hours are used to predict the traffic flow information of the next 2 hours.
[0082] The data set is divided into training set, validation set and test set in a ratio of 6:2:2. In order to train and verify the accuracy of the traffic flow prediction model, the latitude and longitude information of each sensor is extracted from the original data set, and the driving distance between them is calculated by mapping it to the road on the map, and the driving distance adjacency matrix D between sensors is constructed. In order to be more in line with objective reality, the driving distance adjacency matrix is an asymmetric matrix.
[0083] S13, determine the input and output variables of the traffic flow prediction model, wherein the input variables include: the previous day as a cycle, the previous week as a cycle and recent historical traffic data, and the driving distance adjacency matrix; the output variables include: the traffic flow in the future time period corresponding to the sensor
[0084] In this embodiment, the goal of the traffic flow prediction method is to build a model that can predict the traffic flow prediction value of each sensor location in the future time step given the three periodic patterns at the current time t.
[0085] S2, attention-driven dynamic adaptive graph convolutional network (ADAGCN) is used to capture the potential spatial dependencies, including dynamic and static spatial features, as well as the potential correlations in dynamic spatial dependencies. The input traffic data of three periodic patterns can be represented as dynamic graphs and The traffic data of the three modes and the driving distance adjacency matrix D are input into multiple parallel adaptive graph convolutional layers.
[0086] In this embodiment, the calculation steps of the model mainly include the following contents:
[0087] S21. For the driving distance adjacency matrix D, the well-known node2vec algorithm is used to capture the static spatial dependency and generate the static spatial feature SE. Its calculation process is briefly expressed as follows:
[0088] SE = node2vec(W S )
[0089] S22. Adaptive graph convolutional network layer (AGCN) is used to adaptively model dynamic spatial features for dynamic graphs. Whether the three periodic patterns are considered as dynamic graph modeling depends on the experimental results. Without loss of generality, one of the special cases is selected here. The closeness mode is involved here. At the same time, the dynamic node embedded feature vector DE and the static spatial feature SE are initialized and spliced as the input AGCN layer. The above calculation process can be summarized as follows:
[0090]
[0091] S23, concatenate the outputs of the AGCN block and input them into the dynamic multi-image attention fusion module (DMAF) to extract the correlations in the dynamic spatial dependencies. The calculation process is as follows:
[0092]
[0093] X gc =[X gc,period ||X gc,trend ||X gc,close ]
[0094] X adagcn =DMAF(X gc ,GE)
[0095] Among them, X gc represents the concatenated output of the parallel AGCN blocks. GE is a feature matrix formed by stacking all dynamic graph embedding feature vectors. X adagcn Represents the output of S1. The detailed working process is as follows Figure 3 As shown, from the input X which contains both time-dependent information and spatial-dependent features gc GE needs to pass through a fully connected layer before input to be combined with X gc Align the feature dimensions to get GE'. After aligning the features, the two input variables are normalized by the layer to get the variable GE'∈R (P+2Q)×1×D and The point-to-graph cross attention component (N2G-CA) receives two variables and uses graph feature embedding feature vectors to realize point-level and graph-level feature conversion. It calculates the attention coefficient of each node feature in the entire graph feature by matrix multiplication with the point-level feature encoding, and then maps this coefficient to the point-level feature encoding matrix to aggregate the graph-level feature representation to perform point-level and graph-level feature conversion. At the same time, residual connection technology needs to be added after processing by this module to improve the performance of the model. The output calculation process can be described as follows: O N2G-CA ∈R (P+2Q)×D Input the initialized graph feature encoding GE' N and point-level feature encoding And do matrix multiplication to learn the attention weight of each node. Map this attention weight to the feature encoding at the point level The above is to obtain the feature representation of the graph after feature conversion. The specific calculation process of N2G(·) is completed using the attention mechanism, which is expressed as follows:
[0096]
[0097] in, and is a trainable parameter, d k,N2G Corresponding to K N2G The characteristic dimension, Q N2G , K N2G and V N2G Represents the query, key, and value matrices in the attention mechanism.
[0098] The output of S24 and N2G is regularized The input is sent to the multi-graph self-attention component (MGSA) for graph feature fusion. The attention coefficient between each dynamic graph in the graph feature encoding is calculated by matrix multiplication to model the intrinsic correlation information in the dynamic spatial dependency. The attention coefficient is then mapped to the graph feature encoding to obtain a graph feature representation that aggregates the intrinsic correlation information. The calculation process is shown as follows:
[0099]
[0100] Encoding graph features Matrix multiplication is performed to learn the attention coefficients between graphs, and then the attention coefficients are mapped to the graph feature encoding to obtain the graph feature representation that aggregates the dynamic spatial dependency intrinsic correlation information. The specific calculation process of MGSA(·) is completed using the attention mechanism, which is expressed as follows:
[0101]
[0102] in, and is a trainable parameter, d k,MGSA Corresponding to K MGSA The characteristic dimension, Q MGSA , K MGSA and V MGSA Represents the query, key and value matrices in the attention mechanism. It should be noted that in all attention mechanism-based components in this invention, a multi-head attention method is used to process feature information from a variety of feature representation subspaces. MGSA After normalization, similar operations to N2G are performed to obtain the output of S2 as follows:
[0103]
[0104] S3, Time-aware Joint Multi-view Temporal Dependency Encoder (TJMTE) extracts the temporal correlation of periodic patterns through a joint attention mechanism, and also enhances the temporal perception of the model through a time-aware matrix. It is used to jointly capture the intrinsic temporal correlation of the three patterns and enhance the temporal perception of the model. It consists of two main functional modules, including the Time-aware Periodic Joint Attention Component (TPJA) and the Feedforward Neural Network (FFN).
[0105] S31, detailed workflow as follows Figure 4 As shown, by concatenating the output X of ADAGCN adagcn and the time information T of the historical input sequence t,X , to integrate the temporal information to get the input of TJMTE. Note that TJMTE uses a fully connected layer to align I tjmte The calculation process can be described as follows:
[0106] I tjmte =[X adagcn ||FC(T t,X )]
[0107] The time-aware periodic joint attention component is designed to capture the temporal correlations from multiple periodic traffic patterns and decode the current target output under time-aware enhancement. Based on the function, the TPJA component can be divided into two parts, which are block PJ and block TA.
[0108] S311, block PJ uses the attention mechanism to jointly capture the cycle time correlation of each traffic mode. It should be noted that the PJ block does not model each traffic mode separately but jointly. This design can capture the internal correlation of each traffic mode without information loss. There is a fully connected layer after block PJ to generate a fixed-size output. The calculation process can be expressed as follows:
[0109]
[0110] O TPJA =FC(O PJ )
[0111] Among them, O PJ represents the output of block PJ, d k,PJ Corresponding to K PJ The characteristic dimension, Q PJ , K PJ and V PJ Represents the query, key, and value matrices in the attention mechanism.
[0112] S312, block TA is designed to capture the temporal correlation between the target sequence and the historical observation sequence under the guidance of the time perception matrix, and then output the current prediction value. It integrates the spatiotemporal correlation attention matrix and the time perception matrix through weighted calculation, thereby enhancing the time perception ability of the model. Block TA TPJA Input into a CNN predictor to generate the initial prediction value of the current TJMTE module The calculation process is as follows:
[0113]
[0114] in, Represents the output of the ith step of block TA. Block TA receives and I' tjmte After fully connected and normalized As input, the spatiotemporal correlation between them is captured by the cross-attention algorithm. Block TA performs a time-aware matrix generation algorithm (TMG) to construct a time-aware matrix. The time-aware matrix is a similarity representation, which is composed of the temporal information similarity coefficients of the historical observation sequence and the target sequence, which can enhance the time perception ability of the Transformer. After it is calculated and generated, it is proportionally integrated into the attention matrix to aggregate the features of spatiotemporal correlation and temporal information. Its calculation process is expressed as follows:
[0115]
[0116] Among them, W st and W ta is a trainable parameter and TMG(·) represents the generation operation of the time-aware matrix.
[0117] S4, block TA uses another CNN predictor with residual connection to generate the prediction value of the current TJMTE module. It should be noted that each TJMTE module outputs a prediction O tjmte , because this can obtain a hybrid model of shallow TADGCN and deep TADGCN, and enhance the expressiveness and robustness of the model. The four-step calculation process of the TA block is expressed as follows:
[0118]
[0119] in, is the prediction value generated by the CNN predictor. CNN is used to aggregate spatiotemporal correlations after stacking L layers of ADAGCN and TJMTE modules, and the prediction value O without time-aware enhancement is output. st The output of the time-aware periodic joint attention component in each TJMTE module is and Ost Add together to get the final predicted value:
[0120]
[0121] In summary, the present invention aims at the problem that various existing dynamic graph technologies used to capture dynamic spatial dependencies ignore the high-dimensional inter-correlation features between dynamic graphs, thereby causing insufficient spatiotemporal dependencies in traffic flow prediction under long time spans. The present invention uses an adaptive graph convolution layer to adaptively model dynamic spatial features, without requiring prior knowledge such as road network structure, geographical and environmental factors, and traffic behavior patterns, and can effectively take into account the intrinsic correlation of dynamic graphs. At the same time, the present invention also designs a dynamic multi-graph attention fusion component, which is based on the attention mechanism to further extract the potential intrinsic correlation information in the dynamic spatial dependency, and is used to fuse the dynamic features at the graph level, and uses the residual connection technology in the field of image recognition to retain more spatiotemporal feature information during the fusion process and reduce the feature loss of the fusion.
[0122] In addition, considering the impact of the periodic pattern of traffic data on the prediction results, the present invention constructs a time-aware joint multi-view time-dependent encoder to capture the temporal correlation from multiple periodic traffic patterns and decode the current target output under time-aware enhancement. For data with three different periodic patterns, the attention mechanism is used to synchronously model the spatiotemporal dynamic correlation of each complex and changeable traffic pattern, which can capture the internal correlation of each traffic pattern without information loss. Through experiments in real data set scenarios, it is proved that the encoder effectively improves the accuracy of traffic flow prediction over a long time span.
[0123] In addition, most existing traffic flow data prediction methods use different models to extract the spatiotemporal information of historical sequences and target sequences, which separates the potential semantics of the two. In order to preserve its integrity, the present invention adds a time-aware matrix to the time-aware joint multi-view time-dependent encoder, uses different weights to distinguish different traffic modes, and effectively quantifies the similarity coefficient between two time steps, thereby guiding the training of the time-aware joint multi-view time-dependent encoder to enhance the model's time perception ability, and also jointly captures periodic time patterns while retaining their internal correlations. It can effectively retain the time information in the data, and these complex time information is extremely important for traffic flow prediction over a long span.
[0124] The preferred embodiments of the present invention are described in detail above in conjunction with the accompanying drawings. However, the present invention is not limited to the specific details in the above embodiments. Within the technical concept of the present invention, a variety of simple modifications can be made to the technical solution of the present invention, and these simple modifications all belong to the protection scope of the present invention.
[0125] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present invention will not further describe various possible combinations.
[0126] In addition, various embodiments of the present invention may be arbitrarily combined, and as long as they do not violate the concept of the present invention, they should also be regarded as the contents disclosed by the present invention.
Claims
1. A time-aware dynamic graph convolution long-term traffic flow prediction method, characterized in that: The method comprises: The original data set is divided into three periodic modes, namely closeness mode, trend mode and period mode, which correspond to the most recent data and the data of the previous day and the previous week of the corresponding forecast target part respectively; the historical traffic data of the three periodic modes are defined as: in, and Represents closeness, trend and period modes respectively, t trend and t period Corresponding to the number of time steps for a whole day and a whole week, P and Q represent the time step of the historical sequence and the time step of the predicted target sequence respectively; the static graph G is obtained from the driving distance of the non-Euclidean distance between each sensor of the basic data set; A traffic flow model based on a time-aware dynamic graph convolutional network is established, and the processed dynamic graphs of three modes and a static graph are used as the input of the model to train the traffic flow prediction model to obtain the prediction effect of traffic flow information for a long time span in the future; The graph embedding algorithm node2vec is used to model the static graph to mine the static spatial feature representation vector of the traffic flow, which is denoted as SE. At the same time, several dynamic spatial feature representation vectors DE are initialized and concatenated with the static spatial feature representation vector SE. Determine the input and output variables of the traffic flow prediction model; the input variables include traffic flow data of three periodic modes: closeness, trend and period, and static spatial feature representation vectors; the output variables O st It is the traffic flow prediction value of the corresponding sensor in the future time period output by the final convolutional neural network CNN predictor; The traffic flow prediction model TADGCN based on the time-aware dynamic graph convolutional network model includes: an attention-driven dynamic adaptive graph convolutional network ADAGCN and a time-aware joint multi-view time-dependent encoder TJMTE. The TADGCN model is composed of a plurality of ADAGCN and TJMTE modules stacked together, and a layer of convolutional neural network CNN is added after the last TJMTE module; wherein, the dynamic graph and static spatial feature representation vectors of the three modes are used as inputs of the attention-driven dynamic adaptive graph convolutional network ADAGCN, aiming to capture potential spatial dependencies, including dynamic and static spatial features and potential mutual correlations in dynamic spatial dependencies; the time-aware joint multi-view time-dependent encoder TJMTE extracts the temporal correlation of periodic patterns by combining the self-attention mechanism, and also enhances the temporal perception of the model by the time-aware matrix; the output result O is generated by stacking multiple ADAGCN and TJMTE and the last CNN. st .
2. The time-aware dynamic graph convolution long-term traffic flow prediction method according to claim 1 is characterized in that: The attention-driven dynamic adaptive graph convolution network ADAGCN module includes multiple parallel adaptive graph convolution layers AGCN and dynamic multi-graph attention fusion DMAF components, wherein: Multiple AGCNs receive the dynamic graph and the concatenation of the dynamic spatial feature representation vectors DE and SE as input, and obtain the output X after calculation processing. gc : in, and represents the output of the AGCN block, corresponding to the closeness, trend and period modes at time t respectively. The i subscript is the index of the AGCN block, and || represents the splicing operation. The outputs of all time steps of the AGCN block are spliced and input into the dynamic multi-graph attention fusion module to extract the intrinsic correlation in the dynamic spatial dependency. The processing process is: X gc =[X gc,period ||X gc,trend ||X gc,close ] X adagcn =DMAF(X gc ,GE) Among them, the splicing result of the parallel AGCN blocks is X gc GE is a feature matrix, which is composed of the stacked feature vectors of all dynamic graph embeddings. adagcn represents the output of the ADAGCN module; the DMAF is used to fuse the dynamic features at the graph level and consists of three core blocks, including the point-to-graph cross attention block N2G-CA, the multi-graph self-attention block MGSA and the graph-to-point cross attention block G2N-CA. The N2G-CA block uses GE to learn the dynamic features at the graph level from the dynamic features at the node level. The MGSA block captures the inter-correlation information of dynamic spatial dependencies from GE. The G2N-CA block is used to integrate the graph-level GE feature matrix that aggregates the inter-correlation information of dynamic spatial dependencies into the node-level input X gc In order to fully extract the spatial dependency information; the processing process of the DMAF module is: GE'=FC(GE) GE' N =LayerNorm(GE') Among them, the output of GE under the full connection layer calculation is GE', O N2G-CA , O MGSA and O G2N-CA They are represented as the outputs of N2G-CA block, MSGA block and G2N-CA block respectively, and the output of layer normalization is represented as GE' N , and The feature conversion at the point level and the graph level needs to rely on the N2G-CA block and the G2N-CA block; the MSGA block is used for graph feature fusion.
3. The time-aware dynamic graph convolution long-term traffic flow prediction method according to claim 2 is characterized in that: The time-aware joint multi-view temporal-dependent encoder TJMTE module includes a time-aware periodic joint attention component TPJA and a feed-forward neural network FFN; wherein, The TPJA module uses the temporal information of historical sequences and target sequences to enhance the model's temporal perception through a time-aware matrix, while capturing joint periodic temporal patterns and retaining their intrinsic correlations. FFN introduces nonlinear mapping to enhance the model's expressiveness. Before the data enters the two components, layer normalization operations are added and residual connections are used to accelerate convergence and alleviate gradient vanishing. TPJA combines the attention mechanism with CNN to model long-span temporal correlations.
4. The time-aware dynamic graph convolution long-term traffic flow prediction method according to claim 3 is characterized in that: The working principle of TJMTE includes: First, the fully connected layer maps the temporal information into the latent feature space; then, concatenate X adagcn and T t,X To integrate the time information and get the input of TJMTE, the splicing process is: I tjmte =[X adagcn ||FC(T t,X )] Will I tjmte 、T t,X and T t,Y As input, TJMTE uses a fully connected layer to regularize I before TPJA and FFN processing. tjmte Dimensions; The processing process of the TPJA component is: I' tjmte =FC(I tjmte ) Among them, the predicted value O generated by the TPJA component tjmte , T t,X and T t,Y The time information T corresponding to the historical observation sequence and the target sequence t , O TPJA represents the output of the TPJA block, The N superscript indicates the normalized output of the layer, O' TPJA Represents the output result after residual connection processing; The calculation process of the FFN is: Among them, X tjmte Indicates the output result of the current TJMTE module calculation. The N superscript represents the normalized output of the layer.
5. The time-aware dynamic graph convolution long-term traffic flow prediction method according to claim 4 is characterized in that: Based on the function, the TPJA components are divided into block PJ and block TA. Block PJ adopts the attention mechanism to jointly capture the cycle time correlation of each traffic mode. In addition, block PJ jointly models each traffic mode instead of modeling them separately to capture the inherent mutual correlation of each traffic mode without losing information. A fully connected layer receives the intermediate results of the PJ block to generate a fixed-size output. Under the guidance of the time perception matrix, capturing the temporal correlation between the target sequence and the historical observation sequence is achieved through the TA block, and then the current prediction value is output; the integrated spatiotemporal correlation attention matrix and the time perception matrix are obtained through weighted calculation to enhance the model's perception of time; The working principle of TPJA is: The processing of the PJ block is as follows: About TPJA =FC(O PJ ) Among them, the output of the PJ block is O PJ , K PJ The characteristic dimension of is d k,PJ , Q PJ , K PJ and V PJ Represents the query, key, and value matrices in the attention mechanism; The processing of the TA block includes: Step 1: TA block O TPJA Input into a CNN predictor to generate the initial prediction value of the current TJMTE module The processing process is expressed as: in, represents the i-th step output of block TA; Step 2: TA block reception and as input, and use cross attention to capture the spatiotemporal correlations between them; in this scenario, because It retains more detailed information of the previous layer, so As key and query feature representation instead of O TPJA , the processing process is expressed as: in, and is a trainable parameter, Q TA , K TA and V TA They are the query, key and value feature matrices in the attention mechanism, d k,TA It's K TA The characteristic dimension of Step 3: The TA block uses the time-aware matrix generation algorithm Time-Aware Matrix Generation to generate a time-aware matrix, which is proportionally integrated into the attention matrix to aggregate the features of spatiotemporal correlation and time information. The processing process is expressed as: Step 4: The TA block uses another CNN predictor with a residual connection to generate the prediction value of the current TJMTE module; each TJMTE module outputs a prediction O tjmte , a hybrid model of shallow TADGCN and deep TADGCN can be obtained to enhance the expressiveness and robustness of the model; the processing process is expressed as: in, is the predicted value generated by the CNN predictor.
6. The time-aware dynamic graph convolution long-term traffic flow prediction method according to claim 1 is characterized in that: Enhance the time perception of Transformer by designing a time-aware matrix to more effectively mine spatiotemporal correlations; Generating a time-aware matrix includes similarity distance calculation and pattern weighting, where The similarity distance calculation is used to quantify the similarity coefficient between two time steps by time interval and calculate the time similarity coefficient of two time steps: Among them, W c and W k are two trainable parameters. △t represents the minimum time interval, and its value is related to the data set. TD(·) represents the calculation equation of the time similarity coefficient between historical data and target sequence. and Represent the hourly information of the corresponding t time step in the target sequence and the historical observation sequence, respectively. and Represent the minute information of the corresponding t time step in the target sequence and the historical observation sequence respectively; W c and W k Used to adaptively adjust the curve shape to better model the temporal similarity coefficient; Mode weighting uses different weights to distinguish different traffic modes, and uses different weight coefficients to measure the differences between these traffic modes; among them, the closeness mode has 1 weight parameter, the trend mode has 2 weight parameters, and the period mode has 1 weight parameter. The processing process is: Among them, T t,close 、T t,trend and T t,period The time information T corresponding to the closeness, trend and period traffic mode in the historical observation data X t , and Represents the day of the week of the current trend mode and the time step t corresponding to the target sequence. If it is a weekend, it is 0, that is, It means that the time step t corresponding to the trend pattern and the target sequence is on the weekend; and Respectively represent whether the t time step corresponding to the current trend mode and the target sequence is Saturday or Sunday of the week. If it is a weekday, it is 0, that is, represents that the trend pattern and the target sequence correspond to the same time step t on the weekday, W close , W period , and are four trainable parameters, and TMG(·) represents the function of the time-aware matrix generation algorithm.
Citation Information
Cited By
Multi-sensor edge system and method based on cross-modal dynamic attention
CN119292799A
Business process remaining time prediction method and system based on hybrid architecture
CN121390484A
