Public transport line passenger flow prediction method based on CPO algorithm optimization deep neural network

By applying the deep neural network method optimized by CPO algorithm in passenger flow prediction on bus line, the CNN-LSTM-Attention model is constructed, which solves the problems of reduced passenger flow prediction accuracy and complex model parameter optimization in the existing technology, and achieves higher prediction accuracy and adaptability.

CN119783880APending Publication Date: 2025-04-08DALIAN MARITIME UNIVERSITY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411802260.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

The existing bus line passenger flow prediction methods are difficult to effectively capture the long-term dependencies and complex changes in passenger flow data, resulting in a significant reduction in prediction accuracy over a long period of time and complex optimization of model parameters.

Method used

The deep neural network method based on CPO algorithm optimization is adopted to construct the CNN-LSTM-Attention model through data preprocessing and feature extraction, and optimize the LSTM hidden layer parameters, the learning rate of the Adam optimizer and the L2 regularization coefficient to improve the prediction accuracy and adaptability of the model.

Benefits of technology

It significantly improves the accuracy of passenger flow forecasts on bus lines and the adaptability of models, and can capture the changing patterns of passenger flow more accurately, whether it is short-term fluctuations or long-term trends, and provides more reliable prediction results, helping bus operators optimize resource allocation and operation plans.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119783880A_ABST
    Figure CN119783880A_ABST
Patent Text Reader

Abstract

The invention provides a public transport line passenger flow prediction method for optimizing a deep neural network based on a CPO algorithm, and belongs to the technical field of public transport. Comprising the following steps: data collection and arrangement; obtaining multi-source data and preprocessing the data; mining features in the public transportation system; features in the public transportation system are integrated into the passenger flow prediction model; the training set is used to train the obtained CNN-LSTM-Attention model; calculating a fitness function of a CPO optimization layer through the verification set, outputting a performance evaluation and passenger flow prediction result, and obtaining a verified CNN-LSTM-Attention model; and the verified CNN-LSTM-Attention model is used to predict the passenger flow of the bus route. According to the method, multi-factor comprehensive consideration is effectively realized, and various factors influencing the public transport passenger flow are effectively fused. And through the strong feature learning ability of the deep neural network, potential relationships between the factors and the passenger flow are mined, so that an internal driving mechanism of passenger flow change is comprehensively and meticulously reflected, and a prediction result is more suitable for an actual operation scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of public transportation, and in particular to a method for predicting passenger flow of public transportation routes based on a CPO algorithm to optimize a deep neural network. Background Art

[0002] In the prior art, in order to optimize the bus route passenger flow prediction method, accurate bus route passenger flow prediction can provide key decision-making basis for bus operating companies. By knowing the passenger flow at different time periods and different stations in advance, companies can reasonably arrange the frequency of vehicle departures and allocate vehicle resources. During peak passenger flow periods, increase the number of departures, shorten passenger waiting time, and improve service quality; during low passenger flow periods, appropriately reduce the frequency of departures to avoid resource waste and reduce operating costs.

[0003] For the planning and construction of urban transportation infrastructure, bus route passenger flow forecasting also plays an indispensable role. Government departments and transportation planning agencies can evaluate the rationality of the layout of existing bus stops, bus hubs and bus routes based on the passenger flow forecast results, and formulate future infrastructure development plans accordingly.

[0004] At the same time, predicting bus route passenger flow helps improve passengers' overall travel experience. Passengers can obtain bus route passenger flow information in advance, plan their travel time and route reasonably, and avoid periods and routes with large passenger flow and congestion. For example, in some smart bus applications, if accurate passenger flow forecast data can be provided, passengers can choose relatively relaxed travel periods based on this information, reduce the feeling of congestion on the bus, and improve travel comfort and convenience.

[0005] The existing bus route passenger flow prediction methods include:

[0006] 1. Traditional statistical analysis methods:

[0007] A. Autoregressive Moving Average Model (ARIMA)

[0008] This method is based on the time series characteristics of historical passenger flow data, such as trend, seasonality and periodicity, and considers the autocorrelation and moving average of time series data to build a mathematical model for prediction. However, the ARIMA model requires the data to be stationary, and has limited effect on the nonlinear and non-stationary characteristics existing in the actual bus line passenger flow data. It is also difficult to effectively capture the long-term dependencies in the passenger flow data. For example, for some passenger flow data with long-term trend changes or periodic changes but with a long period, the prediction accuracy will significantly decrease as the prediction time span increases. The determination of model parameters requires certain professional knowledge and experience, and there are certain difficulties in practical applications.

[0009] 2. Machine Learning Methods

[0010] A. Support Vector Machine (SVM)

[0011] SVM constructs a hyperplane to classify or regress different types of data (such as data with different passenger flow levels). It has certain advantages in processing small samples and nonlinear data. In the passenger flow prediction of bus routes, historical passenger flow data is used as training samples, and the data is mapped to a high-dimensional space through a kernel function to find the optimal classification or regression hyperplane. However, the processing efficiency of SVM for large-scale data is relatively low, and the selection of kernel functions and parameter optimization are relatively complex, requiring a lot of experiments and tuning, otherwise overfitting or underfitting is prone to occur.

[0012] B. Decision Tree Algorithm

