Traffic flow prediction method based on GAT and improved PKO-ELM algorithm

By combining the graph attention network GAT and the improved Kingfisher optimization algorithm PKO-ELM, the existing traffic flow prediction model is solved, and the problem of insufficient accuracy and high computing resource consumption when processing complex and dynamic traffic data is achieved, and efficient and accurate traffic flow prediction is achieved.

CN119694119AActive Publication Date: 2025-03-25HUAIYIN INSTITUTE OF TECHNOLOGY
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411813974.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-03-25
Estimated Expiration
2044-12-11

AI Technical Summary

Technical Problem

When processing complex and dynamic traffic data, the existing traffic flow prediction model lacks prediction accuracy, consumes high computing resources, and is difficult to fully capture the multivariable and multidimensional characteristics of traffic flow.

Method used

Combining the graph attention network GAT and the improved Kingfisher optimization algorithm PKO-ELM, complex dependencies in the traffic network are extracted through GAT, and parameters of the extreme learning machine (ELM) model are optimized to achieve efficient traffic flow prediction.

Benefits of technology

It improves the accuracy and computing efficiency of traffic flow prediction, can more accurately capture dynamic characteristics in the traffic network, reduce overfitting, and improve the robustness and generalization ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119694119A_ABST
    Figure CN119694119A_ABST
Patent Text Reader

Abstract

The invention discloses a traffic flow prediction method based on GAT and an improved PKO-ELM algorithm. The method comprises the following steps: firstly, preprocessing real-time acquired and historical traffic flow data sets; secondly, modeling a traffic road map into a map structure, and constructing a node feature matrix and an adjacent matrix; thirdly, updating and aggregating the features of the matrix through GAT, and extracting the spatial features of the nodes; then, constructing a PKO-ELM model, initializing a population through a reverse learning strategy to carry out PKO algorithm improvement, optimizing ELM parameters by utilizing the improved PKO algorithm, and searching an optimal solution of model parameters; and finally, predicting the traffic flow data by using the trained and optimized PKO-ELM model, and performing visual display through an interactive map. According to the method, a more accurate traffic flow prediction result is provided on the basis of an evolutionary algorithm after spatial feature extraction and parameter optimization of deep learning, so that traffic congestion is relieved, and traffic management is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of intelligent transportation system (ITS), and in particular relates to a traffic flow prediction method based on GAT and improved PKO-ELM algorithm. Background Art

[0002] With the rapid advancement of urbanization, traffic problems have become a key factor hindering urban development. Urban traffic congestion not only leads to reduced travel efficiency and increased energy consumption, but also causes great pollution to the environment. Traffic flow prediction is an important part of intelligent transportation system (ITS), which aims to predict vehicle flow, speed and traffic conditions in the road network, so as to more effectively dispatch traffic, optimize route planning and prevent traffic accidents, thereby improving road use efficiency, reducing traffic congestion, and improving road safety and travel experience.

[0003] At present, traffic flow prediction models include prediction models based on statistical theory, machine learning models, deep learning models, physics-based models, and hybrid prediction models. Prediction models based on statistical theory use mathematical and statistical principles to analyze and model the time series characteristics of traffic flow data. They are suitable for processing linear relationships and are relatively simple to calculate, but their prediction performance is weak for processing multivariate and multi-dimensional data. Machine learning models make predictions by learning patterns from a large amount of data. They can automatically learn and adapt to complex patterns in the data. Compared with methods based on statistical theory, they have higher prediction accuracy. However, due to the limitations of the model structure, their ability to extract nonlinear features is limited, making it difficult to accurately capture the spatiotemporal characteristics of traffic flow data, and they require high computing resources. Deep learning models often use deep network architectures with multiple hidden layers to automatically capture complex spatiotemporal characteristics, which enables them to handle the inherent high dimensionality and rapid changes in traffic data well, thereby greatly improving the accuracy of predictions. However, the complexity of this model also brings challenges such as long training cycles and difficulty in tuning. Physics-based models predict traffic conditions by describing the physical characteristics of traffic flow. They are applicable to a variety of traffic scenarios and can capture macroscopic phenomena, but they have high requirements for input data and are not flexible enough for real-time prediction of large-scale road networks. Due to their own limitations, single models are usually difficult to fully capture complex traffic flow dynamics. Hybrid prediction models can better handle nonlinear characteristics and diverse patterns in data by integrating the advantages of multiple single models, which helps to improve the accuracy and stability of predictions. In particular, when facing highly dynamic and uncertain traffic environments, the adaptability and comprehensive performance of hybrid models are often better than any single model.

[0004] By combining the excellent ability of the graph attention network GAT in processing graph structured data with the advantage of fast training of the extreme learning machine ELM, the present invention can effectively cope with the large-scale processing needs of real-time and historical traffic flow data, maintain high computing efficiency, and optimize the parameters of ELM to make traffic flow prediction more accurate. Summary of the invention

[0005] Purpose of the invention: In response to the problems in the background technology, the present invention proposes a traffic flow prediction method based on graph attention network GAT and improved Pied Kingfisher optimization algorithm PKO-ELM, which aims to provide a high-performance traffic flow prediction model by combining the spatial feature extraction capability of deep learning and the parameter optimization capability of evolutionary algorithm to cope with the increasingly complex traffic flow prediction tasks.

