A method, device and medium for predicting highway traffic
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SICHUAN HIGHWAY PLANNING SURVEY DESIGN AND RESEARCH INSTITUTE LTD
- Filing Date
- 2026-06-01
- Publication Date
- 2026-08-04
AI Technical Summary
[0005]本发明的目的是提供一种高速公路流量预测方法、设备和介质,解决了现有技术因无法寻找出最优超参数而带来的车辆流量的预测精度不足的问题
[0048] 1. In the technical solution provided by this invention, an optimized particle swarm optimization (PSO) algorithm is used to optimize the hyperparameters of a bidirectional long short-term memory (LSTM) neural network. This addresses the shortcomings of the PSO algorithm, such as immature convergence and susceptibility to local optima in the later stages of the search. This invention employs a pre-processing Sobol global sensitivity analysis to quantify the impact of each hyperparameter on network performance, reducing the search space for low-sensitivity hyperparameters and significantly decreasing ineffective searches. A multi-dimensional adaptive optimization mechanism concentrates computational resources on the hyperparameters with the greatest impact on performance, significantly shortening the optimization time. The sensitivity-weighted velocity update formula makes particles more inclined to move towards the optimal direction of high-sensitivity parameters, effectively avoiding getting trapped in local optima.
Smart Images

Figure CN122511099A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic flow prediction technology, and more specifically, to a method, device, and medium for predicting highway traffic flow. Background Technology
[0002] With the rapid development of the social economy and the gradual popularization of family cars, people are traveling between cities more frequently, and the number of vehicles on highways is also increasing. Effectively grasping the overall changing trends of highway traffic is a necessary prerequisite for effective highway operation management and preventing traffic congestion; at the same time, a comprehensive understanding of vehicle flow trends between cities is conducive to improving urban traffic management and enhancing the city's overall reception capacity and service level.
[0003] Currently, the common method for predicting traffic flow on roads is to train a bidirectional long short-term memory (LSTM) neural network (BSN) using historical traffic flow data. After training, the model outputs a prediction model capable of forecasting traffic flow. The BSN consists of two LSMs connected in reverse parallel. One LSM receives input from past information, while the other receives input from future information. Based on this, the BSN can simultaneously mine temporal information from both the past and future periods, thus enabling traffic flow prediction. However, the structural parameters of the BSN require manual adjustment based on experience. Improper adjustment directly affects the network's feature extraction capabilities, reducing the model's prediction accuracy and failing to achieve the desired predictive results.
[0004] Current technologies use particle swarm optimization to optimize the hyperparameters of bidirectional long short-term memory neural networks. However, as the number of local extrema increases, the algorithm is prone to local optima and non-convergence in the later stages of the search, making it impossible to find the optimal hyperparameters and resulting in insufficient prediction accuracy of highway traffic flow. Summary of the Invention
[0005] The purpose of this invention is to provide a method, device, and medium for predicting highway traffic flow, which solves the problem of insufficient prediction accuracy of vehicle traffic flow caused by the inability to find the optimal hyperparameter in existing technologies.
[0006] The above-mentioned technical objective of the present invention is achieved through the following technical solution:
[0007] A first aspect of the present invention provides a method for predicting highway traffic flow, the method comprising:
[0008] Acquire the first historical traffic flow data of the highway cross-section location, and the second historical traffic flow data of different types of interchanges intersecting with the cross-section location;
[0009] Adaptive mode decomposition is performed on the first historical traffic flow data to obtain multiple first mode components;
[0010] The dynamic nonlinear correlation coefficient between the first historical traffic flow data and the second historical traffic flow data under the sliding time window is calculated based on the maximum information coefficient.
[0011] Multiple first mode components are weighted and fused with the dynamic nonlinear correlation coefficients at corresponding times to obtain multiple dynamic fused mode components;
[0012] A bidirectional long short-term memory neural network is constructed with the minimum mean square error as the optimization objective. A particle swarm optimization algorithm based on global sensitivity and adaptive convergence factor optimization of the Sobol sequence is used to adaptively optimize the hyperparameters of the bidirectional long short-term memory neural network. When the particle swarm optimization algorithm meets the iteration termination condition, the optimal hyperparameters are output and the initial hyperparameters of the bidirectional long short-term memory neural network are updated.
[0013] The updated bidirectional long short-term memory neural network is trained by multiple dynamic fusion modal components. At the end of the training, a traffic prediction model for highway traffic prediction is obtained.
[0014] Traffic flow is predicted on highways based on a traffic flow prediction model.
[0015] In one implementation, an adaptive variational mode decomposition algorithm is used to decompose the first historical traffic flow data into multiple scales to obtain multiple first mode components.
[0016] In one implementation, the dynamic nonlinear correlation coefficient between the first historical traffic flow data and the second historical traffic flow data under a sliding time window is calculated based on the maximum information coefficient, including:
[0017] Interchanges that intersect with the target section are classified into three types: hub interchanges, general interchanges, and service area interchanges. Second historical traffic flow data are obtained for each type of interchange.
[0018] Set the size and step of the sliding time window, and calculate the maximum information coefficient between the first historical traffic flow data of the target section and the second historical traffic flow data of each type of interchange within each sliding time window; wherein, the maximum information coefficient represents the degree of influence of the interchange on the traffic flow at the section location within the current time window;
[0019] The maximum information coefficient is normalized to obtain the dynamic nonlinear correlation coefficient.
[0020] In one implementation, multiple first mode components are weighted and fused with the dynamic nonlinear correlation coefficients at corresponding times to obtain multiple fused mode components, including:
[0021] The adaptive variational mode decomposition algorithm performs multi-scale decomposition on the second historical traffic flow data to obtain multiple second mode components;
[0022] The dynamic nonlinear correlation coefficient at each time step is multiplied by the second mode component at each time step, and then the multiplication result is added to the first mode component at each time step to obtain multiple dynamic fused mode components.
[0023] In one implementation, a particle swarm optimization algorithm based on global sensitivity and adaptive convergence factor optimization using Sobol sequences is employed, including:
[0024] Multiple uniformly distributed hyperparameter samples are generated within a predefined hyperparameter search space using Sobol sequences.
[0025] Each set of hyperparameter samples is used as a parameter of the bidirectional long short-term memory neural network, and the mean square error corresponding to each set of hyperparameter samples is calculated.
[0026] Calculate the sensitivity index of each hyperparameter sample to the mean square error, and classify the sensitivity level of the hyperparameters according to the sensitivity index.
[0027] Adjust the search space for each dimension based on the sensitivity level of the hyperparameters;
[0028] The function for calculating particle velocity is optimized based on the sensitivity index to obtain the optimized particle velocity function, and the particle velocity is updated using this function.
[0029] Calculate the population diversity of the particle population at the t-th iteration, and calculate the inertia weight based on the population diversity and the convergence factor;
[0030] In each iteration, the individual optimal position of each particle and the global optimal position of the particle population are updated.
[0031] The particles that meet the mutation probability are initialized, the mean square error of the particles is recalculated and compared with the mean square error of the previous moment, and the individual extreme value and the population extreme value of the particles are continuously updated.
[0032] Determine if the current iteration count meets the maximum iteration count. If it does, output the global optimal position. Otherwise, recalculate the mean square error of each particle until the maximum iteration count is met, and then output the global optimal position.
[0033] In one implementation, the sensitivity index of each set of hyperparameter samples to the mean square error is calculated, including:
[0034] The mean squared error is expressed as a function of a multidimensional hyperparameter vector, and the total variance of the function is calculated.
[0035] Two sets of N*D dimensional sample matrices, the first and the second, are generated using Sobol sequences; where N is the number of samples and D is the dimension of the hyperparameter to be optimized.
[0036] Select the i-th column of the first sample matrix and all columns other than the i-th column of the second sample matrix to construct D cross-sample matrices; where i is a positive integer;
[0037] Bidirectional long short-term memory neural networks are constructed using hyperparameter combinations in the first sample matrix and the cross sample matrix, respectively, and trained multiple times on the validation set. The average mean square error of the validation set after multiple training sessions is taken as the output vector of the first sample matrix and the cross sample matrix.
[0038] The sensitivity index is calculated based on the output vectors and total variance of the first sample matrix and the cross sample matrix.
[0039] In one implementation, the expression for the inertia weight is:
[0040] ;in, As the initial inertia weight, For the final inertia weight, The convergence factor is The maximum number of iterations, This is the adjustment coefficient.
[0041] In one implementation, the expression for the particle velocity function is:
[0042] ;in, Let be the inertia weight for the t-th iteration. Let be the velocity of the i-th particle in the t-th iteration. , The acceleration constant, , A random number in the range of 0-1. Let be the sensitivity index of the i-th hyperparameter. Let be the optimal position for the i-th particle. This represents the globally optimal position of the particle swarm.
[0043] A second aspect of the present invention provides an electronic device, including a memory and a processor;
[0044] A memory for storing computer programs, the computer programs including program instructions;
[0045] A processor for executing the program instructions to cause the electronic device to perform the steps of a highway traffic prediction method as provided in the first aspect.
[0046] A third aspect of the present invention provides a computer-readable storage medium comprising a computer program that, when executed by one or more processors, implements a highway traffic flow prediction method as provided in the first aspect.
[0047] Compared with the prior art, the present invention has the following beneficial effects:
[0048] 1. In the technical solution provided by this invention, an optimized particle swarm optimization (PSO) algorithm is used to optimize the hyperparameters of a bidirectional long short-term memory (LSTM) neural network. This addresses the shortcomings of the PSO algorithm, such as immature convergence and susceptibility to local optima in the later stages of the search. This invention employs a pre-processing Sobol global sensitivity analysis to quantify the impact of each hyperparameter on network performance, reducing the search space for low-sensitivity hyperparameters and significantly decreasing ineffective searches. A multi-dimensional adaptive optimization mechanism concentrates computational resources on the hyperparameters with the greatest impact on performance, significantly shortening the optimization time. The sensitivity-weighted velocity update formula makes particles more inclined to move towards the optimal direction of high-sensitivity parameters, effectively avoiding getting trapped in local optima.
[0049] 2. In the technical solution provided by this invention, current traffic flow prediction generally only considers historical data of highway entrances and exits, without taking into account the impact of interchanges between highways on highway traffic flow. This fails to capture the nonlinear and time-varying effects between interchanges and the target section, and does not distinguish the functional differences between different types of interchanges. Therefore, this invention also incorporates second traffic flow data from different types of interchanges intersecting the section location, performs adaptive mode decomposition on the first historical traffic flow data to obtain multiple modal components, calculates the dynamic nonlinear correlation coefficient between the first and second historical traffic flow data within a sliding time window based on the maximum information coefficient, and weights and fuses the modal components with the corresponding dynamic nonlinear correlation coefficients to obtain dynamic fused modal components. These dynamic fused modal components fully exploit the multi-scale spatiotemporal characteristics of traffic flow, accurately reflecting the changes in the impact of different types of interchanges on the target section during different time periods (such as morning peak, evening peak, and off-peak), thereby improving the prediction of traffic flow on highways. Attached Figure Description
[0050] The accompanying drawings, which are included to provide a further understanding of embodiments of the invention and form part of this application, do not constitute a limitation thereof. In the drawings:
[0051] Figure 1 A flowchart illustrating a highway traffic flow prediction method provided in an embodiment of the present invention;
[0052] Figure 2This is a structural diagram of a bidirectional long short-term memory neural network provided in an embodiment of the present invention;
[0053] Figure 3 A comparison chart of individual scatter points generated by the random method and the SOBO sequence provided in the embodiments of the present invention. Detailed Implementation
[0054] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of this invention are only for explaining this invention and are not intended to limit this invention.
[0055] It should be noted that the terms "comprising" or "may include" used in the various embodiments of this application indicate the presence of the claimed function, operation, or element, and do not limit the addition of one or more functions, operations, or elements. Furthermore, as used in the various embodiments of this application, the terms "comprising," "having," and their cognates are intended only to indicate a specific feature, number, step, operation, element, component, or combination of the foregoing, and should not be construed as primarily excluding the presence of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing, or adding one or more combinations of the foregoing.
[0056] It should be understood that terms such as "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0057] like Figure 1 As shown in the figure, an embodiment of the present invention provides a method for predicting highway traffic flow, the method comprising:
[0058] S101, acquire the first historical traffic flow data of the highway section location, and the second historical traffic flow data of the interchange that intersects with the section location.
[0059] The cross-section location can be a section of a highway or a segment of a highway. The entrance to the highway cross-section can be where vehicles enter. The exit to the highway cross-section can be where vehicles exit. The historical time period can be a period of time in the past. The duration of each historical time period can be the same. For example, the duration of a historical time period can be one hour. The number of historical time periods can be preset, for example, 240. The end time of the latest historical time period can be the current time. The time period formed by all historical time periods can be continuous, meaning the end time of the previous historical time period can be the start time of the next historical time period. For example, if the number of historical time periods is 24, the duration of each historical time period is one hour, and the current time is April 3, 2022, 00:00:00, then the start time of the time period formed by all historical time periods can be April 2, 2022, 00:00:00, and the end time of the time period formed by all historical time periods can be April 3, 2022, 00:00:00. The import traffic flow within a historical time period can be the number of vehicles that entered the road to be tested at the entrance during the historical time period.
[0060] The first traffic flow data within a historical time period can be the number of vehicles exiting during that period. Vehicles at interchanges intersecting with the cross-section can enter and exit the cross-section; that is, interchanges intersecting with the road to be monitored can be interchanges between cross-sections, i.e., the junctions of the highway and other roads, usually existing in the form of merging. The second historical traffic flow data for the interchange within a historical time period can be either the number of vehicles entering through that interchange or the number of vehicles exiting through that interchange during that period.
[0061] It should be noted that since vehicles can enter and exit highways not only through entrances and exits but also through interchanges between highways, changes in the number of vehicles entering and exiting highways through interchanges often lead to changes in exit traffic flow on highways. Therefore, obtaining the first historical traffic flow data at the highway cross-section and the second historical traffic flow data at the interchanges intersecting with the cross-section can facilitate subsequent prediction of highway exit traffic flow, thereby enabling the prediction of highway exit traffic flow.
[0062] S102, perform adaptive mode decomposition on the first historical traffic flow data to obtain multiple first mode components, calculate the dynamic nonlinear correlation coefficient between the first historical traffic flow data and the second historical traffic flow data under the sliding time window based on the maximum information coefficient, and weight and fuse the multiple first mode components with the dynamic nonlinear correlation coefficient at the corresponding time to obtain multiple dynamic fused mode components.
[0063] Specifically, an adaptive variational mode decomposition algorithm is used to perform mode decomposition on the first historical traffic flow data, obtaining multiple modal components. Specifically, the adaptive variational mode decomposition method decomposes the traffic flow data based on noise frequency, obtaining a series of modal components, thereby reducing the impact of noise signals on traffic flow prediction. For example, the parameters for adaptive mode decomposition are set as follows: the amplitude of the auxiliary white noise is 0.2, the standard deviation is 0.005, and the number of additions is 100.
[0064] Current traffic flow prediction methods typically only consider historical data from highway entrances and exits, neglecting the impact of interchanges between highways on traffic flow. This invention addresses this by providing refined modeling of the functional and directional differences of highway interchanges, resolving the adaptability issue of general road network fusion methods in highway scenarios. The specific implementation is as follows:
[0065] Interchanges that intersect with the target section are classified into three types: hub interchanges, general interchanges, and service area interchanges. Second historical traffic flow data are obtained for each type of interchange.
[0066] Set the size and step of the sliding time window, and calculate the maximum information coefficient between the first historical traffic flow data of the target section and the second historical traffic flow data of each type of interchange within each sliding time window; wherein, the maximum information coefficient represents the degree of influence of the interchange on the traffic flow at the section location within the current time window;
[0067] The maximum information coefficient is normalized to obtain the dynamic nonlinear correlation coefficient.
[0068] Furthermore, an adaptive variational mode decomposition algorithm is used to perform multi-scale decomposition on the second historical traffic flow data to obtain multiple second mode components. The dynamic nonlinear correlation coefficient at each time step is multiplied by the second mode component at each time step, and then the multiplication result is added to the first mode component at each time step to obtain multiple dynamic fused mode components.
[0069] It should be noted that there is a one-to-one correspondence between the multiple first-mode components and the multiple second-mode components. Therefore, for the multiple first-mode components, at each time step, the k-th first-mode component at the cross-section location and the k-th second-mode component of all interconnections can be weighted and fused based on the dynamic nonlinear correlation coefficient at that time, thus obtaining k dynamically fused mode components, the expression of which is: ;in, The k-th first mode component at time t represents the cross-sectional location. Let k be the second mode component of the i-th interconnect at time t. Let be the dynamic nonlinear correlation coefficient of the i-th interconnection at time t, and M be the total number of interconnections.
[0070] S103. Construct a bidirectional long short-term memory neural network with the minimum mean square error as the optimization objective. Use a particle swarm optimization algorithm based on global sensitivity and adaptive convergence factor optimization of the Sobol sequence to adaptively optimize the hyperparameters of the bidirectional long short-term memory neural network. When the particle swarm optimization algorithm meets the iteration termination condition, output the optimal hyperparameters and update the initial hyperparameters of the bidirectional long short-term memory neural network.
[0071] like Figure 2 As shown, the original signal is directly output to the BiLSTM network layer via the input layer. The input sampled signal is processed by the forward LSTM to obtain a value, which is an output value. This value will affect the parameters in the BiLSTM network layer, including the learning rate, output function, and loss function. Simultaneously, it is processed by the backward LSTM to obtain a value, which will determine the connection weights of the input nodes in the BiLSTM, thus forming a new set of outputs. The values passed to the hidden layer are jointly determined by these two values. The formula is as follows:
[0072] ;
[0073] ;
[0074] ;in, This represents the output of the feedforward LSTM layer. This represents the output of the backward LSTM layer, converting the output state of the BiLSTM to... and Perform matrix concatenation and output. Let f represent the hidden layer output after the two A's are superimposed, and let f represent the activation function of the LSTM. Let x represent the weight matrix of the input features of the feedforward LSTM layer. t Let represent the original input feature vector at time t. This represents the weight matrix for the hidden state transitions in the feedforward LSTM layer. This represents the hidden state of the feedforward LSTM layer at time t−1. This represents the bias vector of the feedforward LSTM layer. This represents the weight matrix of the input features to the feedforward LSTM layer. This represents the weight matrix for the hidden state transitions in the feedforward LSTM layer. This represents the hidden state of the feedforward LSTM layer at time t−1. denoted as the bias vector of the feedforward LSTM layer, g represents the activation function of the output layer, U represents the weight matrix of the output layer, and c represents the bias vector of the output layer.
[0075] A particle swarm optimization algorithm based on global sensitivity and adaptive convergence factor optimization using Sobol sequences is proposed, comprising: generating multiple uniformly distributed hyperparameter samples in a predefined hyperparameter search space using Sobol sequences; using each set of hyperparameter samples as parameters of a bidirectional long short-term memory neural network and calculating the mean square error corresponding to each set of hyperparameter samples; calculating the sensitivity index of each set of hyperparameter samples to the mean square error and classifying the hyperparameter sensitivity levels according to the sensitivity index; adjusting the search space of each dimension according to the hyperparameter sensitivity levels; and optimizing the function for calculating particle velocity based on the sensitivity index to obtain the optimized particle velocity. The function updates the particle velocity; it calculates the population diversity of the particle population at the t-th iteration and calculates the inertia weight based on the population diversity and convergence factor; in each iteration, it updates the individual optimal position of each particle and the global optimal position of the particle population; it initializes particles that meet the mutation probability, recalculates the mean square error of the particles, and compares it with the mean square error of the previous time step, continuously updating the individual extreme value and the population extreme value of the particles; it determines whether the current iteration number meets the maximum iteration number, and if so, outputs the global optimal position; otherwise, it recalculates the mean square error of each particle until the maximum iteration number is met, and then outputs the global optimal position.
[0076] In this embodiment, the average degree of particle swarm initialization directly affects the accuracy and convergence of global intelligent optimization. Furthermore, the diversity and average degree of individuals are also important, as they directly influence the relationships between individuals. Simultaneously, by performing mean analysis on the initial values of the swarm, the optimal solution for the swarm can be obtained. Currently, traditional particle swarm optimization algorithms use a random initialization method for the swarm, which suffers from uneven diffusion in practical applications, resulting in overlapping node sets. To address this issue, a new initialization method is used to generate the Sobol array, ensuring the consistency of the generated point set and eliminating overlap. This new initialization method uses Radical Inversion with a base of 2 to construct the Sobol sequence for each dimension, and each dimension's Radical Inversion has a different matrix. This makes the generated point set more uniform and eliminates overlap. This method is used to generate 450 two-dimensional random numbers between 0 and 1, which are then plotted graphically. Compared to standard random scattering, such as... Figure 3 As shown, the results indicate that the random numbers generated by this method in the Sobol sequence are more uniform, resulting from... Figure 2 The comparison shows that the population distribution obtained by the Sobol sequence is more uniform and has a more complete spatial coverage.
[0077] This embodiment uses the Sobol sequence to determine the search strategy from the initialization tool, adjusting the search space and step size of the particle swarm optimization algorithm. Specifically: the mean squared error is represented as a function of the multidimensional hyperparameter vector, and the total variance of the function is calculated; two sets of N*D dimensional first sample matrices and second sample matrices are generated using the Sobol sequence; where N is the number of samples and D is the dimension of the hyperparameters to be optimized; the i-th column of the first sample matrix is selected, and all columns other than the i-th column of the second sample matrix are selected to construct D cross-sample matrices; where i is a positive integer; a bidirectional long short-term memory neural network is constructed using the hyperparameter combinations in the first sample matrix and the cross-sample matrix, and trained multiple times on the validation set. The average mean squared error of the validation set after multiple trainings is taken as the output vector of the first sample matrix and the cross-sample matrix; the sensitivity index is calculated based on the output vectors and the total variance of the first sample matrix and the cross-sample matrix.
[0078] First, a small number of samples (20-30 groups) are generated using Sobol sequences. BiLSTM is then trained, and the first-order sensitivity index and total sensitivity index of each hyperparameter with respect to the validation set MSE are calculated. Hyperparameters are divided into three categories: high sensitivity (number of hidden layer neurons, learning rate), medium sensitivity (batch size, dropout rate), and low sensitivity (number of training epochs, L2 regularization coefficient). This solves the problem that existing particle swarm optimization algorithms search for all hyperparameters equally, expands the search range of high-sensitivity parameters, and narrows the search range of low-sensitivity parameters.
[0079] The validation set mean square error (MSE) is represented as a hyperparameter vector of a D-dimensional BiLSTM. The function, i.e. ,in For the validation set MSE, calculate Total variance , For mathematical expectation;
[0080] Two independent N×D dimensional sample matrices, A and B, are generated using Sobol sequences, where N is the number of samples, ranging from 100 to 500, and D is the dimension of the hyperparameter to be optimized.
[0081] Constructing the cross sample matrix , of which The column is taken from the first sample matrix A. The remaining columns are taken from the corresponding columns of the second sample matrix B, generating a total of D cross-sample matrices; sample matrices A and B and all cross-sample matrices are then used respectively. The hyperparameters are combined to construct a BiLSTM model and trained on a validation set. Each hyperparameter combination is trained 3-5 times, and the average mean squared error is taken as the output value corresponding to that hyperparameter combination to obtain the output vector. , and ;
[0082] Based on the output vectors and total variance of the first sample matrix and the cross sample matrix, calculate the... Sensitivity index of each hyperparameter The formula is: ,in, Indicates except the first All other hyperparameters besides the one hyperparameter; Let J be the output vector corresponding to the j-th sample in the first sample matrix A. Cross sample matrix The output vector corresponding to the j-th sample.
[0083] Sensitivity Index Indicates the first The proportion of the total contribution of each hyperparameter itself and its interaction with all other hyperparameters to the output variance; normalize all the calculated first-order sensitivity indices and the total sensitivity index; when the sensitivity index of a certain hyperparameter is less than the threshold, it is determined that the hyperparameter has no significant impact on the model performance, and it is fixed as the default value and no longer included in the optimization scope of the subsequent particle swarm optimization algorithm.
[0084] Furthermore, the search space of each dimension is dynamically adjusted according to the sensitivity level of the hyperparameters: the search range of high-sensitivity hyperparameters is expanded, while the search range of low-sensitivity hyperparameters is reduced.
[0085] The function for calculating particle velocity is optimized based on the sensitivity index, resulting in the optimized particle velocity function, whose expression is:
[0086] ;in, Let be the inertia weight for the t-th iteration. Let be the velocity of the i-th particle in the t-th iteration. , The acceleration constant, , A random number in the range of 0-1. Let be the sensitivity index of the i-th hyperparameter. Let be the optimal position for the i-th particle. This represents the globally optimal position of the particle swarm.
[0087] Secondly, in the particle swarm optimization algorithm, the inertia weight is used to describe the strength of a particle's ability to inherit its previous flight velocity; it is a variable and adjustable parameter. A larger inertia weight results in a faster initial velocity, which is beneficial for the particle to move over a large area in the search space, demonstrating strong global search capability. Conversely, a smaller inertia weight results in a slower flight velocity, which is beneficial for the particle to move within a small area in the search space, demonstrating strong local search capability. In the algorithm, all particles use the same inertia weight. Between their own individual extreme value and the group extreme value shared by their peers, some particles will inevitably deviate from their original flight direction and follow the group in a direction unfavorable to themselves.
[0088] Therefore, this invention calculates the population diversity of the particle population at the t-th iteration, and calculates the inertia weight based on the population diversity and the convergence factor.
[0089] Calculate the population diversity of the particle swarm at the t-th iteration. The formula is: ,in, For particle population size, For hyperparameter dimensions, Let i be the position of the i-th particle in the i-th dimension. Let be the average value of the j-th dimension position of all particles.
[0090] The dynamic update of the inertia weight is shown in the following formula: ;in, As the initial inertia weight, For the final inertia weight, The convergence factor is The maximum number of iterations, This is the adjustment coefficient.
[0091] When the population diversity d(t) is lower than a preset threshold, the inertia weight can be increased to enhance the global search capability.
[0092] Particle Swarm Optimization (PSO) is a global optimization algorithm based on swarm intelligence, searching for optimal solutions by simulating the cooperative behavior of flocks of birds foraging. Bidirectional Long Short-Term Memory (BiLSTM), as an improvement on LSTM, can process sequential data from both forward and backward directions simultaneously; its model performance is highly dependent on the appropriate configuration of hyperparameters. This invention uses an optimized PSO algorithm to optimize the hyperparameters of BiLSTM. The core is to map the hyperparameter combination of BiLSTM to particles in the optimized PSO algorithm. Through iterative optimization of particles, the optimal hyperparameter combination for the BiLSTM model is found. Before optimization, the objective function is first determined. The objective function is the core standard for evaluating the quality of hyperparameter combinations and needs to be set according to the specific task. Priority is given to indicators that reflect the model's generalization ability and fitting effect. Commonly used indicators include validation mean squared error (MSE), mean absolute error (MAE), classification accuracy, and coefficient of determination (R²). The optimization direction is usually "minimizing the objective function" (e.g., minimizing MSE) or "maximizing the objective function" (e.g., maximizing accuracy). For example, in time series prediction tasks, the MSE of the BiLSTM model on the validation set is often used as the objective function. That is, the optimization objective of PSO is to find the hyperparameter combination that minimizes the MSE on the validation set. This objective function also serves as the fitness evaluation criterion for particles in PSO.
[0093] Secondly, the hyperparameters to be optimized should be selected. These should be core hyperparameters that significantly impact model performance and have low redundancy, avoiding excessive optimization dimensionality which can lead to slow PSO convergence or getting stuck in local optima. Based on practical experience, the following four types of core hyperparameters are preferred as optimization targets, while setting a reasonable search range. The first is the number of neurons in the hidden layers, and the number of neurons in the forward and backward hidden layers (usually set to be the same to simplify optimization). The search range is generally 32~128, and should be rounded to the nearest integer. This affects the model's ability to extract sequence features; too few neurons can lead to underfitting, while too many can easily cause overfitting and computational redundancy.
[0094] The learning rate controls the step size of parameter updates, and the search range is generally 0.001~0.1. It affects the convergence speed and convergence effect of the model. Too large a step size will cause the model to fail to converge, while too small a step size will make the training speed too slow and prone to getting stuck in local optima.
[0095] Training parameters include batch size and number of training epochs. Due to the number of samples trained in each iteration, the search range is generally 16, 32, 64, or 128, which affects the stability and speed of model training. Too small a number can easily lead to training fluctuations, while too large a number can easily cause the model to get stuck in local optima and consume more memory. The number of times the model completes the training dataset is searched is generally 50 to 200, and should be rounded to the nearest integer. At the same time, an early stopping mechanism can be used to prevent overfitting. Too few epochs will lead to underfitting, while too many will cause overfitting and wasted computation.
[0096] It should be noted that the process of using the optimized particle swarm optimization algorithm to optimize the hyperparameters of the network is a conventional technique. Therefore, this embodiment only provides a simple description and does not provide a detailed description of the optimization steps such as the fitness function, the update of the optimal position of the particles, and the update of velocity and position. This is a conventional technique used by those skilled in the art.
[0097] S104 trains the updated bidirectional long short-term memory neural network with multiple dynamic fusion modal components, and at the end of the training, a traffic prediction model for highway traffic prediction is obtained.
[0098] Specifically, the process of training a neural network is common knowledge to those skilled in the art, therefore, this embodiment will not describe it in detail.
[0099] S105, based on a traffic prediction model, predicts traffic flow on highways.
[0100] Specifically, relevant input data for the period to be predicted is collected, including the location of highway sections and current traffic flow data at interchanges. The collected data is cleaned, for example, outliers and missing values are removed. Missing values can be processed by linear interpolation, mean imputation, etc. The data is then normalized / standardized (using the normalization method used during training to ensure that the data range is consistent with the training data and to avoid scale differences affecting the prediction results). Finally, the data is organized into sequence data that conforms to the input format of the traffic flow prediction model.
[0101] Then, the traffic prediction model with optimized hyperparameters by the particle swarm optimization algorithm and validated on the test set is called, and the optimal parameters of the model (including optimized hyperparameters such as the number of hidden layer neurons and learning rate, as well as parameters such as weights and biases that have been trained on the model) are loaded.
[0102] The preprocessed data to be predicted is input into the loaded traffic flow prediction model. The model outputs the predicted highway traffic flow for the predicted period through the joint calculation of forward and backward propagation. Predictions can be divided into short-term predictions (such as traffic flow in the next 1 hour or 3 hours) and medium- to long-term predictions (such as traffic flow in the next 1 day or 3 days).
[0103] This invention also provides an electronic device. The electronic device includes a processor, a memory, a communication interface, and at least one communication bus for connecting the processor, the memory, and the communication interface. The memory includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (PROM), or portable read-only memory (CD-ROM), and is used for related instructions and data.
[0104] The communication interface is used to receive and send data. The processor can be one or more CPUs; if the processor is a single CPU, it can be a single-core CPU or a multi-core CPU. The processor in the electronic device reads one or more programs stored in the memory and performs the following operations: acquiring first historical traffic flow data at the highway cross-section location and second historical traffic flow data at different types of interchanges intersecting with the cross-section location; performing adaptive mode decomposition on the first historical traffic flow data to obtain multiple first mode components; calculating the dynamic nonlinear correlation coefficient between the first and second historical traffic flow data under a sliding time window based on the maximum information coefficient; weightedly fusing the multiple first mode components with the dynamic nonlinear correlation coefficients at corresponding times to obtain multiple dynamic fused mode components; constructing a bidirectional long short-term memory neural network (LSTM), with the minimum mean square error as the optimization objective, and using a particle swarm optimization algorithm based on global sensitivity and adaptive convergence factor optimization of the Sobol sequence to adaptively optimize the hyperparameters of the LSTM neural network; when the particle swarm algorithm meets the iteration termination condition, outputting the optimal hyperparameters and updating the initial hyperparameters of the LSTM neural network; training the updated LSTM neural network with multiple dynamic fused mode components; obtaining a traffic prediction model for highway traffic prediction at the end of training; and predicting highway traffic based on the traffic prediction model.
[0105] It should be noted that the specific implementation of each operation can be described above. Figure 1 The corresponding description of the method embodiments shown indicates that the electronic device can be used to execute a highway traffic prediction method according to the above method embodiments of this application, and will not be described in detail here.
[0106] This invention also provides a computer-readable storage medium, which is a memory device in a computer device for storing programs and data. It is understood that the computer-readable storage medium here can include both built-in storage media in the computer device and extended storage media supported by the computer device. The computer-readable storage medium provides storage space that stores the operating system of a terminal. Furthermore, the storage space also stores one or more instructions suitable for loading and execution by a processor. These instructions can be one or more computer programs (including program code). It should be noted that the computer-readable storage medium here can be high-speed RAM or non-volatile memory, such as at least one disk storage device. The processor can load and execute one or more instructions stored in the computer-readable storage medium to implement the corresponding steps of the highway traffic prediction method in the above embodiments. Those skilled in the art should understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0107] This invention also provides a computer program product containing program instructions. The computer program product may be software or program products containing program instructions, capable of running on a computing device or stored on any available medium. When the computer program product is run on at least one electronic device, it causes the at least one electronic device to perform a highway traffic prediction method.
[0108] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for predicting highway traffic flow, characterized in that the method... include: Acquire the first historical traffic flow data of the highway cross-section location, and the second historical traffic flow data of different types of interchanges intersecting with the cross-section location; Adaptive mode decomposition is performed on the first historical traffic flow data to obtain multiple first mode components. The dynamic nonlinear correlation coefficient between the first historical traffic flow data and the second historical traffic flow data under the sliding time window is calculated based on the maximum information coefficient. The multiple first mode components are weighted and fused with the dynamic nonlinear correlation coefficient at the corresponding time to obtain multiple dynamic fused mode components. A bidirectional long short-term memory neural network is constructed with the minimum mean square error as the optimization objective. A particle swarm optimization algorithm based on global sensitivity and adaptive convergence factor optimization of the Sobol sequence is used to adaptively optimize the hyperparameters of the bidirectional long short-term memory neural network. When the particle swarm optimization algorithm meets the iteration termination condition, the optimal hyperparameters are output and the initial hyperparameters of the bidirectional long short-term memory neural network are updated. The updated bidirectional long short-term memory neural network is trained by multiple dynamic fusion modal components. At the end of the training, a traffic prediction model for highway traffic prediction is obtained. Traffic flow is predicted on highways based on a traffic flow prediction model.
2. The method according to claim 1, characterized in that, An adaptive variational mode decomposition algorithm is used to decompose the first historical traffic flow data into multiple scales, resulting in multiple first mode components.
3. The method according to claim 2, characterized in that, The dynamic nonlinear correlation coefficient between the first and second historical traffic flow data under the sliding time window is calculated based on the maximum information coefficient, including: Interchanges that intersect with the target section are classified into three types: hub interchanges, general interchanges, and service area interchanges. Second historical traffic flow data are obtained for each type of interchange. Set the size and step of the sliding time window, and calculate the maximum information coefficient between the first historical traffic flow data of the target section and the second historical traffic flow data of each type of interchange within each sliding time window; wherein, the maximum information coefficient represents the degree of influence of the interchange on the traffic flow at the section location within the current time window; The maximum information coefficient is normalized to obtain the dynamic nonlinear correlation coefficient.
4. The method according to claim 3, characterized in that, Multiple first-mode components are weighted and fused with the dynamic nonlinear correlation coefficients at corresponding time points to obtain multiple fused mode components, including: An adaptive variational mode decomposition algorithm is used to decompose the second historical traffic flow data at multiple scales to obtain multiple second mode components; The dynamic nonlinear correlation coefficient at each time step is multiplied by the second mode component at each time step, and then the multiplication result is added to the first mode component at each time step to obtain multiple dynamic fused mode components.
5. The method according to claim 1, characterized in that, A particle swarm optimization algorithm based on global sensitivity and adaptive convergence factor optimization using Sobol sequences is employed, including: Multiple uniformly distributed hyperparameter samples are generated within a predefined hyperparameter search space using Sobol sequences. Each set of hyperparameter samples is used as a parameter of the bidirectional long short-term memory neural network, and the mean square error corresponding to each set of hyperparameter samples is calculated. Calculate the sensitivity index of each hyperparameter sample to the mean square error, and classify the sensitivity level of the hyperparameters according to the sensitivity index. Adjust the search space for each dimension based on the sensitivity level of the hyperparameters; The function for calculating particle velocity is optimized based on the sensitivity index to obtain the optimized particle velocity function, and the particle velocity is updated using this function. Calculate the population diversity of the particle population at the t-th iteration, and calculate the inertia weight based on the population diversity and the convergence factor; In each iteration, the individual optimal position of each particle and the global optimal position of the particle population are updated. The particles that meet the mutation probability are initialized, the mean square error of the particles is recalculated and compared with the mean square error of the previous moment, and the individual extreme value and the population extreme value of the particles are continuously updated. Determine if the current iteration count meets the maximum iteration count. If it does, output the global optimal position. Otherwise, recalculate the mean square error of each particle until the maximum iteration count is met, and then output the global optimal position.
6. The method according to claim 5, characterized in that, Calculate the sensitivity index of each hyperparameter sample group to the mean square error, including: The mean squared error is expressed as a function of a multidimensional hyperparameter vector, and the total variance of the function is calculated. Two sets of N*D dimensional sample matrices, the first and the second, are generated using Sobol sequences; where N is the number of samples and D is the dimension of the hyperparameter to be optimized. Select the i-th column of the first sample matrix and all columns other than the i-th column of the second sample matrix to construct D cross-sample matrices; where i is a positive integer; Bidirectional long short-term memory neural networks are constructed using hyperparameter combinations in the first sample matrix and the cross sample matrix, respectively, and trained multiple times on the validation set. The average mean square error of the validation set after multiple training sessions is taken as the output vector of the first sample matrix and the cross sample matrix. The sensitivity index is calculated based on the output vectors and total variance of the first sample matrix and the cross sample matrix.
7. The method according to claim 5, characterized in that, The expression for the inertia weight is: ;in, As the initial inertia weight, For the final inertia weight, Let t be the convergence factor and t be the current iteration number. The maximum number of iterations, This is the adjustment coefficient.
8. The method according to claim 1, characterized in that, The expression for the particle velocity function is: ;in, Let be the inertia weight for the t-th iteration. Let be the velocity of the i-th particle in the t-th iteration. , The acceleration constant, , A random number in the range of 0-1. Let be the sensitivity index of the i-th hyperparameter. Let be the optimal position for the i-th particle. This represents the globally optimal position of the particle swarm.
9. An electronic device, characterized in that, Including memory and processor; A memory for storing computer programs, the computer programs including program instructions; A processor for executing the program instructions to cause the electronic device to perform the steps of a highway traffic prediction method as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a computer program that, when executed by one or more processors, implements a highway traffic flow prediction method as described in any one of claims 1 to 8.