[0013] The decision tree constructs a tree structure based on the characteristics of the data and makes predictions by continuously dividing the data characteristics. For example, a decision tree is constructed based on time characteristics (morning, noon, afternoon, etc.) and weather characteristics (sunny, rainy, cloudy, etc.). Each node represents the judgment of a feature, the branch represents different values, and the leaf node is the predicted passenger flow result. The decision tree algorithm is easy to understand and explain, but it is prone to overfitting problems, especially when the data is more complex, the prediction accuracy of a single decision tree may be greatly affected.

[0014] 3. Deep Learning Methods

[0015] A. RNN

[0016] RNN has a memory function and can process sequence data, which is suitable for data with time series characteristics such as bus route passenger flow prediction. However, the computational complexity is high, especially when processing long sequence data. The training and prediction process takes a long time, which makes it difficult to meet the requirements for rapid response in the real-time prediction of bus passenger flow. Gradient vanishing or exploding problems may occur during the training process, affecting the convergence and performance of the model, and special optimization algorithms or techniques need to be used to solve them. Although it can handle long-term dependency problems, in actual applications, for very long time series, it may still be difficult to effectively capture long-term dependencies, resulting in reduced prediction accuracy.

[0017] B. Generative Adversarial Network (GAN):

[0018] GAN mainly consists of two parts: the generator and the discriminator. The purpose of the generator is to generate data that is as similar to the real data distribution as possible, while the discriminator is responsible for distinguishing whether the input data comes from the real data set or the data generated by the generator. In the prediction of bus line passenger flow, the generator can generate predicted passenger flow data based on the input random noise and some known conditional information (such as time, date, weather, etc.). The discriminator will judge the authenticity of the data output by the generator based on the real historical passenger flow data. However, the training process of GAN is relatively complex and unstable, and the confrontational balance between the generator and the discriminator is difficult to grasp. It is easy to have problems such as non-convergence of training or mode collapse, resulting in unstable quality of the generated passenger flow prediction data and affecting the reliability of the prediction results. Summary of the invention

[0019] According to the technical problems mentioned in the above background technology, a bus route passenger flow prediction method based on CPO algorithm optimizing deep neural network is provided.

[0020] The technical means adopted by the present invention are as follows:

[0021] The bus route passenger flow prediction method based on CPO algorithm optimized deep neural network is characterized by comprising the following steps:

[0022] Step 1: Data collection and organization; obtaining multi-source data and pre-processing the data; the multi-source data includes: passenger flow statistics, weather data, route station data and POI point of interest data;

[0023] Step 2: mining features in the public transportation system; the features include: time feature values, weather feature values, and point of interest feature values;

[0024] Step 3: Integrate the features of the public transportation system into the passenger flow prediction model; the passenger flow prediction model includes: a data input layer, a CPO optimization layer, a feature extraction layer, an attention mechanism layer, a time series prediction layer and a fully connected layer;

[0025] Optimizing the CPO optimization layer and constructing a CNN-LSTM-Attention model; the CPO optimization layer optimizes the hidden layer parameters of the LSTM, the learning rate of the Adam optimizer, and the L2 regularization coefficient in the bus passenger flow prediction according to the defensive behavior of the porcupine;

[0026] Step 4: Use the training set to train the CNN-LSTM-Attention model obtained in step 3;

[0027] Step 5: Calculate the fitness function of the CPO optimization layer through the validation set, output the performance evaluation and passenger flow prediction results, and obtain the verified CNN-LSTM-Attention model;

[0028] Step 6: Apply the verified CNN-LSTM-Attention model to predict the passenger flow of bus routes.

[0029] Furthermore, the passenger flow statistics data include: data creation time, line ID, i.e., the number of the bus line, vehicle ID, i.e., the number of the bus vehicle, station number, i.e., the number of stations in a certain direction on the line, up or down, number of passengers getting on the bus, i.e., the number of passengers getting off the bus at the current station, and card swiping ID, i.e., the number of passengers swiping the card at the current station;

[0030] The weather data includes: date and time, weather conditions, wind speed, temperature and precipitation obtained from China Meteorological Data Network;

[0031] The line site data includes: line number, line name, site number, line direction, site number, site name and site geographical location;

[0032] The POI data includes: POI number, POI name, POI category and POI geographic location.

[0033] Furthermore, the process of obtaining the time characteristic value includes the following steps:

[0034] Extract the day of the week information A from the date and time; from Monday to Sunday, the value range of A is [1, 7];

[0035] Extract hour information B, where the value range of B is [0, 23];

[0036] The week information A and hour information B are combined into a value by weighted summation, which is the time feature value;

[0037] Time characteristic value = mA + nB;

[0038] Among them, m represents the weight of the week information; n represents the weight of the hour information.

[0039] Furthermore, the process of obtaining the weather characteristic value includes the following steps:

[0040] For wind force level C, the value range of wind force level C is [0, 12], and the wind force level C is multiplied by a certain coefficient p to obtain a wind force characteristic value;

[0041] The temperature D is first normalized. Let the lowest temperature in history be recorded as min_temp and the highest temperature be recorded as max_temp. Then the normalized temperature temp_normalized is:

[0042] temp_normalized=(temperature-min_temp) / (max_temp-min_temp);

[0043] And multiply the temperature D by a certain coefficient q to obtain a temperature characteristic value;

[0044] The precipitation E is first binarized. If the precipitation is greater than 0, it is assigned a value of 1, and the assigned value is multiplied by a weight k to obtain the precipitation characteristic value; if the precipitation is 0, it is assigned a value of 0, and the assigned value is multiplied by a weight k to obtain the precipitation characteristic value;