[0006] Technical solution: The present invention proposes a traffic flow prediction method based on GAT and improved PKO-ELM algorithm, comprising the following steps:

[0007] Step 1: Collect and determine real-time and historical traffic flow data sets, including the traffic volume F and average speed of the road section and density D, as well as calculating the congestion index C, and preprocessing the data;

[0008] Step 2: Construct the traffic road graph into a graph structure, where nodes represent road sections and edges represent the connection relationship between road sections, and construct the node feature matrix X and adjacency matrix A;

[0009] Step 3: Use the node feature matrix X and the adjacency matrix A as the input of the graph attention network GAT to update and aggregate the features. Dynamically assign different weights to neighbor nodes through the attention mechanism to extract the spatial features of the nodes, and finally obtain the updated node feature matrix H.

[0010] Step 4: The obtained feature matrix H is used as input to construct a model combining an improved Pied Kingfisher optimization algorithm PKO and an extreme learning machine ELM, namely, a PKO-ELM model for traffic flow prediction. The improved Pied Kingfisher optimization algorithm PKO adopts a reverse learning strategy for population initialization.

[0011] Furthermore, the specific method of the pretreatment in step 1 is:

[0012] Step 1.1: Collect and determine real-time and historical traffic flow data sets, and use traffic sensors and electronic maps to obtain traffic data sets of traffic network sections. The data sets include the traffic flow F of the section, the average speed and density D;

[0013] Step 1.2: Calculate the congestion index C of the road section. The congestion index C can be calculated based on the traffic volume F and the average speed. The calculation formula is as follows:

[0014]

[0015] Among them, F is the traffic volume of the road section, C road is the road capacity, that is, the maximum flow that the road can carry under ideal conditions. is the average speed of vehicles on the road section, V f is the free flow speed, which is the average speed of vehicles traveling without congestion;

[0016] Step 1.3: Data preprocessing includes filling missing values, exponential smoothing data, and normalizing data;

[0017] Step 1.4: Fill in missing values ​​Use interpolation to handle missing values ​​in the data. By using the relationship between known data points to estimate missing values, ensure the integrity and continuity of the data; use exponential smoothing techniques to smooth the data and reduce noise; use the maximum-minimum normalization method to scale the eigenvalues ​​to a fixed range between 0 and 1 for data normalization.

[0018] Furthermore, the specific method of step 2 is:

[0019] Step 2.1: Create a graph structure, with each road segment as a node in the graph. If there is a road connection between two nodes, an edge is created between the two nodes. The graph structure is represented by G(V,E), where V represents the set of road segments (l1,l2,...l N ), where l N represents the Nth road section, N is the total number of road sections, and E represents the connection relationship of the road sections;

[0020] Step 2.2: Define node features x, including the characteristics of each road segment, including traffic flow F, average speed density D and congestion index C;

[0021] Step 2.3: Node feature vector x of road segment i i It is expressed as: Among them, F i is the actual traffic volume on road section i, is the average speed of vehicles on road section i, and the density D of road section i i , the congestion index C of road section i i , i ranges from 1 to N, and τ is the vector transpose;

[0022] Step 2.4: Get the node feature matrix X of all road sections as follows:

[0023] Step 2.5: The adjacency matrix A describes the proximity relationship between road segment i and road segment j, and is calculated using the Gaussian function of the distance. The formula is as follows:

[0024]

[0025] Among them, d ij represents the Euclidean distance between segment i and segment j, σ represents the standard deviation parameter, and d max Indicates the maximum distance between road segments;

[0026] Step 2.6: Get the adjacency matrix A:

[0027] Furthermore, the specific method of step 3 is:

[0028] Step 3.1: Initialization: Set the initial node feature matrix H (0) =X and adjacency matrix A, where X∈R N×Z , N is the total number of road sections, Z is the characteristic dimension of each road section node, and represents the four characteristic traffic flows F of each road section node i , average speed Density D i and congestion index C i ; Adjacency matrix A∈R N×N Indicates the connection relationship between road segment nodes;

[0029] Step 3.2: Feature dimension transformation: For each road segment node i, a high-dimensional representation is generated for each node through a linear transformation. For the node feature vector x of road segment i, i , whose characteristic transformation is expressed as W·x i , where W is a weight matrix used to obtain stronger feature representation;

[0030] Step 3.3: Calculate the attention coefficient: For each road segment node i and its neighboring road segment node j, calculate the attention coefficient e ij , the calculation formula is as follows:

[0031] e ij =LeakyReLU(a Τ [W·x i ||W·x j ])

[0032] Among them, a T is a learnable parameter of the attention mechanism, || represents the vector concatenation operation, and LeakyReLU is an improved rectified linear unit that is used to solve the problem that the standard ReLU outputs zero when the input value is negative;

[0033] Step 3.4: Normalize the attention coefficient: Use the softmax function for normalization, and the calculation formula is as follows:

[0034]

[0035] Among them, N (i) is the set of neighbor nodes of road segment node i;

[0036] Step 3.5: Aggregate features: According to the normalized attention coefficient in step 3.4, a multi-head attention mechanism is used to aggregate the features of the neighboring nodes of each target node to obtain the final node feature vector h i , the calculation formula is as follows:

