Construction method of traffic flow prediction model and traffic flow prediction method
By constructing a framework that contains map network generation layers, graphic convolution modules, and multi -scale time convolutional modules, the existing traffic flow prediction method has insufficient accuracy in dealing with the complexity of traffic networks and abnormal events, and realized it more. Accurate traffic flow forecast.
Patent Information
- Application Number
- CN202411382722.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-09-30
AI Technical Summary
When existing traffic flow prediction methods deal with complex relationships and abnormal events in the traffic network, the prediction accuracy is low and cannot effectively reflect the spatial dependence of the traffic network.
Adopt a framework consisting of a network -generated layer, diagram convolutional module, and multi -scale timely convolutional module, to generate a dynamic adjacent matrix by adaptive dynamic dynamic diagram generator and heterogeneous adjacent relationship. Space information in features.
It improves the accuracy of traffic flow forecasting, and can better capture the complex relationship between time changes between nodes in the traffic network, and overcomes the lack of traditional methods in prediction accuracy and space dependence.
Smart Images

Figure CN118886801B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of intelligent transportation system (ITS), and in particular relates to a method for constructing a traffic flow prediction model and a traffic flow prediction method. Background Art
[0002] Driven by the modern intelligent era, cities are gradually transforming into smart cities. The accelerated urbanization process and the sharp increase in floating population have brought tremendous pressure to the urban road traffic network. Intelligent transportation systems provide new ideas for solving these urbanization problems. Intelligent transportation systems can improve the operating efficiency of urban transportation, reduce traffic congestion, and optimize traffic design, management and safety.
[0003] Traffic flow prediction is a core component of intelligent transportation systems. Accurate traffic flow prediction helps route planning, vehicle scheduling, reducing congestion, improving traffic safety, and even providing support for autonomous driving technology. As a result, traffic network flow prediction has become an important research hotspot in the field of intelligent transportation.
[0004] Traffic flow prediction is mainly affected by factors such as road network structure and time cycle changes. The historical average (HA) method is an early traffic flow prediction method, which takes the average value of historical traffic flow as the prediction value. Since traffic flow changes dynamically over time, HA is not suitable for dynamically changing time series data. The Kalman filter model automatically updates the weights to maintain the optimal filter to improve the prediction accuracy of traffic flow. The autoregressive integrated moving average (ARIMA) model and the seasonal ARIMA (SARIMA) model transform the non-stationary time series into a stationary time series through difference to predict traffic flow. However, due to the nonlinearity and uncertainty characteristics of traffic flow, the prediction effect of the above methods is poor.
[0005] Machine learning methods are widely used in traffic flow prediction, such as support vector regression (SVR), K-nearest neighbor (KNN), Bayesian model, etc. Although machine learning methods can mine nonlinear relationships in traffic flow data, they rely on meticulous feature engineering and have poor prediction accuracy for complex and high-dimensional nonlinear traffic flow data. With the rise of deep learning, many researchers use deep learning methods to process high-dimensional spatiotemporal data in order to better extract spatiotemporal correlation features. For example, the long short-term memory (LSTM) model is applied to traffic flow prediction to improve the prediction accuracy of traffic flow by capturing the long-term temporal correlation features of traffic flow.
[0006] The above traffic flow prediction methods usually choose to model traffic characteristics such as flow and speed as a typical time series prediction problem, but using the time series model alone is insufficient because it ignores spatial dependence. This will result in: 1. Reduced prediction accuracy; 2. Failure to reflect the impact of the traffic network; 3. Difficulty in dealing with abnormal traffic events and situations, etc. Summary of the invention
[0007] Purpose of the invention: The present invention provides a method for constructing a traffic flow prediction model and a traffic flow prediction method thereof, the goal of which is to establish a framework consisting of three core components: a graph network generation layer, a graph convolution module, and a multi-scale time convolution module. A dynamic adjacency matrix is generated by an adaptive dynamic graph generator and a heterogeneous adjacency relationship attention mechanism, and multiple types of adjacency matrices are aggregated to better utilize the traffic characteristics in traffic nodes and capture the spatial characteristics implicit in the extracted traffic characteristics. Compared with traditional traffic flow prediction that only uses time series models alone, more accurate short-term and long-term traffic flow predictions are provided.
[0008] In order to achieve the above object, the present invention provides a method for constructing a traffic flow prediction model (the model of the present invention is abbreviated as CDAGCN), comprising the following steps:
[0009] S100, describe the relationship between entities in the network with a graph structure, and construct a feature matrix between nodes;
[0010] S200, based on the graph structure and feature matrix, a convolutional neural network framework combined with spatiotemporal attention mechanism is used to build a traffic flow prediction model;
[0011] The framework of the traffic flow prediction model includes a graph network generation layer, a convolutional layer, and a skip connection output layer;
[0012] The graph network generation layer is composed of an adaptive dynamic graph generator and a heterogeneous adjacency attention mechanism. The adaptive dynamic graph generator is used to generate a dynamic adjacency matrix. The heterogeneous adjacency attention mechanism is a multi-adjacency attention mechanism. The initial adjacency matrix, the dynamic adjacency matrix and the feature matrix are aggregated, and the aggregated adjacency matrix is output.
[0013] The convolution layer is composed of several layers of convolution units, each of which is composed of an MTCN module and a GC module; the MTCN module is used to extract time features in different ranges using convolution kernels of different sizes; the GC module is used to fuse the information of a node and its adjacent nodes to process the spatial dependency relationship in the graph;
[0014] The jump connection output layer is jump-connected to each convolution unit of the convolution layer, the output of each convolution layer is summed, and the prediction result is output;
[0015] S300, training the constructed traffic flow prediction model to obtain a traffic flow prediction product. A further preferred technical solution of the present invention is that the relationship between entities in the network is described in step S100 using a graph structure, and a feature matrix between nodes is constructed; including:
[0016] S110, using a graph structure to describe the relationship between entities in the network, specifically: Describes the construction of a graph network, where the variables in a multivariate time series are considered as nodes in the graph, and the graph adjacency matrix describes the relationship between the nodes; express N A collection of nodes, E represents the set of edges, Represents a slave node Point to Node The edge, express The adjacency matrix of but , on the contrary but ;
[0017] in, ,as well as All represent nodes; Represents the nodes in the adjacency matrix The correlation value of two nodes is 0 if they have no relationship and c if they have relationship.
[0018] S120, constructing a feature matrix between nodes, specifically:
[0019] The characteristic matrix of the graph is Indicates that is the length of the time series, is the dimension of the feature; for the construction of a given graph network G and T in The feature matrix of time steps, the traffic prediction problem is expressed as:
[0020] (1);
[0021] in, Represents the mapping process, Represents the mapping process from input to output;
[0022] T in The step size for making prediction inputs; is the step size of the predicted output; A number represented by is used to analogize the selected part; For predicted data.
[0023] Preferably, the feature matrix constructed in step S120 includes a correlation feature matrix, a distance feature matrix and a weather feature matrix constructed based on the traffic flow, mutual distance and weather of the region respectively;
[0024] Among them, the construction method of the relevant feature matrix is:
[0025] The Pearson correlation coefficient and the Spearman correlation coefficient are used to measure the data correlation between nodes; the Pearson correlation coefficient is defined as:
[0026] (2);
[0027] In the formula, represents the average operation, represents the time length of historical traffic flow, Indicates Nodes at time recorded traffic flows; Indicates Nodes and Pearson correlation coefficient of nodes;
[0028] The Spearman correlation coefficient is defined as:
[0029] (3);
[0030] in Represents the operation of sorting variable values. Indicates The node and Spearman correlation coefficient between nodes;
[0031] Setting Hyperparameters To measure the importance of the two correlation coefficients, and define the correlation calculation formula between nodes as:
[0032] (4);
[0033] In the formula, Indicates The node and The data correlation measure between nodes ranges from -1 to 1. The closer the value is to 1 or -1, the greater the positive or negative correlation between the nodes. Calculate the data association features between each node and obtain the association feature matrix ;
[0034] The distance feature matrix is constructed as follows:
[0035] node With Node The physical distance between them is calculated by the Haversine formula:
[0036] (5);
[0037] (6);
[0038] (7);
[0039] in For Node With Node The physical distance between is the radius of the Earth; is the normalized representation of the angular distance between nodes; Represents the angular distance between nodes calculated by the Haversine formula; Hav function, namely Haversine function, is used to process the conversion of angles in spherical distance calculation; Lat and Lon represent the latitude and longitude of the node respectively; calculate the physical distance between all nodes and generate the distance set , to evaluate the distance, the calculation formula is:
[0040] (8);
[0041] in, For Node With Node The distance correlation measure ranges from 0 to 1. Values close to 1 indicate greater distance correlation. Calculate the distance-related features between all nodes and obtain the distance feature matrix
[0042] ;
[0043] The construction method of the weather feature matrix is:
[0044] Classify weather into different categories, defined as metric values , its value ranges from 0 to 1. The closer the value is to 1, the more suitable the weather conditions are for traveling; on the contrary, the weather conditions are less suitable for traveling; Indicates Nodes and The weather characteristic measurement value of each node is used to determine the weather characteristic matrix of all nodes: .
[0045] Preferably, the traffic flow prediction model is constructed according to the graph structure and the feature matrix in step S200 by using a convolutional neural network framework combined with a spatiotemporal attention mechanism; including:
[0046] S210, constructing a graph network generation layer;
[0047] S220, construct a convolutional network layer;
[0048] S230, construct a skip connection output layer.
[0049] Preferably, the specific method of constructing the graph network generation layer in step S210 is as follows:
[0050] S211, build an adaptive dynamic graph generator, dynamic adjacency matrix Indicates that the dynamic adjacency matrix is specifically:
[0051] (9);
[0052] definition ; represents transpose; the three learnable weight matrices are respectively Indicates that is the implicit dimension, ;
[0053] S212, introduce heterogeneous adjacency relationship attention mechanism, select multiple adjacency matrices, including the initial adjacency matrix Dynamic adjacency matrix Mobility adjacency matrix , correlation feature matrix , distance feature matrix and weather characteristics matrix ; where the mobility adjacency matrix for:
[0054] (10);
[0055] in Respectively represent Nodes and Traffic flow and traffic speed of each node, is a hyperparameter;
[0056] The specific process in this mechanism is:
[0057] (11);
[0058] (12);
[0059] (13);
[0060] (14);
[0061] (15);
[0062] Formula (11) is the activation function of the linear layer, Formula (13) and Formula (14) are the averaging and normalization operations respectively;
[0063] The calculated z continues to pass through another linear layer, in which the calculation is to add z to the new weight matrix V The output obtained by multiplication; is the calculated average value, is the result of normalization, and the calculation result is Normalize to a value between 0 and 1, and all normalized values add up to 1 for probability distribution calculation; For all The sum after exponential operation;
[0064] The input to this mechanism is a set of adjacency matrices , the output is the aggregated adjacency matrix , ; , are two weight matrices, , .
[0065] Preferably, the convolutional network layer is constructed in step S220, and the specific method is as follows:
[0066] S221, MTCN module consists of a multi-scale gated temporal convolution module and an efficient pyramid segmentation attention module. First, a multi-scale gated temporal convolution module is constructed. The multi-scale gated temporal convolution module includes two multi-scale convolution layers and a gated fusion module;
[0067] The multi-scale convolution layer is a temporal convolution module, which consists of four different filters, namely 1×2, 1×3, 1×6 and 1×7. The convolution process is:
[0068] (16);
[0069] in, , It is Output of the layer; the four filters are truncated to the same length based on the largest filter and concatenated in the channel dimension; , , and It is the process of convolution using 4 different convolution kernels. * is the convolution operation. For the serial operation, the output after convolution is defined as ;
[0070] Then, a gating mechanism is used to filter out unnecessary time information. The process is as follows:
[0071] (17);
[0072] (18);
[0073] in, Represents the model parameters of the current layer, is the element-wise product, is the pouring coefficient obtained through learning, It is the Sigmoid function that determines the proportion of information passed to the next layer; the output after defining the time convolution and gating mechanism is , is the number of output time features, is the number of channels;
[0074] S222, build an efficient pyramid segmentation attention module, input data , divided into parts, expressed as ; The number of channels split each time is , in is the number of channels after grouping;
[0075] Then, the multi-scale convolution kernel is used to group the convolutions. The calculation formula for multi-scale feature extraction is (19) to (21):
[0076] (19);
[0077] (20);
[0078] (twenty one);
[0079] The size of the group is adaptively selected according to the size of the convolution kernel, where the relationship between the group and the convolution kernel is: , Represents the process of convolution; for The output obtained by group convolution concatenation; through Extract channel attention weights of data of different scales, Attention weight vectors for channels of different scales;
[0080] The Softmax function is used to process the weight parameters. The process is as follows:
[0081] (twenty two);
[0082] (twenty three);
[0083] (twenty four);
[0084] in, is the element-wise product, The corresponding eigenvector and weighting coefficient Multiply them together to get;
[0085] Finally, the weighted feature vectors are concatenated to obtain the time module in the The output of the layer is ;
[0086] S223, constructing a GC module, which is used to fuse the information of a node and its adjacent nodes to process the spatial dependency relationship in the graph. The module consists of two propagation layers, which process the inflow and outflow information of each node respectively, and adopts a hybrid jump propagation layer to process the information flow on the spatial dependency nodes;
[0087] The hybrid jump propagation layer includes information propagation and information selection. First, the information is propagated vertically, and then the information is selected horizontally. Specifically:
[0088] (1) The information dissemination step is vertical dissemination, which is defined as:
[0089] (25);
[0090] in is a hyperparameter that controls the ratio of keeping the original state of the root node;
[0091] (2) The information selection step is horizontal propagation, which is defined as:
[0092] (26);
[0093] in For the propagation depth, represents the input hidden state of the previous layer output, represents the output hidden state of the current layer, , and ;
[0094] (3) Assume , , , ,but:
[0095] (27).
[0096] Preferably, the skip connection output layer is constructed in step S230 by:
[0097] The skip connection layer is The standard convolution of It is The sequence length of the skip connection layer input will be output Convert to Jump Dimension , is the jump size;
[0098] Then, the output of each skip connection layer is summed to get the final hidden state ; The final hidden state is passed through the output layer Convert to the required dimension, the calculation formula is:
[0099] (28);
[0100] in, for Another aspect of the present invention provides a traffic flow prediction method, comprising the following steps:
[0101] S400, collecting historical data of the area to be predicted from the traffic database to form a data set, dividing the data set into a training set, a validation set and a test set in proportion, and training the traffic flow prediction model constructed above;
[0102] S500: Use the trained traffic flow prediction model to predict traffic flow at future times.
[0103] Beneficial effects: The construction method of the traffic flow prediction model and the traffic flow prediction method described in the present invention establish a framework consisting of three core components: a graph network generation layer, a graph convolution module, and a multi-scale time convolution module. The dynamic adjacency matrix is generated by an adaptive dynamic graph generator and a heterogeneous adjacency relationship attention mechanism, and multiple types of adjacency matrices are aggregated to better utilize the traffic characteristics in traffic nodes and capture the spatial characteristics implicit in the extracted traffic characteristics. On the basis of traditional prediction methods, dynamic adjacency information aggregation and information selection mechanisms are introduced. The spatial dependence of traffic characteristics such as flow and speed is effectively considered, and the complex relationship between nodes in the traffic network that changes over time can be captured more accurately. It overcomes the limitations of traditional methods and effectively solves the problems of low prediction accuracy and inability to reflect the impact of traffic networks in traditional traffic flow prediction methods in intelligent transportation systems.
[0104] The traffic flow prediction method of the present invention can still maintain a certain accuracy of prediction when facing various complex traffic conditions, providing more accurate short-term and long-term traffic flow prediction for intelligent transportation systems, and has great application prospects in traffic flow prediction in intelligent transportation systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0105] Figure 1 A flow chart is constructed for the traffic flow prediction model of the present invention.
[0106] Figure 2 It is a conceptual diagram of the network and entities in the present invention.
[0107] Figure 3 It is a schematic diagram of the characteristic matrix in the present invention.
[0108] Figure 4 It is a framework diagram of the traffic flow prediction model in the present invention.
[0109] Figure 5 It is a schematic diagram of the adaptive dynamic graph generator in the present invention.
[0110] Figure 6 It is a schematic diagram of the heterogeneous adjacency relationship attention mechanism in the present invention.
[0111] Figure 7 It is a schematic diagram of the MTC module and multi-scale convolutional layer in the present invention.
[0112] Figure 8 It is a schematic diagram of the efficient pyramid segmentation attention module in the present invention.
[0113] Fig. 9 It is a schematic diagram of the GC module in the present invention.
[0114] Fig.10 It is a comparison chart of RMSE, MAE and MAPE of different models and different prediction steps in the embodiment of the present invention on the PeMS04 and PeMS08 data sets.
[0115] Fig.11 It is a visualization diagram of different prediction step sizes of a single sensor on a data set in an embodiment of the present invention.
[0116] Fig.12 It is a visualization diagram of the prediction comparison of different models in the prediction step in the embodiment of the present invention.
[0117] Fig.13 is a performance evaluation diagram of an ablation experiment under traffic congestion in an embodiment of the present invention. DETAILED DESCRIPTION
[0118] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments, and they should not be understood as limitations on the present invention. 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. In the description of the present invention, it should be understood that the terms used are only for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0119] Combine the following Figure 1-Figure 13 The present invention describes a method for constructing a traffic flow prediction model and a traffic flow prediction method.
[0120] Embodiment 1: This embodiment provides a method for constructing a traffic flow prediction model, such as Figure 1 As shown, the steps include: S100, as Figure 2 As shown in the figure, the relationship between entities in the network is described by a graph structure, and a feature matrix between nodes is constructed; including:
[0121] S110, describing the relationship between entities in the network using a graph structure, specifically:
[0122] by Describes the construction of a graph network, where the variables in a multivariate time series are considered as nodes in the graph, and the graph adjacency matrix describes the relationship between the nodes; express N A collection of nodes, E represents the set of edges, Represents a slave node Point to Node The edge, express The adjacency matrix of but , on the contrary but ;
[0123] in, ,as well as All represent nodes; Represents the nodes in the adjacency matrix The correlation value of two nodes is 0 if they have no relationship and c if they have relationship.
[0124] S120, constructing a feature matrix between nodes, specifically:
[0125] The characteristic matrix of the graph is Indicates that is the length of the time series, is the dimension of the feature; for the construction of a given graph network G and T in The feature matrix of time steps, the traffic prediction problem is expressed as:
[0126] (1);
[0127] in, Represents the mapping process, Represents the mapping process from input to output;
[0128] T in The step size for making prediction inputs; is the step length of the predicted output; the present invention uses 12 data to predict the next 12 data, that is, T in For 12 is 12, A number represented by is used to analogize the selected part; For predicted data, such as is 12, Just for 12 (Number of nodes, that is, the number of sensors) D (the characteristic dimension of the data is 3, which are flow, speed and occupancy).
[0129] The constructed feature matrix is as follows: Figure 3As shown, it includes a correlation feature matrix, a distance feature matrix and a weather feature matrix constructed based on the regional traffic flow, mutual distance and weather respectively; wherein the construction method of the correlation feature matrix is:
[0130] The Pearson correlation coefficient and the Spearman correlation coefficient are used to measure the data correlation between nodes; the Pearson correlation coefficient is defined as:
[0131] (2);
[0132] In the formula, represents the average operation, represents the time length of historical traffic flow, Indicates Nodes at time recorded traffic flows; Indicates Nodes and Pearson correlation coefficient of nodes;
[0133] The Spearman correlation coefficient is defined as:
[0134] (3);
[0135] in Represents the operation of sorting variable values. Indicates The node and Spearman correlation coefficient between nodes;
[0136] Setting Hyperparameters To measure the importance of the two correlation coefficients, and define the correlation calculation formula between nodes as:
[0137] (4);
[0138] In the formula, Indicates The node and The data correlation measure between nodes ranges from -1 to 1. The closer the value is to 1 or -1, the greater the positive or negative correlation between the nodes. Calculate the data association features between each node and obtain the association feature matrix ;
[0139] The distance feature matrix is constructed as follows:
[0140] node With Node The physical distance between them is calculated by the Haversine formula:
[0141] (5);
[0142] (6);
[0143] (7);
[0144] in For Node With Node The physical distance between is the radius of the Earth; is the normalized representation of the angular distance between nodes; Represents the angular distance between nodes calculated by the Haversine formula; Hav function, namely Haversine function, is used to process the conversion of angles in spherical distance calculation; Lat, Lon represent the latitude and longitude of the node respectively;
[0145] Calculate the physical distance between all nodes and generate a distance set , to evaluate the distance, the calculation formula is:
[0146] (8);
[0147] in, For Node With Node The distance correlation measure ranges from 0 to 1. Values close to 1 indicate greater distance correlation. Calculate the distance-related features between all nodes and obtain the distance feature matrix
[0148] ;
[0149] The construction method of the weather feature matrix is:
[0150] Classify weather into different categories, defined as metric values , its value ranges from 0 to 1. The closer the value is to 1, the more suitable the weather conditions are for traveling; on the contrary, the weather conditions are less suitable for traveling; Indicates Nodes and The weather characteristic measurement value of each node is used to determine the weather characteristic matrix of all nodes: .
[0151] In addition, the present invention randomly selects 100 people by issuing questionnaires to determine the influence weights of different weather categories.
[0152] S200, based on the graph structure and feature matrix, a convolutional neural network framework combined with spatiotemporal attention mechanism is used to build a traffic flow prediction model;
[0153] The framework of the traffic flow prediction model is as follows: Figure 4 As shown, it includes a graph network generation layer, a convolutional layer, and a skip connection output layer;
[0154] The graph network generation layer is composed of an adaptive dynamic graph generator and a heterogeneous adjacency attention mechanism. The adaptive dynamic graph generator is Figure 4 As shown, it is used to generate a dynamic adjacency matrix and a heterogeneous adjacency relationship attention mechanism, such as Figure 6 As shown, it is a multi-adjacency relationship attention mechanism, which aggregates the initial adjacency matrix, the dynamic adjacency matrix and the feature matrix, and outputs the aggregated adjacency matrix;
[0155] The convolution layer is composed of several layers of convolution units, each of which is composed of an MTCN module and a GC module; the MTCN module is used to extract time features in different ranges using convolution kernels of different sizes; the GC module is used to fuse the information of a node and its adjacent nodes to process the spatial dependency relationship in the graph; the jump connection output layer is jump-connected to each layer of convolution units in the convolution layer, the output of each convolution layer is summed, and the prediction result is output;
[0156] The construction method of traffic flow prediction model is as follows:
[0157] S210, constructing a graph network generation layer; the specific method is:
[0158] S211, build an adaptive dynamic graph generator, dynamic adjacency matrix Indicates that the dynamic adjacency matrix is specifically:
[0159] (9);
[0160] definition ; represents transpose; the three learnable weight matrices are respectively Indicates that is the implicit dimension, ;
[0161] S212, introduce heterogeneous adjacency relationship attention mechanism, select multiple adjacency matrices, including the initial adjacency matrix Dynamic adjacency matrix Mobility adjacency matrix , correlation feature matrix , distance feature matrix and weather characteristics matrix ; where the mobility adjacency matrix for:
[0162] (10);
[0163] in Respectively represent Nodes and Traffic flow and traffic speed of each node, is a hyperparameter;
[0164] The specific process in this mechanism is:
[0165] (11);
[0166] (12);
[0167] (13);
[0168] (14);
[0169] (15);
[0170] Formula (11) is the activation function of the linear layer, Formula (13) and Formula (14) are the averaging and normalization operations respectively; The calculated z continues to pass through another linear layer, in which the calculation is to add z to the new weight matrix V The output obtained by multiplication; is the calculated average value, is the result of normalization, and the calculation result is Normalize to a value between 0 and 1, and all normalized values add up to 1 for probability distribution calculation; For all The sum after exponential operation;
[0171] The input to this mechanism is a set of adjacency matrices , the output is the aggregated adjacency matrix , , , are two weight matrices, , .
[0172] S220, construct a convolutional network layer; the specific method is:
[0173] S221,MTCN module consists of a multi-scale gated temporal convolution module and an efficient pyramid segmentation attention module. First, a multi-scale gated temporal convolution module is constructed, such as Figure 7As shown, the multi-scale gated temporal convolution module includes two multi-scale convolution layers and a gated fusion module;
[0174] The multi-scale convolution layer is a temporal convolution module, which consists of four different filters, namely 1×2, 1×3, 1×6 and 1×7. The convolution process is:
[0175] (16);
[0176] in, , It is Output of the layer; the four filters are truncated to the same length based on the largest filter and concatenated in the channel dimension; , , and It is the process of convolution using 4 different convolution kernels. * is the convolution operation. For the serial operation, the output after convolution is defined as ;
[0177] Then, a gating mechanism is used to filter out unnecessary time information. The process is as follows:
[0178] (17);
[0179] (18);
[0180] in, Represents the model parameters of the current layer, is the element-wise product, is the pouring coefficient obtained through learning, It is the Sigmoid function that determines the proportion of information passed to the next layer; the output after defining the time convolution and gating mechanism is , is the number of output time features, is the number of channels;
[0181] S222, build an efficient pyramid segmentation attention module, such as Figure 8 As shown, the input data , divided into parts, expressed as ; The number of channels split each time is , in is the number of channels after grouping;
[0182] Then, the multi-scale convolution kernel is used to group the convolutions. The calculation formula for multi-scale feature extraction is (19) to (21):
[0183] (19);
[0184] (20);
[0185] (twenty one);
[0186] The size of the group is adaptively selected according to the size of the convolution kernel, where the relationship between the group and the convolution kernel is: , Represents the process of convolution; for The output obtained by group convolution concatenation; through Extract channel attention weights of data of different scales, Attention weight vectors for channels of different scales;
[0187] The Softmax function is used to process the weight parameters. The process is as follows:
[0188] (twenty two);
[0189] (twenty three);
[0190] (twenty four);
[0191] in, is the element-wise product, The corresponding eigenvector and weighting coefficient Multiply them together to get;
[0192] Finally, the weighted feature vectors are concatenated to obtain the time module in the The output of the layer is ;
[0193] S223, build GC module, such as Fig. 9 As shown in the figure, the GC module is used to fuse the information of a node and its adjacent nodes to process the spatial dependency in the graph. The module consists of two propagation layers, which process the inflow and outflow information of each node respectively, and adopts a hybrid jump propagation layer to process the information flow on the spatial dependency nodes.
[0194] The hybrid jump propagation layer includes information propagation and information selection. First, the information is propagated vertically, and then the information is selected horizontally. Specifically:
[0195] (1) The information dissemination step is vertical dissemination, which is defined as:
[0196] (25);
[0197] in is a hyperparameter that controls the ratio of keeping the original state of the root node; (2) The information selection step is horizontal propagation, defined as:
[0198] (26);
[0199] in For the propagation depth, represents the input hidden state of the previous layer output, represents the output hidden state of the current layer, , and ;
[0200] (3) Assume , , , ,but:
[0201] (27);
[0202] S230, construct a skip connection output layer; the specific method is:
[0203] The skip connection layer is The standard convolution of It is The sequence length of the skip connection layer input will be output Convert to Jump Dimension , is the jump size;
[0204] Then, the output of each skip connection layer is summed to get the final hidden state ; The final hidden state is passed through the output layer Convert to the required dimension, the calculation formula is:
[0205] (28);
[0206] in, for The prediction results of the step.
[0207] S300: training the constructed traffic flow prediction model to obtain a traffic flow prediction product.
[0208] Embodiment 2: This embodiment provides a traffic flow prediction method, comprising the following steps:
[0209] S400, collecting historical data of the area to be predicted from the traffic database to form a data set, dividing the data set into a training set, a validation set and a test set in proportion, and training the traffic flow prediction model constructed in Example 1;
[0210] S500: Use the trained traffic flow prediction model to predict traffic flow at future times.
[0211] In addition, in one embodiment, an electronic device is provided, which may include: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus. The processor may call the logic instructions in the memory to execute the traffic flow prediction method of embodiment 2.
[0212] In one embodiment, a non-transitory computer-readable storage medium is provided, on which computer instructions are stored. The computer instructions enable a computer to execute the traffic flow prediction method of embodiment 2.
[0213] In one embodiment, a computer program product is provided, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the traffic flow prediction method of Example 2.
[0214] In order to verify the construction method of the six traffic prediction models in Example 1 and the traffic flow prediction method in Example 2, the traffic flow prediction method of the present invention is compared with various traditional prediction methods. The specific implementation method of the present invention is such as Example 1 and Example 2, which will not be repeated here.
[0215] The data sources used are disclosed as follows:
[0216] First, two public datasets, PeMS04 and PeMS08, are used for experiments. PeMS provides a unified traffic database. Other data sources required by the present invention are: meteorological data from "https: / / www.almanac.com / weather / history / CA", and GPS data of the PeMS dataset from https: / / PeMS.dot.ca.gov / . The present invention takes traffic flow as the research object, and divides all datasets into training set, validation set and test set in a ratio of 6:2:2 according to time.
[0217] PeMS04: contains 307 sensors, and the time period is from January 1, 2018 to February 28, 2018, a total of 59 days. Here, the data of the first 35 days are selected as the training set, the data of the next 12 days are selected as the validation set, and the data of the last 12 days are selected as the test set.
[0218] PeMS08: contains 170 sensors, and the time period is from July 1, 2016 to August 31, 2016, a total of 62 days. Here, the data of the first 38 days are selected as the training set, the data of the next 12 days are selected as the validation set, and the data of the last 12 days are selected as the test set.
[0219] In addition, the present invention uses three indicators commonly used in traffic flow prediction tasks, namely, root mean square error (RMSE), mean absolute error (MAE) and mean absolute percentage error (MAPE) to evaluate the prediction accuracy of the proposed model, as shown in formulas (29) to (31):
[0220] (29);
[0221] (30);
[0222] (31);
[0223] In the above formula, Represents the true value of traffic flow: represents the predicted value of traffic flow; Indicates the total number of samples. The lower the three indicators are, the higher the prediction ability of the model is. In order to ensure the robustness of the experimental results, the present invention conducts each experiment once and calculates the average value as the result value. In addition, the data of the past hour (12 steps) is used to predict the traffic flow of the next hour (12 steps) during the experiment, that is, multi-step prediction.
[0224] Various prediction methods compared with the traffic flow prediction method of the present invention are divided into three categories:
[0225] (1) Traditional method; (2) Traditional deep learning method; (3) Spatiotemporal graph neural network method.
[0226] In order to verify the effectiveness of the method in the present invention for long-term traffic flow prediction tasks, the prediction performance of the model of the present invention is compared with the existing models on the PeMS04 and PeMS08 datasets. Compared with the HA, VAR, FC-LSTM, TCN and other models that only consider time correlation, the method of the present invention utilizes spatial correlation and obtains better time prediction performance. At the same time, compared with the latest spatiotemporal graph neural network, the MTCN module used in the extraction of temporal features of the present invention effectively extracts the multi-scale features of traffic flow data and uses an efficient pyramid segmentation attention mechanism to reduce the complexity of the model. In the extraction of spatial features, an adaptive dynamic graph generator is first used to generate a real-time dynamic graph, and a heterogeneous adjacency relationship attention mechanism is used to aggregate multiple adjacency matrices, and finally the relevant spatial features are extracted on the GC module. On the PeMS04 and PeMS08 datasets, the RMSE, MAE and MAPE of the model of the present invention are 3.94%, 5.76%, 6.27%, 5.54%, 11.45% and 13.80% lower than MVSTT, respectively.
[0227] Compare the performance of different prediction step sizes:
[0228] The present invention compares the performance of DCRNN, STGCN, ASTGCN, Graph WaveNet, STFGNN, ASTGT, MVSTT and CDAGCN with different prediction step sizes. The RMSE, MAE and MAPE of the model across 12 time steps are as follows: Fig.10 As shown, it can be concluded that the CDAGCN model of the present invention always shows the highest level of prediction accuracy in all 12 time steps. The CDAGCN model has high prediction accuracy and minimal prediction error variation at different road network scales, thus ensuring reliable prediction of intelligent transportation system (ITS) tasks at different time ranges and spatial scales.
[0229] The traffic flow prediction value and the actual value of the model in the present invention at different step sizes are compared. Fig.11 shown. Fig.11 (a) shows the predicted value and true value of node 9 on the PeMS04 dataset on February 21, 2018, corresponding to step size 1, step size 6, and step size 12 respectively. Fig.11(b) shows a similar comparative analysis at node 15 on the PeMS08 dataset on August 24, 2016. The predictions were also made under step sizes 1, 6, and 12. The comparative analysis shows that on both datasets, the prediction accuracy of step size 1 is significantly better than that of other horizons. Due to the lack of time lag, step size 1 can more accurately capture the details and changing trends of data fluctuations. As the prediction horizon extends, the prediction accuracy decreases, but overall, the CDAGCN model can still accurately reflect the changing trend of the data. This shows that the CDAGCN model has obvious advantages in both short-term and long-term traffic flow predictions and the model has a strong ability to capture trends.
[0230] Model comparison experiment:
[0231] The present invention selects STFGNN and MVSTT models as comparison benchmarks and evaluates the performance of the CDAGCN model proposed in the present invention. The comparison results are shown in Figure 2. Fig.12 As shown. The traffic flow data of node 11 in the PeMS08 dataset on August 24, 2016 was selected for analysis. In the visualized line chart, it can be clearly seen that the CDAGCN model can accurately capture the trend of traffic flow changes. Especially in the case of sudden changes in traffic flow, the CDAGCN model shows significant prediction advantages over the STFGNN and MVSTT models. In the scatter plot, the predicted value of the model of the present invention is more consistent with the true value, which further verifies the superiority of the CDAGCN model. By comparison, it can be found that the CDAGCN model has higher accuracy and reliability in dealing with sudden changes in traffic flow, showing its potential and application prospects in the field of traffic flow prediction.
[0232] Ablation experiment:
[0233] In order to verify the effectiveness of the CDAGCN model construction, this paper conducts ablation experiments from two aspects: model components and adjacency matrix. By removing or replacing key components one by one, the impact on the overall performance of the model is evaluated. In the ablation experiment, the contribution of each component and the adjacency matrix under different configurations is analyzed in detail, thereby fully revealing the construction mechanism of the CDAGCN model and the impact of key elements on performance.
[0234] (1) The impact of model components on prediction accuracy. In order to explore the impact of different components of the proposed model on model evaluation, this paper uses four variants designed based on CDAGCN (the latter is called K). These four variants are compared with CDAGCN on the PeMS04 dataset. During the comparison process, all variant models are trained and tested using the same hyperparameters, thus ensuring fairness and scientific accuracy. The model differences are described as follows:
[0235] CDAGCN-K1: The multi-scale convolutional layer in the MTCN module in the CDAGCN model is replaced with a normal convolutional layer module.
[0236] CDAGCN-K2: The efficient pyramid segmentation attention module is removed from the CDAGCN model.
[0237] CDAGCN-K3: The adaptive dynamic graph generator is removed from the CDAGCN model and the graph learning layer in the MTGNN model is adopted.
[0238] CDAGCN-K4: The CDAGCN model removes both the adaptive dynamic graph generator and the heterogeneous adjacency attention mechanism and adopts the graph learning layer of MTGNN.
[0239] By comparing K1-K4, it is found that each component brings different degrees of accuracy improvement. The use of multi-scale convolutional layers can expand the receptive field compared to ordinary convolutional layers. The hourly, daily, weekly and other cycles unique to traffic flow data can be well covered and the implicit time series features can be captured. CDAGCN is 2.15% lower than K1 in RMSE, which proves its effectiveness. The efficient pyramid segmentation attention mechanism can reduce the complexity of the model. After removing it from the model, it is noticed that it brings a certain degree of accuracy improvement. This is because this attention mechanism can effectively handle the relationship between channels and capture relevant features, which brings 1.21% and 2.13% reduction in RMSE and MAE. The spatial features of adaptive dynamic graphs and other related graph matrices are crucial in spatiotemporal graph neural networks. K4, which only uses graph learning layers, has the worst predictive ability among all variants.
[0240] In order to further understand the effect of the designed ablation experiment evaluation and the effect of the model predicting the congestion time period data, the present invention finds a congestion time period and visualizes it (taking the PeMS08 dataset as an example), as shown in the following figure. Fig.13 As shown in the figure, it can be seen that the location in the green box is severely congested. Therefore, a few hours near this time point are selected to evaluate the corresponding model. Fig.13 As shown in (b), the present invention visually compares four variants with different missing components with the complete version model. The present invention finds that the model with the addition of adaptive dynamic graph generator and heterogeneous adjacency attention mechanism has more sensitive changes near congested time periods. Fig.13As shown in the circle in (a), the prediction trend of the complete CDAGCN model is closer to the actual value. For the K1 model that lacks the multi-scale convolution layer, it is flatter in the trend of change and cannot respond to the change of the trough faster. This is because the multi-scale convolution can extract the relevant features of the past congestion and more easily discover the changing trend of traffic flow during congestion. In addition, it can be seen that the lack of heterogeneous adjacency attention mechanism will also lead to the ability to capture peak changes. This is because the multi-adjacency matrix plays a vital role, such as the mobility adjacency matrix, which is closely related to the traffic speed, and the change in traffic speed during congestion has a very important impact on the prediction of traffic flow during the congestion period. In summary, the prediction capabilities of different variant models in congested conditions are compared, and the experiment also shows that the model of the present invention can effectively predict traffic flow during congestion, providing a solid scientific basis for formulating traffic congestion relief strategies.
[0241] (2) Impact of adjacency matrix on prediction accuracy, in order to explore the impact of the adjacency matrix used by the model on model evaluation, five types of adjacency matrix variants (the latter is called A) are also compared. As with the component comparison, all five variants of the adjacency matrix are performed under the full CDAGCN and are identical in terms of parameters. The model differences are described as follows:
[0242] CDAGCN-A1: Removing the mobility adjacency matrix in heterogeneous adjacency attention mechanism.
[0243] CDAGCN-A2: Removing the Correlation Feature Matrix in Heterogeneous Adjacency Attention Mechanism.
[0244] CDAGCN-A3: Removing the distance feature matrix in the heterogeneous adjacency attention mechanism.
[0245] CDAGCN-A4: Removing weather feature matrix in heterogeneous adjacency attention mechanism.
[0246] CDAGCN-A5: Removing the dynamic adjacency matrix in heterogeneous adjacency attention mechanism.
[0247] Among the five variants that remove the adjacency matrix, the variant that removes the mobility adjacency matrix has the smallest change in predictive ability. Among the five defined adjacency matrices, the adaptive dynamic adjacency matrix plays the most important role. The last three adjacency matrices, namely the association feature matrix, the distance feature matrix, and the weather feature matrix, have almost the same improvement effect, with the three indicators reduced by an average of 0.52%, 0.67%, and 1.46%. It has been proven that the traffic flow prediction method in the present invention significantly improves the prediction accuracy through the relevant adjacency matrix.
[0248] After a series of verification and analysis, the results show that the prediction method in the present invention has significant advantages in improving prediction accuracy and coping with complex traffic networks, and can still maintain a certain accuracy of prediction when facing various complex traffic conditions.
[0249] As described above, although the present invention has been shown and described with reference to specific preferred embodiments, it should not be construed as limiting the present invention itself. Various changes in form and details may be made without departing from the spirit and scope of the present invention as defined in the appended claims.
Claims
1. A method for constructing a traffic flow prediction model, characterized in that: The steps include: S100, describing the relationship between entities in the network with a graph structure, and constructing a feature matrix between nodes; including: S110, describing the relationship between entities in the network using a graph structure, specifically: G = (V, E, A) describes the construction of the graph network. The variables in the multivariate time series are regarded as nodes in the graph, and the graph adjacency matrix describes the relationship between the nodes; where V = {v1, v2, …, v N } represents a set of N nodes, E represents a set of edges, e=(v,u)∈E represents an edge from node u to node v, A∈ N×N represents the adjacency matrix of G; if (v i ,v j )∈E, then A ij =c>0, otherwise Then A ij =0; Among them, v1, v2, …, v N , and v i ,v j Both represent nodes; A ij Represents the node v in the adjacency matrix i ,v j The correlation value of two nodes is 0 if they have no relationship and c if they have relationship. S120, constructing a feature matrix between nodes, specifically: The characteristic matrix of the graph is X∈R T×N×D Represented as T, where T is the length of the time series and D is the dimension of the feature; for a given graph network construction G and T in The feature matrix of time steps, the traffic prediction problem is expressed as: Among them, f represents the mapping process, f represents the mapping process from input to output; T in is the step length of the prediction input; T out is the step size of the predicted output; t is a number representing the selected part; For the predicted data; The constructed feature matrix includes a correlation feature matrix, a distance feature matrix and a weather feature matrix respectively constructed based on the traffic flow, mutual distance and weather of the region; Among them, the construction method of the relevant feature matrix is: The Pearson correlation coefficient and the Spearman correlation coefficient are used to measure the data correlation between nodes; the Pearson correlation coefficient is defined as: In the formula, mean represents the average operation, T in represents the time length of historical traffic flow, x n,t represents the traffic flow recorded by the nth node at time t; W p (i, j) represents the Pearson correlation coefficient between the i-th node and the j-th node; The Spearman correlation coefficient is defined as: Where rank represents the operation of sorting variable values, W S (i, j) represents the Spearman correlation coefficient between the i-th node and the j-th node; Setting the hyperparameter J C =0.5 to measure the importance of the two correlation coefficients, and define the correlation calculation formula between nodes as: A c (i,j)=J C W S (i,j)+(1-J C )W P (i,j) (4); In the formula, A C (i, j) represents the data correlation measure between the i-th node and the j-th node, and its value range is -1 to 1. The closer the value is to 1 or -1, the greater the positive or negative correlation between the nodes. C (i, j) Calculate the data association features between each node and obtain the association feature matrix A C ∈R N,N ; The distance feature matrix is constructed as follows: The physical distance between node i and node j is calculated by the Haversine formula: d(i, j) = γR (5); D N (γ)=(1-cos(γ)) / 2 (6); D X (γ)=Hav(Lat(i)-Lat(j))+cos(Lat(i))cos(Lat(j))Hav(|Lon(i)-Lon(j)|) (7); Where d(i, j) is the physical distance between node i and node j, and R is the radius of the earth; D N (γ) is the normalized representation of the angular distance between nodes; D X (γ) represents the angular distance between nodes calculated by the Haversine formula; Hav function, i.e. Haversine function, is used to process the conversion of angles in spherical distance calculation; Lat, Lon represent the latitude and longitude of the node respectively; Calculate the physical distance between all nodes and generate the distance set D d , to evaluate the distance, the calculation formula is: Among them, A D (i,j) is the distance correlation measure between node i and node j, ranging from 0 to 1. Values close to 1 indicate greater distance correlation. D (i, j) Calculate the distance-related features between all nodes and obtain the distance feature matrix A D ∈R N·N ; The construction method of the weather feature matrix is: Divide the weather into different categories, defined as metric values T S , its value ranges from 0 to 1. The closer the value is to 1, the more suitable the weather conditions are for traveling; on the contrary, the weather conditions are less suitable for traveling; T S (i,j) represents the weather feature measurement value of the i-th node and the j-th node, and the weather feature matrix of all nodes is determined as A S ∈R N×N ; S200, based on the graph structure and feature matrix, a convolutional neural network framework combined with spatiotemporal attention mechanism is used to build a traffic flow prediction model; The framework of the traffic flow prediction model includes a graph network generation layer, a convolutional layer, and a skip connection output layer; Among them, the graph network generation layer is composed of an adaptive dynamic graph generator and a heterogeneous adjacency attention mechanism. The adaptive dynamic graph generator is used to generate a dynamic adjacency matrix. The heterogeneous adjacency attention mechanism is a multi-adjacency attention mechanism that aggregates the initial adjacency matrix, the dynamic adjacency matrix, and the feature matrix, and outputs the aggregated adjacency matrix. The convolution layer consists of several layers of convolution units, each of which consists of an MTCN module and a GC module. The MTCN module is used to extract temporal features in different ranges using convolution kernels of different sizes. The GC module is used to fuse the information of a node and its adjacent nodes to process the spatial dependencies in the graph. The skip connection output layer is skip-connected to each convolution unit of the convolution layer, the output of each convolution layer is summed, and the prediction result is output; Step S200 constructs a traffic flow prediction model based on the graph structure and feature matrix using a convolutional neural network framework combined with a spatiotemporal attention mechanism; including: S210, constructing a graph network generation layer; the specific method is: S211, build an adaptive dynamic graph generator, dynamic adjacency matrix with A vα ∈R N×N Indicates that the dynamic adjacency matrix is specifically: definition .T represents transpose; the three learnable weight matrices are represented by N1∈R F×H , N2∈R F×H , N3∈R N×N Indicates that H is the implicit dimension, F = T in ×D; S212, introduce heterogeneous adjacency relationship attention mechanism, select multiple adjacency matrices, including initial adjacency matrix A, dynamic adjacency matrix A vα , mobility adjacency matrix A Mi , correlation feature matrix A C , distance feature matrix A D and weather feature matrix A s ; Where the mobility adjacency matrix A Mi for: where μ ij 、v ij denote the traffic flow and traffic speed of the i-th node and the j-th node respectively, and κ is a hyperparameter; The specific process of this mechanism is as follows: z=ReLU(A i In) (11); z′=zV (12); Formula (11) is the activation function of the linear layer, Formula (13) and Formula (14) are the averaging and normalization operations respectively; z′ is the calculated z that continues to pass through another linear layer, in which the calculation is the output obtained by multiplying z with the new weight matrix V; α i is the calculated average value, is the result of normalization. The calculation result is Normalized to a value between 0 and 1, all normalized values add up to 1, which is used for probability distribution calculation; is for all α i The sum after exponential operation; The input of this mechanism is the adjacency matrix set A = [A,A vα ,A Mi ,A C ,A D ,A S ], the output is the aggregated adjacency matrix A Fu , A i ∈A{i∈[1,6]},A i Refers to the six adjacency matrices used in formula (15); W and V are two weight matrices, W∈R N·H′ ,V∈R H×1 , H′ is the latent dimension; S220, construct a convolutional network layer; the specific method is: S221, MTCN module consists of a multi-scale gated temporal convolution module and an efficient pyramid segmentation attention module. First, a multi-scale gated temporal convolution module is constructed. The multi-scale gated temporal convolution module includes two multi-scale convolution layers and a gated fusion module; The multi-scale convolution layer is a temporal convolution module, which consists of four different filters, namely 1×2, 1×3, 1×6 and 1×7. The convolution process is: in, is the output of the k-1th layer; the four filters are truncated to the same length according to the largest filter and connected in the channel dimension; and The process of convolution using 4 different convolution kernels, * is the convolution operation, CONCAT is the concatenation operation, and the output after convolution is defined as Then, a gating mechanism is used to filter out unnecessary time information. The process is as follows: Among them, M k , V k , b k , c k Represents the model parameters of the current layer, is the element-wise product, is the casting coefficient obtained through learning, σ is the Sigmoid function that determines the proportion of information passed to the next layer; the output after defining the time convolution and gating mechanism is F is the number of output temporal features, and C is the number of channels; S222, build an efficient pyramid segmentation attention module, input data Divided into g parts, expressed as The number of channels split each time is Where C′ is the number of channels after grouping; Then, the multi-scale convolution kernel is used to group the convolutions, and the calculation formula for multi-scale feature extraction is as follows: The size of the group is adaptively selected according to the size of the convolution kernel, where the relationship between the group and the convolution kernel is K q =2×(q+1)+1, Conv represents the convolution process; is the output of the convolution concatenation of the g group; the channel attention weights of data of different scales are extracted through SEWight, Attention weight vectors for channels of different scales; The Softmax function is used to process the weight parameters. The process is as follows: Among them, ⊙ is the element product, The corresponding eigenvector and weighting coefficient Multiply them together to get; Finally, the weighted feature vectors are concatenated to obtain the output of the time module at the kth layer: S223, constructing a GC module, which is used to fuse the information of a node and its adjacent nodes to process the spatial dependency relationship in the graph. The module consists of two propagation layers, which process the inflow and outflow information of each node respectively, and adopts a hybrid jump propagation layer to process the information flow on the spatial dependency nodes; The hybrid jump propagation layer includes information propagation and information selection. First, the information is propagated vertically, and then the information is selected horizontally. Specifically: (1) The information dissemination step is vertical dissemination, which is defined as: Where β is a hyperparameter that controls the ratio of keeping the original state of the root node; (2) The information selection step is horizontal propagation, defined as: Where K is the propagation depth, H in represents the input hidden state of the previous layer output, H out Represents the output hidden state of the current layer, H (0) =H in , and (3) Let K = 2, W (0) =0,W (1) =-1, W (2) =1, then: H out =Δ(H (2) ,H (1) )=H 2 -H 1 (27); S230, construct a skip connection output layer; the specific method is: The skip connection layer is 1×L i The standard convolution of i is the sequence length of the input to the i-th skip connection layer, converting the output X0 to the skip dimension d sk is the jump size; Then, the output of each skip connection layer is summed to get the final hidden state The final hidden state X is passed through the output layer hid Convert to the required dimension, the calculation formula is: in, T out The prediction results of the step; S300: training the constructed traffic flow prediction model to obtain a traffic flow prediction product.
2. A traffic flow prediction method, characterized in that: The steps include: S400, collecting historical data of the area to be predicted from the traffic database to form a data set, dividing the data set into a training set, a validation set and a test set in proportion, and training the traffic flow prediction model constructed by the construction method of claim 1; S500: Use the trained traffic flow prediction model to predict traffic flow at future times.
3. An electronic device, characterized in that: including a processor, a communication interface, a memory and a communication bus; Wherein, the processor, the communication interface, and the memory communicate with each other via a communication bus; The processor is used to call the logic instructions in the memory to execute the traffic flow prediction method described in claim 2.
4. A non-transitory computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and the computer instructions enable the computer to execute the traffic flow prediction method described in claim 2.
Citation Information
Patent Citations
Traffic prediction method based on multi-scale space-time fusion graph network
CN115240425A
DSTGCN-based traffic prediction method
CN115578852A