[0045] The weather characteristic value is obtained by summing the wind characteristic value, temperature characteristic value and precipitation characteristic value.

[0046] Furthermore, the acquisition of the feature value of the point of interest includes the following steps:

[0047] For different types of POI, weights are roughly assigned according to their attractiveness to passenger flow, the number of various POIs around bus stops is counted, and the characteristic values ​​of different POIs are calculated;

[0048] For the distances from the bus stops related to longitude and latitude, calculate the distance from each point of interest to the corresponding bus stop, set the maximum distance record as max_distance, and normalize the distance: distance_normalized = distance / max_distance; then calculate the average of the normalized distances of all points of interest, and multiply it by a weight to obtain the geographic location feature values ​​of different points of interest;

[0049] The feature values ​​of different points of interest and the feature values ​​of different geographical locations of points of interest are added together to obtain the feature values ​​of the points of interest.

[0050] Furthermore, the optimization of the CPO optimization layer includes the following steps:

[0051] Step 31: Define the optimization problem;

[0052] Determine the decision variables: Let x1 be the LSTM hidden layer parameter, i.e. the number of neurons; let x2 be the initial learning rate of the Adam optimizer; let x3 be the L2 regularization coefficient;

[0053] Determine the fitness function: The goal is to minimize the error of bus passenger flow prediction. Suppose the prediction value of the data set is The actual value is y, the number of samples is n, and the fitness formula is:

[0054]

[0055] Determine the constraints: Determine the value range of LSTM hidden layer parameters, learning rate and regularization coefficient according to the actual situation;

[0056] Step 32: Initialize CPO algorithm parameters; including population size N, maximum number of iterations T max , cycle number related parameters T, minimum population size N min , threshold parameter T f and the convergence speed factor α;

[0057] Step 33: Initialize the population; randomly initialize the population within the value range of the decision variable, and each individual represents a combination of a set of LSTM hidden layer parameters, learning rate and regularization coefficient;

[0058] Step 34: Evaluate the fitness of each individual in the population; train the LSTM model using the initialized parameters and calculate the fitness value of the predicted results;

[0059] Step 35: Update the global optimal solution; find the individual with the smallest fitness value in the current population and take it as the global optimal solution

[0060] Step 36: Circular iterative optimization; for each individual, update according to the exploration and utilization phases of the CPO algorithm;

[0061] Step 37: Get the optimal solution; after the iteration, the global optimal solution That is, the optimized LSTM hidden layer parameters, Adam optimizer learning rate and L2 regularization coefficient;

[0062] Step 38: Use the optimized parameters to build the CNN-LSTM-Attention model.

[0063] Further, the step 36 comprises the following steps:

[0064] Step 361: Simulate the exploration phase of the visual defense mechanism of the crested porcupine: update the individual positions according to a specific formula through the randomly generated values ​​and the current optimal solution to increase the population diversity. The formula is:

[0065]

[0066] in, represents the global optimal solution of the current iteration t, Indicates the current individual The intermediate vector between another randomly selected individual, τ1 represents a random number generated based on a normal distribution, and τ2 represents a random value between 0 and 1;

[0067] Step 362: Simulate the utilization phase of the crested porcupine's odor defense mechanism: Based on the randomly generated values, update the individual position according to the corresponding formula to make the individual move closer to a better solution. In the odor defense mechanism, the formula is:

[0068]

[0069] in, is a random binary vector composed of 0 and 1, used to simulate vectors of different scenarios. Indicates that the odor diffusion factor is calculated by the fitness function value, population size and current iteration number. represents the parameter controlling the search direction, γ t represents the defense factor, which is determined by the random number and the current number of iterations, and τ3 represents a random value between [0,1];

[0070] Step 363: Boundary processing: If the updated individual exceeds the value range of the decision variable, the reflected boundary processing method is used to limit it to within the range. The formula is:

[0071]

[0072] Among them, j=1, 2, 3 correspond to LSTM hidden layer parameters, Adam optimizer learning rate and regularization coefficient respectively;

[0073] Step 364: Update the global optimal solution; after each iteration, compare the best individual in the current population with the global optimal solution. If the current best individual is better, update the global optimal solution.

[0074] Step 35: Check the termination condition. If the maximum number of iterations is reached, stop the optimization; otherwise, recalculate the fitness value step.

[0075] Furthermore, the CNN-LSTM-Attention model includes: a feature extraction layer, an attention mechanism layer, a temporal feature extraction layer, and a fully connected layer;

[0076] The feature extraction layer extracts and reduces the dimension of nonlinear features through a multi-layer one-dimensional convolutional neural network;

[0077] The attention mechanism layer adds both the SE attention mechanism and the dot product attention mechanism after the feature extraction layer structure;

[0078] The temporal feature extraction layer is composed of a multi-layer long short-term memory network, which is used to extract the temporal features of the passenger flow sequence;

[0079] The fully connected layers transform the input data into the desired output format.

[0080] Furthermore, the SE attention mechanism is used to recalibrate the channel dimension of the feature map output by the CNN, including the following steps:

[0081] A. Squeeze operation is global information embedding; set the input feature map to X∈R H×W×C , where H represents the height of the feature map, W represents the width of the feature map, and C represents the number of channels of the feature map;

[0082] The spatial information H×W is compressed by global average pooling to obtain a 1×1×C vector z, the formula is:

[0083]

[0084] Among them, x c (i,j) represents the element at position (i,j) of the cth channel.