[0037]

[0038] Among them, σ(·) is the ReLU activation function, k represents the number of layers of the attention network, represents the normalized attention coefficient calculated by the vth attention mechanism, W v is the corresponding weight matrix;

[0039] Step 3.6: Generate a new node feature matrix: Repeat steps 3.2 to 3.5, and combine the new features of all road segment nodes N into a new node feature matrix H through a k-layer attention network, H = (h1 h2…h i …h N ) τ , which is the node feature representation after GAT processing.

[0040] Furthermore, the specific method of step 4 is:

[0041] Step 4.1: Initialize the basic parameters of the PKO algorithm, set the population size M, the number of iterations B, and the dimension Dim of the problem;

[0042] Step 4.2: Population initialization. PKO randomly generates a population of N individuals through the search space. Each individual X represents a set of weights w and biases b. The equation for generating the initial population is as follows:

[0043] w i =(UB w -LB w )×rand+LB w

[0044] b i =(UB b -LB b )×rand+LB b

[0045] Among them, i refers to the i-th individual, w i 、b i represents the weight and bias of the i-th individual, rand is a random number uniformly distributed in the interval [0,1], UB w and LB w is the upper and lower bound of the weight w, UB b and LB b are the upper and lower bounds of the bias b;

[0046] Step 4.3: Calculate the output of the ELM hidden layer, using the i-th individual X i The weight w i and bias b i To configure ELM, the output matrix O of the hidden layer is calculated by the activation function. The calculation formula is as follows:

[0047] O=σ(Hw i +b i )

[0048] Where σ(·) is the Sigmoid activation function, H is the node feature representation after GAT processing in step 3.6, and w i 、b i represents the weight and bias of the i-th individual;

[0049] Step 4.4: Calculate the weight matrix W of the ELM output layer o , according to the mathematical knowledge of Moore-Penrose generalized inverse matrix, solve the generalized matrix W o , the calculation formula is as follows:

[0050] W o =(O τ O) -1 O τ t

[0051] Among them, (O Τ O) -1 O τ is the Moore-Penrose generalized inverse matrix of matrix O, O τ is the transpose of the matrix O, (O τ O) -1 Yes τ The inverse matrix of O, t is the sample label;

[0052] Step 4.5: Calculate the predicted output The calculation formula is as follows:

[0053] Step 4.6: Calculate the fitness value, use the mean square error MSE as the objective function, and calculate the prediction error as the fitness value;

[0054] Step 4.7: For individual X in the population i , calculate its corresponding inverse solution X i ', the calculation formula is as follows:

[0055] w i '=(UB w +LB w )×rand-w i

[0056] b i '=(UB b +LB b )×rand-b i

[0057] Among them, w i ', b i ' represents the weight and bias of the reverse solution of the i-th individual, rand is a random number uniformly distributed in the interval [0,1], UB w and LB w is the upper and lower bound of the weight w, UB b and LB b are the upper and lower bounds of the bias b;

[0058] Step 4.8: Calculate the fitness values ​​of the original individual and its reverse solution, repeat steps 4.2 to 4.6, and update the Q solution with a lower fitness value as the final initial population;

[0059] Step 4.9: For each individual of the initial population Q, execute the three stages of the PKO algorithm, including the exploration stage, the development stage, and the local escape stage;

[0060] Step 4.10: Exploration phase, used to simulate the behavior of the Pied Kingfisher in searching for potential prey, and to find the optimal solution by changing the position of the current solution. The update formula for the current position is:

[0061] X i (t+1)=X i (t)+α*T×(X j (t)-X i (t)),i,j=1,2,…N and j≠i

[0062] α=2*randn(1,Dim)-1

[0063] Among them, X i (t) is the position of the current individual at iteration t, X i(t+1) is the position of the next iteration, α is the step size parameter, which is calculated as 2×randn(1,Dim)-1, randn(1,Dim) represents a random number drawn from a normal distribution, and T is a dynamically determined parameter whose value is determined by the current strategy. The current strategy is the perching strategy or the hovering strategy:

[0064] The calculation formula of the habitat strategy T parameter is as follows:

[0065]

[0066] Crest_angles = 2*pi*rand

[0067] Among them, Max_Iter is the maximum number of iterations, pi represents pi, and the constant value BF is set to 8;

[0068] The calculation formula of the hover strategy T parameter is as follows:

[0069]

[0070] Among them, PKO_Fitness(j) and PKO_Fitness(i) represent the fitness values ​​of the i-th and j-th kingfishers, respectively, and the constant value BF is set to 8;

[0071] Step 4.11: In the development phase, the feasible solution found is further improved through local search. The position update calculation formula is as follows:

[0072] X i (t+1)=X i (t)+HA*U*α*(bX best (t)),i=1,2,…N

[0073]

[0074] b=X i (t)+U 2 *randn*X best (t)

[0075] Among them, X i (t) is the position of the current individual at iteration t, X i (t+1) is the position of the next iteration, α is the step size parameter, b is the fitness influencing parameter, Max_Iter is the maximum number of iterations, Best_Fitness is the best fitness value obtained in all iterations, X best (t) represents the best position of all individuals in the current iteration;