[0085] B. Excitation operation is adaptive channel adjustment: z is passed through two fully connected layers FC and an activation function to obtain the channel attention weight s; the dimension of z is reduced from C to C / r through a fully connected layer, and then the dimension is restored to C through the ReLU activation function and another fully connected layer. Finally, the value of s is mapped to the interval through the Sigmoid function, and the channel attention weight formula is obtained as follows:

[0086] s = σ(W2ReLU(W1z));

[0087] in, r represents a scaling ratio used to reduce the number of parameters, and σ represents the Sigmoid function;

[0088] C. Scale operation is feature recalibration: multiply the obtained attention weights by the original input feature map channel by channel to obtain the feature map adjusted by the attention mechanism The formula is:

[0089]

[0090] Among them, c=1,2,…,C.

[0091] Furthermore, the point product attention mechanism weights different features in the historical data, and the formula is:

[0092]

[0093] Among them, Q represents the query matrix, that is, the information currently being paid attention to; K represents the key matrix; V represents the value matrix;

[0094] In the attention mechanism, the weighted sum is calculated according to the weights to obtain the final feature representation of attention; the softmax function is a normalization function. After the softmax function, the sum of the attention weights of each row is 1; d k is the dimension of the key vector, divided by This is to prevent the dot product result from being too large, causing the softmax function gradient to disappear or explode.

[0095] Compared with the prior art, the present invention has the following advantages:

[0096] The method of the present invention effectively improves the prediction accuracy: by optimizing the deep neural network through the CPO algorithm, it can more accurately capture the complex changes in the passenger flow of bus routes, and can give more reliable prediction results for both short-term fluctuations and long-term trends. This helps bus operators to make resource allocation and operation plans in advance, reduce operating costs and improve service quality, such as reasonably arranging the number of vehicles and departure time intervals to avoid idle vehicles or excessive passenger congestion.

[0097] The method of the present invention effectively enhances the adaptability and flexibility of the model: the method can adapt to the characteristics of different bus routes and the changes in passenger flow in different time periods and different date types (weekdays, weekends, holidays, etc.). Even in the face of emergencies or long-term evolution of passenger flow patterns, the model can quickly adapt to the new environment through the optimization and adjustment of the CPO algorithm, continue to provide accurate predictions, and reduce decision-making errors caused by model failure.

[0098] The method of the present invention effectively realizes comprehensive consideration of multiple factors: effectively integrating multiple factors that affect bus passenger flow, such as weather conditions, date, surrounding points of interest, etc. Through the powerful feature learning ability of deep neural networks, the potential relationship between these factors and passenger flow is explored, thereby comprehensively and meticulously reflecting the internal driving mechanism of passenger flow changes, making the prediction results more in line with actual operation scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0099] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0100] Figure 1 It is a schematic diagram of the overall process of the present invention.

[0101] Figure 2 This is a framework diagram of the CNN-LSTM-Attention neural network of the present invention.

[0102] Figure 3 This is a flow chart of the CPO algorithm of the present invention. DETAILED DESCRIPTION

[0103] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0104] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0105] like Figure 1-3 As shown, the present invention provides a bus route passenger flow prediction method based on CPO algorithm optimization deep neural network, comprising the following steps:

[0106] Step 1: Data collection and organization; obtain multi-source data and pre-process the data; multi-source data includes: passenger flow statistics, weather data, route station data and POI data; passenger flow statistics include: data creation time, route ID, i.e. bus route number, vehicle ID, i.e. bus vehicle number, station number, i.e. station number in a certain direction on the route, up or down, number of boardings, i.e. number of boardings at the current station, number of alightings, i.e. number of alightings at the current station, and card swiping ID, i.e. number of card swipeers at the current station;

[0107] Weather data includes: date and time, weather conditions, wind speed, temperature and precipitation obtained from China Meteorological Data Network;

[0108] The line site data includes: line number, line name, site number, line direction, site number, site name and site geographical location;

[0109] POI data includes: POI number, POI name, POI category and POI geographic location.

[0110] Step 2: Mining features in the public transportation system; the features include: time feature values, weather feature values, and point of interest feature values; the process of obtaining time feature values ​​includes the following steps:

[0111] Extract the day of the week information A from the date and time; from Monday to Sunday, the value range of A is [1, 7];

[0112] Extract hour information B, where the value range of B is [0, 23];

[0113] The week information A and hour information B are combined into a value by weighted summation, which is the time feature value;

[0114] Time characteristic value = mA + nB;

[0115] Among them, m represents the weight of the week information; n represents the weight of the hour information.

[0116] The process of obtaining weather characteristic values ​​includes the following steps:

[0117] For wind force level C, the value range of wind force level C is [0, 12], and wind force level C is multiplied by a certain coefficient p to obtain the wind force characteristic value;

[0118] The temperature D is first normalized. Let the lowest temperature in history be recorded as min_temp and the highest temperature be recorded as max_temp. Then the normalized temperature temp_normalized is:

[0119] temp_normalized=(temperature-min_temp) / (max_temp-min_temp);

[0120] And multiply the temperature D by a certain coefficient q to obtain the temperature characteristic value;

[0121] The precipitation E is first binarized. If the precipitation is greater than 0, it is assigned a value of 1, and the assigned value is multiplied by a weight k to obtain the precipitation characteristic value; if the precipitation is 0, it is assigned a value of 0, and the assigned value is multiplied by a weight k to obtain the precipitation characteristic value;

[0122] The weather characteristic value is obtained by summing the wind characteristic value, temperature characteristic value and precipitation characteristic value.

[0123] The acquisition of interest point feature values ​​includes the following steps:

[0124] For different types of POI, weights are roughly assigned according to their attractiveness to passenger flow, the number of various POIs around bus stops is counted, and the characteristic values ​​of different POIs are calculated;

[0125] For the distances from the bus stops related to longitude and latitude, calculate the distance from each point of interest to the corresponding bus stop, set the maximum distance record as max_distance, and normalize the distance: distance_normalized = distance / max_distance; then calculate the average of the normalized distances of all points of interest, and multiply it by a weight to obtain the geographic location feature values ​​of different points of interest;

[0126] The feature values ​​of different points of interest and the feature values ​​of different geographical locations of points of interest are added together to obtain the feature values ​​of the points of interest.

[0127] Step 3: Integrate the features of the bus system into the passenger flow prediction model; the passenger flow prediction model includes: data input layer, CPO optimization layer, feature extraction layer, attention mechanism layer, time series prediction layer and full connection layer;

[0128] Optimize the CPO optimization layer and build a CNN-LSTM-Attention model; the CPO optimization layer optimizes the hidden layer parameters of LSTM, the learning rate of the Adam optimizer, and the L2 regularization coefficient in the bus passenger flow prediction based on the defensive behavior of the porcupine;

[0129] Step 4: Use the training set to train the CNN-LSTM-Attention model obtained in step 3;

[0130] Step 5: Calculate the fitness function of the CPO optimization layer through the validation set, output the performance evaluation and passenger flow prediction results, and obtain the verified CNN-LSTM-Attention model;

[0131] Step 6: Apply the verified CNN-LSTM-Attention model to predict bus route passenger flow.

[0132] The optimization of the CPO optimization layer includes the following steps:

[0133] Step 31: Define the optimization problem;

[0134] Determine the decision variables: Let x1 be the LSTM hidden layer parameter, i.e. the number of neurons; let x2 be the initial learning rate of the Adam optimizer; let x3 be the L2 regularization coefficient;

[0135] Determine the fitness function: The goal is to minimize the error of bus passenger flow prediction. Suppose the prediction value of the data set is The actual value is y, the number of samples is n, and the fitness formula is:

[0136]

[0137] Determine the constraints: Determine the value range of LSTM hidden layer parameters, learning rate and regularization coefficient according to the actual situation;

[0138] Step 32: Initialize CPO algorithm parameters; including population size N, maximum number of iterations T max , cycle number related parameters T, minimum population size N min , threshold parameter T f and the convergence speed factor α;

[0139] Step 33: Initialize the population; randomly initialize the population within the value range of the decision variable, and each individual represents a combination of a set of LSTM hidden layer parameters, learning rate and regularization coefficient;

[0140] Step 34: Evaluate the fitness of each individual in the population; train the LSTM model using the initialized parameters and calculate the fitness value of the predicted results;

[0141] Step 35: Update the global optimal solution; find the individual with the smallest fitness value in the current population and take it as the global optimal solution

[0142] Step 36: Circular iterative optimization; for each individual, update according to the exploration and utilization phases of the CPO algorithm;

[0143] Step 361: Simulate the exploration phase of the visual defense mechanism of the crested porcupine: update the individual positions according to a specific formula through the randomly generated values ​​and the current optimal solution to increase the population diversity. The formula is:

[0144]

[0145] in, represents the global optimal solution of the current iteration t, Indicates the current individual The intermediate vector between another randomly selected individual, τ1 represents a random number generated based on a normal distribution, and τ2 represents a random value between 0 and 1;

[0146] Step 362: Simulate the utilization phase of the crested porcupine's odor defense mechanism: Based on the randomly generated values, update the individual position according to the corresponding formula to make the individual move closer to a better solution. In the odor defense mechanism, the formula is:

[0147]

[0148] in, is a random binary vector composed of 0 and 1, used to simulate vectors of different scenarios. Indicates that the odor diffusion factor is calculated by the fitness function value, population size and current iteration number. represents the parameter controlling the search direction, γ t represents the defense factor, which is determined by the random number and the current number of iterations, and τ3 represents a random value between [0,1];

[0149] Step 363: Boundary processing: If the updated individual exceeds the value range of the decision variable, the reflected boundary processing method is used to limit it to within the range. The formula is:

[0150]

[0151] Among them, j=1, 2, 3 correspond to LSTM hidden layer parameters, Adam optimizer learning rate and regularization coefficient respectively;

[0152] Step 364: Update the global optimal solution; after each iteration, compare the best individual in the current population with the global optimal solution. If the current best individual is better, update the global optimal solution.

[0153] Step 365: Check the termination condition. If the maximum number of iterations is reached, stop the optimization; otherwise, recalculate the fitness value step.

[0154] Step 37: Get the optimal solution; after the iteration, the global optimal solution That is, the optimized LSTM hidden layer parameters, Adam optimizer learning rate and L2 regularization coefficient;

[0155] Step 38: Use the optimized parameters to build the CNN-LSTM-Attention model.

[0156] In this application, the CNN-LSTM-Attention model includes: a feature extraction layer, an attention mechanism layer, a temporal feature extraction layer, and a fully connected layer;

[0157] The feature extraction layer extracts and reduces the dimension of nonlinear features through a multi-layer one-dimensional convolutional neural network;

[0158] The attention mechanism layer adds both SE attention mechanism and point product attention mechanism after the feature extraction layer structure;