[0076] Step 4.12: Local escape phase, promote information sharing in the population and avoid premature convergence. The position update formula is as follows:

[0077]

[0078] Among them, 2 individuals are randomly selected from the population, and their positions are represented by X. m (t) and X n (t) represents, abs() represents the absolute value function, PE represents the predation efficiency of kingfisher, PE MAX Indicates the maximum permissible value of the perception error during the iteration process, PE max and PE min It is expressed as the maximum and minimum values ​​of predation efficiency, which are 0.5 and 0 respectively;

[0079] Step 4.13: Perform iterative update, repeat step 4.9 to update the position of each individual, repeat step 4.6 to calculate the fitness value, and update and retain individuals with low fitness values ​​until the iteration ends;

[0080] Step 4.14: After the iteration is completed, the individual with the lowest fitness value is selected as the optimal w and b;

[0081] Step 4.15: Configure the optimal w and b into the ELM model to predict traffic flow;

[0082] Step 4.16: Display the prediction results to the user through a visual map.

[0083] The present invention adopts the above technical solution and has the following beneficial effects:

[0084] 1. Use the graph attention network (GAT) to capture the complex dependencies in the traffic network. By introducing the attention mechanism, GAT can automatically learn and weight these dependencies, so that the model can more accurately capture the interactions between nodes in the traffic network, and can more accurately model the dynamic characteristics of traffic flow and improve prediction accuracy.

[0085] 2. Use the PKO algorithm to optimize the weights w and bias b in the ELM model so that the model can achieve better performance on a given data set. This optimization strategy can help avoid overfitting problems and find a more robust and generalizable model configuration.

[0086] 3. Using the reverse learning strategy to initialize the population can speed up the convergence and increase the diversity of the population, which helps to explore a wider solution space and improve the global search efficiency.

[0087] 4. In the POK-ELM algorithm, through the design of exploration, development and local escape stages, effective exploration and utilization of the solution space is achieved. Such a design is not only conducive to the discovery of high-quality solutions, but also avoids the problem of premature convergence, ensuring the flexibility and stability of the algorithm in the process of finding the optimal solution.

[0088] 5. Combining the powerful processing capabilities of GAT for graph-structured data and the advantages of ELM's fast training, this method can effectively cope with the large-scale processing needs of real-time and historical traffic flow data while maintaining high computational efficiency.

[0089] 6. By comprehensively applying advanced machine learning techniques, this method aims to provide more accurate traffic flow prediction results, which is of great significance for urban traffic management and planning. For example, it can be used to optimize application scenarios such as traffic light control, route navigation, and emergency response. BRIEF DESCRIPTION OF THE DRAWINGS

[0090] Figure 1 The overall flow chart of the prediction model based on GAT and improved PKO-ELM;

[0091] Figure 2 The overall structure diagram of the prediction model based on GAT and improved PKO-ELM;

[0092] Figure 3 Construct a graph structure process diagram for the city road map;

[0093] Figure 4 Flowchart for improving the PKO-ELM algorithm. DETAILED DESCRIPTION

[0094] The present invention is further explained below in conjunction with specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention. After reading the present invention, various equivalent forms of modifications to the present invention by those skilled in the art all fall within the scope defined by the claims attached to this application.

[0095] Step 1: Collect and determine real-time and historical traffic flow data sets, including the traffic volume F and average speed of the road section And density D, as well as calculating the congestion index C, and preprocessing the data:

[0096] Step 1.1: Collect and determine real-time and historical traffic flow data sets, and use traffic sensors and electronic maps to obtain traffic data sets of traffic network sections. The data sets include the traffic flow F of the section, the average speed and density D.

[0097] Step 1.2: Calculate the congestion index C of the road section. The congestion index C can be calculated based on the traffic volume F and the average speed. The calculation formula is as follows:

[0098]

[0099] Among them, F is the actual traffic volume of the road, C road is the road capacity, that is, the maximum flow that the road can carry under ideal conditions. is the average speed of vehicles on the road section, V f It is the free flow speed, which is the average speed of vehicles traveling in the absence of congestion.

[0100] Step 1.3: Data preprocessing includes filling missing values, exponential smoothing data, and normalizing data. Use interpolation to handle missing values ​​in the data; use exponential smoothing technology to smooth the data and reduce noise; use the maximum-minimum normalization method to unify all numerical features from step 1.1 to step 1.2 to the same scale range.

[0101] Step 2: Construct the traffic road graph into a graph structure, where nodes represent road sections and edges represent the connection relationship between road sections. Construct the node feature matrix X and adjacency matrix A. Figure 3 As shown:

[0102] Step 2.1: Create a graph structure, with each road segment as a node in the graph. If there is a road connection between two nodes, an edge is created between the two nodes. The graph structure is represented by G(V,E), where V represents the set of road segments (l1,l2,...l N ), where l N represents the Nth road segment, and E represents the connection relationship of the road segments.

[0103] Step 2.2: Define node features x, including the characteristics of each road segment, including traffic flow F, average speed Density D and congestion index C.

[0104] Step 2.3: Node feature vector x of road segment i i It is expressed as: Among them, F i is the actual traffic volume on road section i, is the average speed of vehicles on road section i, and the density D of road section i i , the congestion index C of road section i i , i ranges from 1 to N, and τ is the vector transpose.