[0159] The temporal feature extraction layer consists of a multi-layer long short-term memory network, which is used to extract the temporal features of the passenger flow sequence;

[0160] Fully connected layers transform the input data into the desired output format.

[0161] The SE attention mechanism is used to recalibrate the channel dimension of the feature map output by CNN, including the following steps:

[0162] A. Squeeze operation is global information embedding; set the input feature map to X∈R H×W×C , where H represents the height of the feature map, W represents the width of the feature map, and C represents the number of channels of the feature map;

[0163] The spatial information H×W is compressed by global average pooling to obtain a 1×1×C vector z, the formula is:

[0164]

[0165] Among them, x c (i,h) represents the element at position (i,j) of the cth channel.

[0166] B. Excitation operation is adaptive channel adjustment: z is passed through two fully connected layers FC and an activation function to obtain the channel attention weight s; the dimension of z is reduced from C to C / r through a fully connected layer, and then the dimension is restored to C through the ReLU activation function and another fully connected layer. Finally, the value of s is mapped to the interval through the Sigmoid function, and the channel attention weight formula is obtained as follows:

[0167] s = σ(W2ReLU(W1z));

[0168] in, r represents a scaling ratio used to reduce the number of parameters, and σ represents the Sigmoid function;

[0169] C. Scale operation is feature recalibration: multiply the obtained attention weights by the original input feature map channel by channel to obtain the feature map adjusted by the attention mechanism The formula is:

[0170]

[0171] Among them, c=1,2,…,C.

[0172] The dot-product attention mechanism weights different features in historical data, and the formula is:

[0173]

[0174] Among them, Q represents the query matrix, that is, the information currently being paid attention to; K represents the key matrix; V represents the value matrix;

[0175] In the attention mechanism, the weighted sum is calculated according to the weights to obtain the final feature representation of attention; the softmax function is a normalization function. After the softmax function, the sum of the attention weights of each row is 1; d k is the dimension of the key vector, divided by This is to prevent the dot product result from being too large, causing the softmax function gradient to disappear or explode.

[0176] Time series feature extraction layer: It is mainly composed of multi-layer long short-term memory network (LSTM), which is used to extract the time series features of passenger flow sequence. LSTM is a recurrent neural network (RNN) that has memory ability and can effectively handle long-term dependency problems in time series data. Unlike RNN, each unit of the LSTM model is different from the unit of RNN. It introduces a gate mechanism to control the flow and loss of features. Each cell contains an input gate, a forget gate, an output gate, and a storage memory unit, thereby realizing the long-term memory of the neural network. At the same time, LSTM can avoid the gradient vanishing problem of RNN. The multi-layer long short-term memory network used in this paper can effectively extract the time series features of passenger flow sequence, capture the long-term time series dependency between data, and improve the prediction accuracy.

[0177] (1) The calculation formula of the Forget Gate is:

[0178] f t =σ(W f ·[h t-1 ,x t ]+b f );

[0179] Among them, W f is the weight matrix corresponding to the forget gate, which concatenates the vector [h t-1 ,x t ]Hidden state h at the last moment t-1 and the current input x t concatenate on the dimension) to the appropriate dimension for subsequent calculation. f is the bias vector corresponding to the forget gate. σ is the activation function, usually a sigmoid function, whose output value range is between (0,1). This value is used to determine how much past memory information to forget, such as f t If an element is close to 0, it means that the corresponding memory information is about to be mostly forgotten, and if it is close to 1, it means that most of it is retained.

[0180] (2) The input gate contains two calculation formulas:

[0181] i t =σ(W i ·[h t-1 ,x t ]+b i );

[0182]

[0183] For i t Calculation of W i is the input gate weight matrix, b i is the bias vector, and σ is the sigmoid function. Here i t Determines the extent to which the current input information is updated to the memory unit, and its value range is (0,1). Calculation of W c is the weight matrix for generating candidate memory cell states, b c is the corresponding bias vector, tanh is the hyperbolic tangent activation function, and its output range is (-1,1). It obtains the candidate memory information at the current moment, and the memory unit will be updated later in combination with the value of the input gate.

[0184] (3) The memory cell update formula is:

[0185]

[0186] Here, element-level multiplication (denoted by ⊙) is used to store the last memory unit f after the forget gate is applied. t ⊙c t-1 and the current candidate memory information filtered by the input gate Add them together to get the updated memory cell state c at the current moment t .

[0187] (4) The output gate and hidden state output formula are:

[0188] o t =σ(W o ·[h t-1 ,x t ]+b o );

[0189] h t =o t ⊙tanh(c t );

[0190] For o t Calculation of W o is the weight matrix of the output gate, b ois the bias vector, which is used to get the value of the output gate through the sigmoid function, which determines how much information in the memory cell can be output. Finally, the hidden state h at the current moment t By output gate o t and the memory cell state c after tanh activation t It is obtained through element-level multiplication, which means that the feature information output by the network at the current moment will be passed to the next time step to continue to participate in the calculation or used as the final output for subsequent tasks.

[0191] Example 1

[0192] The CNN-LSTM-attention model optimized by the CPO algorithm was trained using the characteristic data of a certain line in City A and the passenger flow data every 15 minutes. During the training process, adaptive learning rate adjustment, regularization and other technologies were used to prevent the model from overfitting and improve the generalization ability of the model. Through multiple experiments and CPO automatic hyperparameter tuning, the current indicators of the model on the training set are as follows:

[0193] Table 2.1 Experimental environment configuration list

[0194]

[0195] Table 2.2 Experimental parameter configuration table

[0196]

[0197]

[0198] The passenger flow of a certain route in City A from December 1 to 15, 2021 was selected for a passenger flow prediction experiment

[0199] Table 2.3 Prediction results of each model for passenger flow on the route

[0200]

[0201] By comparing various basic models, it can be found that the bus line passenger flow prediction method based on the CPO algorithm to improve the deep neural network has the best fitting degree when all errors are the lowest.

[0202] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0203] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0204] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0205] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0206] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0207] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0208] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A bus route passenger flow prediction method based on CPO algorithm optimized deep neural network, characterized in that: The following steps are involved: Step 1: Data collection and organization; Acquire multi-source data and pre-process the data; The multi-source data includes: passenger flow statistics data, weather data, route station data and POI point of interest data; Step 2: mining features in the public transportation system; the features include: time feature values, weather feature values, and point of interest feature values; Step 3: Integrate the features of the public transportation system into the passenger flow prediction model; the passenger flow prediction model includes: a data input layer, a CPO optimization layer, a feature extraction layer, an attention mechanism layer, a time series prediction layer and a fully connected layer; Optimizing the CPO optimization layer and constructing a CNN-LSTM-Attention model; the CPO optimization layer optimizes the hidden layer parameters of the LSTM, the learning rate of the Adam optimizer, and the L2 regularization coefficient in the bus passenger flow prediction according to the defensive behavior of the porcupine; Step 4: Use the training set to train the CNN-LSTM-Attention model obtained in step 3; Step 5: Calculate the fitness function of the CPO optimization layer through the validation set, output the performance evaluation and passenger flow prediction results, and obtain the verified CNN-LSTM-Attention model; Step 6: Apply the verified CNN-LSTM-Attention model to predict the passenger flow of bus routes.

2. The bus route passenger flow prediction method based on CPO algorithm optimization deep neural network according to claim 1 is characterized in that: The passenger flow statistics data include: data creation time, line ID, i.e., the number of the bus line, vehicle ID, i.e., the number of the bus vehicle, station number, i.e., the number of stations in a certain direction on the line, up or down, number of passengers getting on, i.e., the number of passengers getting off, i.e., the number of passengers getting off at the current station, and card swiping ID, i.e., the number of card swipers at the current station; The weather data includes: date and time, weather conditions, wind speed, temperature and precipitation obtained from China Meteorological Data Network; The line site data includes: line number, line name, site number, line direction, site number, site name and site geographical location; The POI data includes: POI number, POI name, POI category and POI geographic location.

3. The bus route passenger flow prediction method based on CPO algorithm optimization deep neural network according to claim 1 is characterized in that: The process of obtaining the time characteristic value comprises the following steps: Extract the day of the week information A from the date and time; from Monday to Sunday, the value range of A is [1, 7]; Extract hour information B, where the value range of B is [0, 23]; The week information A and hour information B are combined into a value by weighted summation, which is the time feature value; Time characteristic value = mA + nB; Among them, m represents the weight of the week information; n represents the weight of the hour information.

4. The bus route passenger flow prediction method based on CPO algorithm optimization deep neural network according to claim 1 is characterized in that: The process of obtaining the weather characteristic value comprises the following steps: For wind force level C, the value range of wind force level C is [0, 12], and the wind force level C is multiplied by a certain coefficient p to obtain a wind force characteristic value; The temperature D is first normalized. Let the lowest temperature in history be recorded as min_temp and the highest temperature be recorded as max_temp. Then the normalized temperature temp_normalized is: temp_normalized=(temperature-min_temp) / (max_temp-min_temp); And multiply the temperature D by a certain coefficient q to obtain a temperature characteristic value; The precipitation E is first binarized. If the precipitation is greater than 0, it is assigned a value of 1, and the assigned value is multiplied by a weight k to obtain the precipitation characteristic value; if the precipitation is 0, it is assigned a value of 0, and the assigned value is multiplied by a weight k to obtain the precipitation characteristic value; The weather characteristic value is obtained by summing the wind characteristic value, temperature characteristic value and precipitation characteristic value.

5. The bus route passenger flow prediction method based on CPO algorithm optimization deep neural network according to claim 1 is characterized in that: The acquisition of the feature value of the point of interest comprises the following steps: For different types of POI, weights are roughly assigned according to their attractiveness to passenger flow, the number of various POIs around bus stops is counted, and the characteristic values ​​of different POIs are calculated; For the distances from the bus stops related to longitude and latitude, calculate the distance from each point of interest to the corresponding bus stop, set the maximum distance record as max_distance, and normalize the distance: distance_normalized = distance / max_distance; then calculate the average of the normalized distances of all points of interest, and multiply it by a weight to obtain the geographic location feature values ​​of different points of interest; The feature values ​​of different points of interest and the feature values ​​of different geographical locations of points of interest are added together to obtain the feature values ​​of the points of interest.