[0105] Step 2.4: Get the node feature matrix X of all road sections as follows: Where N is the total number of road sections.

[0106] Step 2.5: The adjacency matrix A describes the proximity relationship between road segment i and road segment j, and is calculated using the Gaussian function of the distance. The formula is as follows:

[0107]

[0108] Among them, d ij represents the Euclidean distance between road segment i and road segment j, σ represents the standard deviation parameter, and d max Indicates the maximum distance between road segments.

[0109] Step 2.6: Get the adjacency matrix A:

[0110] Step 3: Use the node feature matrix X and the adjacency matrix A as the input of the graph attention network GAT to update and aggregate the features. Dynamically assign different weights to neighbor nodes through the attention mechanism to extract the spatial features of the nodes, and finally obtain the updated node feature matrix H:

[0111] Step 3.1: Initialization: Set the initial node feature matrix H (0) =X and adjacency matrix A, where X∈R N×Z , N is the total number of road sections, Z is the characteristic dimension of each road section node, and represents the four characteristic traffic flows F of each road section node i , average speed Density D i and congestion index C i ; Adjacency matrix A∈R N×N Represents the connection relationship between road segment nodes.

[0112] Step 3.2: Feature dimension transformation: For each road segment node i, a high-dimensional representation is generated for each node through a linear transformation. For the node feature vector x of road segment i, i , whose characteristic transformation is expressed as W·x i , where W is a weight matrix used to obtain stronger feature representation.

[0113] Step 3.3: Calculate the attention coefficient: For each road segment node i and its neighboring road segment node j, calculate the attention coefficient e ij , the calculation formula is as follows:

[0114] e ij =LeakyReLU(a Τ [W·x i ||W·x j ])

[0115] Among them, a Tis a learnable parameter of the attention mechanism, || represents the vector concatenation operation, and LeakyReLU is an improved rectified linear unit that is used to solve the problem that the standard ReLU outputs zero when the input value is negative.

[0116] Step 3.4: Normalize the attention coefficient: Use the softmax function for normalization, and the calculation formula is as follows:

[0117]

[0118] Among them, N (i) is the set of neighbor nodes of road segment node i.

[0119] Step 3.5: Aggregate features: According to the normalized attention coefficient in step 3.4, a multi-head attention mechanism is used to aggregate the features of the neighboring nodes of each target node to obtain the final node feature vector h i , the calculation formula is as follows:

[0120]

[0121] Among them, σ(·) is the ReLU activation function, k represents the number of layers of the attention network, represents the normalized attention coefficient calculated by the vth attention mechanism, W v is the corresponding weight matrix.

[0122] Step 3.6: Generate a new node feature matrix: Repeat steps 3.2 to 3.5, and combine the new features of all road segment nodes N into a new node feature matrix H through a k-layer attention network, H = (h1 h2…h i …h N ) τ , which is the node feature representation after GAT processing.

[0123] Step 4: Take the feature matrix H obtained from the graph attention network GAT as input and construct a model combining the improved Pied Kingfisher Optimization Algorithm PKO and the Extreme Learning Machine ELM, namely the PKO-ELM model for traffic flow prediction. Figure 4 As shown:

[0124] Step 4.1: Initialize the basic parameters of the PKO algorithm, set the population size M, the number of iterations B, and the dimension Dim of the problem.

[0125] Step 4.2: Population initialization. PKO randomly generates a population of N individuals through the search space. Each individual X represents a set of weights w and biases b. The equation for generating the initial population is as follows:

[0126] w i =(UBw -LB w )×rand+LB w

[0127] b i =(UB b -LB b )×rand+LB b

[0128] Among them, i refers to the i-th individual, w i , b i represents the weight and bias of the i-th individual, rand is a random number uniformly distributed in the interval [0,1], UB w and LB w is the upper and lower bound of the weight w, UB b and LB b are the upper and lower bounds of the bias b.

[0129] Step 4.3: Calculate the output of the ELM hidden layer, using the i-th individual X i The weight w i and bias b i To configure ELM, the output matrix O of the hidden layer is calculated by the activation function. The calculation formula is as follows:

[0130] O=σ(Hw i +b i )

[0131] Where σ(·) is the Sigmoid activation function, H is the node feature representation after GAT processing in step 3.6, and w i , b i represents the weight and bias of the i-th individual.

[0132] Step 4.4: Calculate the weight matrix W of the ELM output layer o , according to the mathematical knowledge of Moore-Penrose generalized inverse matrix, solve the generalized matrix W o , the calculation formula is as follows:

[0133] W o =(O τ O) -1 O τ t

[0134] Among them, (O Τ O) -1 O τ is the Moore-Penrose generalized inverse matrix of matrix O, O τ is the transpose of the matrix O, (O τ O) -1 Yes τThe inverse matrix of O, t is the sample label.

[0135] Step 4.5: Calculate the predicted output The calculation formula is as follows:

[0136] Step 4.6: Calculate the fitness value, use mean square error MSE as the objective function, and calculate the prediction error as the fitness value.

[0137] Step 4.7: For individual X in the population i , calculate its corresponding inverse solution X i ', the calculation formula is as follows:

[0138] w i '=(UB w +LB w )×rand-w i

[0139] b i '=(UB b +LB b )×rand-b i

[0140] Among them, w i ', b i ' represents the weight and bias of the reverse solution of the i-th individual, rand is a random number uniformly distributed in the interval [0,1], UB w and LB w is the upper and lower bound of the weight w, UB b and LB b are the upper and lower bounds of the bias b.

[0141] Step 4.8: Calculate the fitness values ​​of the original individual and its reverse solution, repeat steps 4.2 to 4.6, and update the Q solution with a lower fitness value as the final initial population.

[0142] Step 4.9: For each individual of the initial population Q, execute the three stages of the PKO algorithm, including the exploration stage, the development stage, and the local escape stage.

[0143] Step 4.10: Exploration phase, used to simulate the behavior of the Pied Kingfisher in searching for potential prey, and to find the optimal solution by changing the position of the current solution. The update formula for the current position is:

[0144] X i (t+1)=X i (t)+α*T×(X j (t)-X i (t)),i,j=1,2,…N and j≠i

[0145] α=2*randn(1,Dim)-1

[0146] Among them, X i (t) is the position of the current individual at iteration t, X i (t+1) is the position of the next iteration, α is the step size parameter, which is calculated as 2×randn(1,Dim)-1, randn(1,Dim) represents a random number drawn from a normal distribution, and T is a dynamically determined parameter whose value is determined according to the currently used strategy, which is either the perching strategy or the hovering strategy.

[0147] The calculation formula of the habitat strategy T parameter is as follows:

[0148]

[0149] Crest_angles = 2*pi*rand

[0150] Among them, Max_Iter is the maximum number of iterations, pi represents pi, and the constant value BF is set to 8;

[0151] The calculation formula of the hover strategy T parameter is as follows:

[0152]

[0153] Among them, PKO_Fitness(j) and PKO_Fitness(i) represent the fitness values ​​of the i-th and j-th kingfishers respectively, and the constant value BF is set to 8.

[0154] Step 4.11: In the development phase, the feasible solution found is further improved through local search. The position update calculation formula is as follows:

[0155] X i (t+1)=X i (t)+HA*U*α*(bX best (t)),i=1,2,…N

[0156]

[0157] b=X i (t)+U 2 *randn*X best (t)

[0158] Among them, α is the step size parameter, b represents the fitness influencing parameter, Best_Fitness represents the best fitness value obtained in all iterations, and X best (t) represents the best position of all individuals in the current iteration.

[0159] Step 4.12: Local escape phase, promote information sharing in the population and avoid premature convergence. The position update formula is as follows:

[0160]

[0161] Among them, 2 individuals are randomly selected from the population, and their positions are represented by X. m (t) and X n (t) represents, abs() represents the absolute value function, PE represents the predation efficiency of kingfisher, where PE MAX Indicates the maximum permissible value of the perception error during the iteration process, PE max and PE min Expressed as the maximum and minimum values ​​of predation efficiency, which are 0.5 and 0 respectively.

[0162] Step 4.13: Perform iterative update, repeat step 4.9 to update the position of each individual, repeat step 4.6 to calculate the fitness value, update and retain individuals with low fitness values ​​until the iteration ends.

[0163] Step 4.14: After the iteration is completed, the individual with the lowest fitness value is selected as the optimal w and b.

[0164] Step 4.15: Configure the optimal w and b into the ELM model, predict the traffic flow, and visualize it through an interactive map.

[0165] The interactive map can intuitively display the forecast results of traffic flow, speed, density and other information in the future, and allow users to interact; the indicators for evaluating the forecast results include MAE, RMSE and MAPE, and the calculation formula is as follows:

[0166]

[0167] The present invention creatively proposes a traffic flow prediction method based on GAT and improved PKO-ELM algorithm, which can be applied to a variety of scenarios to improve the management ability and efficiency of urban transportation systems. For example, in an intelligent traffic signal control system, this method can dynamically adjust the duration of traffic lights according to changes in traffic flow in the future, effectively alleviating congestion on urban main roads and intersections; in a real-time traffic information release system, it provides drivers with instant road condition information through mobile phone applications or in-vehicle navigation, helping pedestrians choose the best route during daily commuting or holiday travel peaks; in addition, in emergency response and disaster management, this prediction method can quickly evaluate after an emergency occurs, and predict changes in traffic conditions in affected areas, assist emergency departments in formulating evacuation plans and resource allocation plans, and improve the efficiency of responding to natural disasters or major accidents. These application scenarios demonstrate the important role of this technology in optimizing urban traffic management and improving public safety.

Claims

1. A traffic flow prediction method based on GAT and improved PKO-ELM algorithm, characterized in that: The steps include: Step 1: Collect and determine real-time and historical traffic flow data sets, including the traffic volume F and average speed of the road section and density D, as well as calculating the congestion index C, and preprocessing the data; Step 2: Construct the traffic road graph into a graph structure, where nodes represent road sections and edges represent the connection relationship between road sections, and construct the node feature matrix X and adjacency matrix A; Step 3: Use the node feature matrix X and the adjacency matrix A as the input of the graph attention network GAT to update and aggregate the features. Dynamically assign different weights to neighbor nodes through the attention mechanism to extract the spatial features of the nodes, and finally obtain the updated node feature matrix H. Step 4: The obtained feature matrix H is used as input to construct a model combining an improved Pied Kingfisher optimization algorithm PKO and an extreme learning machine ELM, namely, a PKO-ELM model for traffic flow prediction. The improved Pied Kingfisher optimization algorithm PKO adopts a reverse learning strategy for population initialization.