6. The bus route passenger flow prediction method based on CPO algorithm optimized deep neural network according to claim 1 is characterized in that: The optimization of the CPO optimization layer includes the following steps: Step 31: Define the optimization problem; Determine the decision variables: Let x1 be the LSTM hidden layer parameter, i.e. the number of neurons; let x2 be the initial learning rate of the Adam optimizer; let x3 be the L2 regularization coefficient; Determine the fitness function: The goal is to minimize the error of bus passenger flow prediction. Suppose the prediction value of the data set is The actual value is y, the number of samples is n, and the fitness formula is: Determine the constraints: Determine the value range of LSTM hidden layer parameters, learning rate and regularization coefficient according to the actual situation; Step 32: Initialize CPO algorithm parameters; including population size N, maximum number of iterations T max , cycle number related parameters T, minimum population size N min , threshold parameter T f and the convergence speed factor α; Step 33: Initialize the population; randomly initialize the population within the value range of the decision variable, and each individual represents a combination of a set of LSTM hidden layer parameters, learning rate and regularization coefficient; Step 34: Evaluate the fitness of each individual in the population; train the LSTM model using the initialized parameters and calculate the fitness value of the predicted results; Step 35: Update the global optimal solution; find the individual with the smallest fitness value in the current population and take it as the global optimal solution Step 36: Circular iterative optimization; for each individual, update according to the exploration and utilization phases of the CPO algorithm; Step 37: Get the optimal solution; after the iteration, the global optimal solution That is, the optimized LSTM hidden layer parameters, Adam optimizer learning rate and L2 regularization coefficient; Step 38: Use the optimized parameters to build the CNN-LSTM-Attention model.

7. The bus route passenger flow prediction method based on CPO algorithm optimization deep neural network according to claim 1 is characterized in that: The step 36 comprises the following steps: Step 361: Simulate the exploration phase of the visual defense mechanism of the crested porcupine: update the individual positions according to a specific formula through the randomly generated values ​​and the current optimal solution to increase the population diversity. The formula is: in, represents the global optimal solution of the current iteration t, Indicates the current individual The intermediate vector between another randomly selected individual, τ1 represents a random number generated based on a normal distribution, and τ2 represents a random value between 0 and 1; Step 362: Simulate the utilization phase of the crested porcupine's odor defense mechanism: Based on the randomly generated values, update the individual position according to the corresponding formula to make the individual move closer to a better solution. In the odor defense mechanism, the formula is: in, is a random binary vector composed of 0 and 1, used to simulate vectors of different scenarios. Indicates that the odor diffusion factor is calculated by the fitness function value, population size and current iteration number. represents the parameter controlling the search direction, γ t represents the defense factor, which is determined by the random number and the current number of iterations, and τ3 represents a random value between [0,1]; Step 363: Boundary processing: If the updated individual exceeds the value range of the decision variable, the reflected boundary processing method is used to limit it to within the range. The formula is: Among them, j=1, 2, 3 correspond to LSTM hidden layer parameters, Adam optimizer learning rate and regularization coefficient respectively; Step 364: Update the global optimal solution; after each iteration, compare the best individual in the current population with the global optimal solution. If the current best individual is better, update the global optimal solution. Step 35: Check the termination condition. If the maximum number of iterations is reached, stop the optimization; otherwise, recalculate the fitness value step.

8. The bus route passenger flow prediction method based on CPO algorithm optimization deep neural network according to claim 1 is characterized in that: The CNN-LSTM-Attention model includes: a feature extraction layer, an attention mechanism layer, a temporal feature extraction layer, and a fully connected layer; The feature extraction layer extracts and reduces the dimension of nonlinear features through a multi-layer one-dimensional convolutional neural network; The attention mechanism layer adds both the SE attention mechanism and the dot product attention mechanism after the feature extraction layer structure; The temporal feature extraction layer is composed of a multi-layer long short-term memory network, which is used to extract the temporal features of the passenger flow sequence; The fully connected layers transform the input data into the desired output format.

9. The bus route passenger flow prediction method based on CPO algorithm optimization deep neural network according to claim 8 is characterized in that: The SE attention mechanism is used to recalibrate the channel dimension of the feature map output by the CNN, including the following steps: A. Squeeze operation is global information embedding; set the input feature map to X∈R H×W×C , where H represents the height of the feature map, W represents the width of the feature map, and C represents the number of channels of the feature map; The spatial information H×W is compressed by global average pooling to obtain a 1×1×C vector z, the formula is: Among them, x c (i,j) represents the element at position (i,j) of the cth channel. B. Excitation operation is adaptive channel adjustment: z is passed through two fully connected layers FC and an activation function to obtain the channel attention weight s; the dimension of z is reduced from C to C / r through a fully connected layer, and then the dimension is restored to C through the ReLU activation function and another fully connected layer. Finally, the value of s is mapped to the interval through the Sigmoid function, and the channel attention weight formula is obtained as follows: s = σ(W2ReLU(W1z)); in, r represents a scaling ratio used to reduce the number of parameters, and σ represents the Sigmoid function; C. Scale operation is feature recalibration: multiply the obtained attention weights by the original input feature map channel by channel to obtain the feature map adjusted by the attention mechanism The formula is: Among them, c=1,2,…,C.

10. The method for predicting passenger flow of public transportation routes based on CPO algorithm-optimized deep neural network according to claim 8, characterized in that: The point product attention mechanism weights different features in the historical data, and the formula is: Among them, Q represents the query matrix, that is, the information currently being paid attention to; K represents the key matrix; V represents the value matrix; In the attention mechanism, the weighted sum is calculated according to the weights to obtain the final feature representation of attention; the softmax function is a normalization function. After the softmax function, the sum of the attention weights of each row is 1; d k is the dimension of the key vector, divided by This is to prevent the dot product result from being too large, causing the softmax function gradient to disappear or explode.

Citation Information

Cited By

  • Lithium ion battery life prediction method based on multi-model data driving

    CN120490825A

  • Bus automatic driving method and system

    CN121191345A