2. The traffic flow prediction method based on GAT and improved PKO-ELM algorithm according to claim 1, characterized in that: The specific method of the pretreatment in step 1 is: Step 1.1: Collect and determine real-time and historical traffic flow data sets, and use traffic sensors and electronic maps to obtain traffic data sets of traffic network sections. The data sets include the traffic flow F of the section, the average speed and density D; Step 1.2: Calculate the congestion index C of the road section. The congestion index C can be calculated based on the traffic volume F and the average speed. The calculation formula is as follows: Among them, F is the traffic volume of the road section, C road is the road capacity, that is, the maximum flow that the road can carry under ideal conditions. is the average speed of vehicles on the road section, V f is the free flow speed, which is the average speed of vehicles traveling without congestion; Step 1.3: Data preprocessing includes filling missing values, exponential smoothing data, and normalizing data; Step 1.4: Fill in missing values ​​Use interpolation to handle missing values ​​in the data. By using the relationship between known data points to estimate missing values, ensure the integrity and continuity of the data; use exponential smoothing techniques to smooth the data and reduce noise; use the maximum-minimum normalization method to scale the eigenvalues ​​to a fixed range between 0 and 1 for data normalization.

3. The traffic flow prediction method based on GAT and improved PKO-ELM algorithm according to claim 1, characterized in that: The specific method of step 2 is: Step 2.1: Create a graph structure, with each road segment as a node in the graph. If there is a road connection between two nodes, an edge is created between the two nodes. The graph structure is represented by G(V,E), where V represents the set of road segments (l1,l2,...l N ), where l N represents the Nth road section, N is the total number of road sections, and E represents the connection relationship of the road sections; Step 2.2: Define node features x, including the characteristics of each road segment, including traffic flow F, average speed density D and congestion index C; Step 2.3: Node feature vector x of road segment i i It is expressed as: Among them, F i is the actual traffic volume on road section i, is the average speed of vehicles on road section i, and the density D of road section i i , the congestion index C of road section i i , i ranges from 1 to N, and τ is the vector transpose; Step 2.4: Get the node feature matrix X of all road sections as follows: Step 2.5: The adjacency matrix A describes the proximity relationship between road segment i and road segment j, and is calculated using the Gaussian function of the distance. The formula is as follows: i and j are both 1 to N; Among them, d ij represents the Euclidean distance between road segment i and road segment j, σ represents the standard deviation parameter, and d max Indicates the maximum distance between road segments; Step 2.6: Get the adjacency matrix A:

4. The traffic flow prediction method based on GAT and improved PKO-ELM algorithm according to claim 1, characterized in that: The specific method of step 3 is: Step 3.1: Initialization: Set the initial node feature matrix H (0) =X and adjacency matrix A, where X∈R N×Z , N is the total number of road sections, Z is the characteristic dimension of each road section node, and represents the four characteristic traffic flows F of each road section node i , average speed Density D i and congestion index C i ; Adjacency matrix A∈R N×N Indicates the connection relationship between road segment nodes; Step 3.2: Feature dimension transformation: For each road segment node i, a high-dimensional representation is generated for each node through a linear transformation. For the node feature vector x of road segment i, i , whose characteristic transformation is expressed as W·x i , where W is a weight matrix used to obtain stronger feature representation; Step 3.3: Calculate the attention coefficient: For each road segment node i and its neighboring road segment node j, calculate the attention coefficient e ij , the calculation formula is as follows: and ij =LeakyReLU(a Τ [W x i ||W x j ]) Among them, a T is a learnable parameter of the attention mechanism, || represents the vector concatenation operation, and LeakyReLU is an improved rectified linear unit that is used to solve the problem that the standard ReLU outputs zero when the input value is negative; Step 3.4: Normalize the attention coefficient: Use the softmax function for normalization, and the calculation formula is as follows: Among them, N (i) is the set of neighbor nodes of road segment node i; Step 3.5: Aggregate features: According to the normalized attention coefficient in step 3.4, a multi-head attention mechanism is used to aggregate the features of the neighboring nodes of each target node to obtain the final node feature vector h i , the calculation formula is as follows: Among them, σ(·) is the ReLU activation function, k represents the number of layers of the attention network, represents the normalized attention coefficient calculated by the vth attention mechanism, W v is the corresponding weight matrix; Step 3.6: Generate a new node feature matrix: Repeat steps 3.2 to 3.5, and combine the new features of all road segment nodes N into a new node feature matrix H through a k-layer attention network, H = (h1 h2…h i …h N ) τ , which is the node feature representation after GAT processing.

5. The traffic flow prediction method based on GAT and improved PKO-ELM algorithm according to claim 1, characterized in that: The specific method of step 4 is: Step 4.1: Initialize the basic parameters of the PKO algorithm, set the population size M, the number of iterations B, and the dimension Dim of the problem; Step 4.2: Population initialization. PKO randomly generates a population of N individuals through the search space. Each individual X represents a set of weights w and biases b. The equation for generating the initial population is as follows: w i =(UB w -LB w )×rand+LB w b i =(UB b -LB b )×rand+LB b Among them, i refers to the i-th individual, w i 、b i represents the weight and bias of the i-th individual, rand is a random number uniformly distributed in the interval [0,1], UB w and LB w is the upper and lower bound of the weight w, UB b and LB b are the upper and lower bounds of the bias b; Step 4.3: Calculate the output of the ELM hidden layer, using the i-th individual X i The weight w i and bias b i To configure ELM, the output matrix O of the hidden layer is calculated by the activation function. The calculation formula is as follows: The=σ(Hw i +b i ) Where σ(·) is the Sigmoid activation function, H is the node feature representation after GAT processing in step 3.6, and w i 、b i represents the weight and bias of the i-th individual; Step 4.4: Calculate the weight matrix W of the ELM output layer o , according to the mathematical knowledge of Moore-Penrose generalized inverse matrix, solve the generalized matrix W o , the calculation formula is as follows: W o =(O τ O) -1 O τ t Among them, (O Τ O) -1 O τ is the Moore-Penrose generalized inverse matrix of matrix O, O τ is the transpose of the matrix O, (O τ O) -1 Yes τ The inverse matrix of O, t is the sample label; Step 4.5: Calculate the predicted output The calculation formula is as follows: Step 4.6: Calculate the fitness value, use the mean square error MSE as the objective function, and calculate the prediction error as the fitness value; Step 4.7: For individual X in the population i , calculate its corresponding inverse solution X i ', the calculation formula is as follows: w i '=(UB w +LB w )×rand-w i b i '=(UB b +LB b )×rand-b i Among them, w i ', b i ' represents the weight and bias of the reverse solution of the i-th individual, rand is a random number uniformly distributed in the interval [0,1], UB w and LB w is the upper and lower bound of the weight w, UB b and LB b are the upper and lower bounds of the bias b; Step 4.8: Calculate the fitness values ​​of the original individual and its reverse solution, repeat steps 4.2 to 4.6, and update the Q solution with a lower fitness value as the final initial population; Step 4.9: For each individual of the initial population Q, execute the three stages of the PKO algorithm, including the exploration stage, the development stage, and the local escape stage; Step 4.10: Exploration phase, used to simulate the behavior of the Pied Kingfisher in searching for potential prey, and to find the optimal solution by changing the position of the current solution. The update formula for the current position is: X i (t+1)=X i (t)+α*T×(X j (t)-X i (t)),i,j=1,2,...N and j≠i α=2*randn(1,Dim)-1 Among them, X i (t) is the position of the current individual at iteration t, X i (t+1) is the position of the next iteration, α is the step size parameter, which is calculated as 2×randn(1,Dim)-1, randn(1,Dim) represents a random number drawn from a normal distribution, and T is a dynamically determined parameter whose value is determined by the current strategy. The current strategy is the perching strategy or the hovering strategy: The calculation formula of the habitat strategy T parameter is as follows: Crest_angles = 2*pi*rand Among them, Max_Iter is the maximum number of iterations, pi represents pi, and the constant value BF is set to 8; The calculation formula of the hover strategy T parameter is as follows: Among them, PKO_Fitness(j) and PKO_Fitness(i) represent the fitness values ​​of the i-th and j-th kingfishers, respectively, and the constant value BF is set to 8; Step 4.11: In the development phase, the feasible solution found is further improved through local search. The position update calculation formula is as follows: X i (t+1)=X i (t)+HA*U*α*(b-X best (t)),i=1,2,...N b=X i (t)+U 2 *randn*X best (t) Among them, X i (t) is the position of the current individual at iteration t, X i (t+1) is the position of the next iteration, α is the step size parameter, b is the fitness influencing parameter, Max_Iter is the maximum number of iterations, Best_Fitness is the best fitness value obtained in all iterations, X best (t) represents the best position of all individuals in the current iteration; Step 4.12: Local escape phase, promote information sharing in the population and avoid premature convergence. The position update formula is as follows: Among them, 2 individuals are randomly selected from the population, and their positions are represented by X. m (t) and X n (t) represents, abs() represents the absolute value function, PE represents the predation efficiency of kingfisher, PE MAX Indicates the maximum permissible value of the perception error during the iteration process, PE max and PE min It is expressed as the maximum and minimum values ​​of predation efficiency, which are 0.5 and 0 respectively; Step 4.13: Perform iterative update, repeat step 4.9 to update the position of each individual, repeat step 4.6 to calculate the fitness value, and update and retain individuals with low fitness values ​​until the iteration ends; Step 4.14: After the iteration is completed, the individual with the lowest fitness value is selected as the optimal w and b; Step 4.15: Configure the optimal w and b into the ELM model to predict traffic flow; Step 4.16: Display the prediction results to the user through a visual map.

Citation Information

Patent Citations

  • Short-term traffic flow prediction model based on firework differential evolution hybrid algorithm-extreme learning machine

    CN112115754A

  • Method and device for predicting traffic flow based on extreme learning machine model, and electronic equipment

    CN116579477A

  • AU2020102350A4