Traffic volume prediction method for optimizing Prophet based on genetic algorithm

Through the optimization method based on genetic algorithm, the hyperparameter combination of Prophet model is optimized, and the problems of limited performance and overfitting of traffic prediction models in the prior art are solved, and traffic prediction with higher quality and generalization capabilities are achieved.

CN119862982APending Publication Date: 2025-04-22云南公路联网收费管理有限公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411776381.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

The prior art is prone to falling into local minimum values ​​in traffic prediction, making it difficult to find the global optimal weight and bias combination, resulting in limited model performance, slow convergence speed, and overfitting problems may occur, affecting generalization ability.

Method used

The optimization method based on genetic algorithm is adopted, and the hyperparameter combination of the Prophet model is optimized through customization of the fitness function and the selection, intersection and variation operations of the genetic algorithm, and the combination that bests the model prediction performance is found.

Benefits of technology

Effectively breaking out of local optimization improves the model's global optimization ability, reduces the tedious work of manual parameter adjustment, and improves the quality and generalization ability of traffic volume prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862982A_ABST
    Figure CN119862982A_ABST
Patent Text Reader

Abstract

The invention discloses a traffic volume prediction method for optimizing Prophet based on a genetic algorithm, and belongs to the technical field of artificial intelligence algorithms and machine learning. Historical traffic data of an expressway is collected, preprocessed and divided to obtain training sample data and test sample data; performing hyper-parameter optimization on the Prophet model according to a genetic algorithm for obtaining a self-defined fitness function according to the fitness function to obtain an optimal Prophet model, and finally predicting the traffic volume according to the optimal Prophet model. According to the invention, the genetic algorithm simulates a genetic evolution mechanism in nature to find out a hyper-parameter combination which enables the prediction performance of the Prophet model to be optimal, and finally traffic volume prediction is carried out through the optimal Prophet model to improve the quality of traffic volume prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of artificial intelligence algorithms and machine learning, and specifically relates to a traffic volume prediction method based on genetic algorithm optimization of Prophet. Background Art

[0002] With the continuous improvement of highway data collection technology and equipment, the prediction of short-term traffic volume has become possible. By establishing and improving the prediction model, the short-term traffic volume of highways can be predicted, which is of great significance for optimizing traffic flow, reducing congestion, and improving traffic safety. This prediction not only involves the amount of traffic volume, but also includes the distribution of traffic volume and path selection, which is one of the core contents of traffic planning. The accuracy of traffic demand prediction has a vital impact on the scientificity and rationality of planning and design schemes, so it occupies a core position in traffic planning.

[0003] In the prior art, a multi-layer feedforward neural network including an input layer, a hidden layer (there may be one or more hidden layers) and an output layer is used. The input layer nodes receive input feature data (which may be historical traffic volume, relevant influencing factors and other information), and the neurons in the hidden layer perform nonlinear transformation on the data transmitted from the input layer to extract more complex features. Each neuron works in a manner similar to the weighted summation plus activation function processing of a single-layer perceptron. The output layer performs corresponding calculations based on the output of the hidden layer and finally outputs the prediction results.

[0004] However, this existing technology is prone to falling into local minima, which makes it impossible to find the globally optimal combination of weights and biases, limiting the model performance; the convergence speed is slow, especially when the network structure is complex and the amount of data is large, and a longer training time is required to achieve better results; in addition, there may be overfitting problems, that is, it fits the training data well but performs poorly on new test data, affecting its generalization ability for traffic volume prediction. Summary of the invention

[0005] In order to solve the above problems existing in the prior art, the present invention is implemented by the following technical solutions:

[0006] The present invention provides a traffic volume prediction method based on genetic algorithm optimization Prophet, comprising the following steps:

[0007] Collecting historical highway traffic data and performing preprocessing to obtain preprocessed historical highway traffic data, and dividing the preprocessed historical highway traffic data to obtain training sample data and test sample data;

[0008] A genetic algorithm that obtains a custom fitness function based on the fitness function;

[0009] The Prophet model is optimized by combining hyperparameters according to the genetic algorithm with a custom fitness function to obtain the optimal Prophet model.

[0010] New highway historical traffic data is collected and preprocessed to obtain new preprocessed highway historical traffic data, and the new preprocessed highway historical traffic data is predicted according to the optimal Prophet model.

[0011] Furthermore, the genetic algorithm for obtaining the custom fitness function according to the fitness function includes defining the fitness function, evaluating the fitness of the Prophet model hyperparameter combination, selecting the Prophet model hyperparameter combination according to the fitness, and cross-mutating the Prophet model hyperparameter combination.

[0012] Furthermore, defining the fitness function includes: using training sample data to train the Prophet model to obtain a traffic volume prediction value, and defining the fitness function according to the traffic volume prediction value and the actual traffic volume value.

[0013] Furthermore, the formula for defining the fitness function is:

[0014]

[0015] Among them, MSE is the fitness function, n is the number of test sample data, y i is the true value of traffic volume, y1 i is the traffic volume forecast value.

[0016] Furthermore, evaluating the fitness of the hyperparameter combination of the Prophet model includes: substituting the hyperparameters in each hyperparameter combination of the Prophet model into the Prophet model to predict the data in the training set to obtain a predicted value sequence, and calculating the fitness value of the hyperparameter combination according to the fitness function by comparing the predicted value sequence and the corresponding real sequence in the training sample data.

[0017] Furthermore, the calculation formula for selecting the Prophet model hyperparameter combination based on fitness is:

[0018]

[0019] Among them, P i is the probability of the i-th hyperparameter combination of the Prophet model being selected, m is the number of hyperparameter combinations of the Prophet model, and F i is the fitness value of the i-th hyperparameter combination of the Prophet model, F h is the fitness value of the i-th hyperparameter combination of the Prophet model, where i and j are calculation parameters.

[0020] Furthermore, the crossover mutation of the Prophet model hyperparameter combination includes: randomly selecting the intersection point of two parent Prophet model hyperparameter combinations, crossing the two parent Prophet model hyperparameter combinations according to the intersection point to obtain the crossed hyperparameter combination; traversing the encoding of each group of hyperparameter combinations of the Prophet model and mutating them according to the mutation probability to obtain the mutated hyperparameter combination.

[0021] Furthermore, the Prophet model is expressed as:

[0022] y(t)=g(t)+s(t)+h(t)+ε(t)

[0023] Among them, g(t) represents the trend term, which describes the non-periodic changing trend of the time series; s(t) represents the periodic term, which reflects the periodic changes; h(t) represents the holiday term, which reflects the impact of holidays with non-fixed periods in the time series on the predicted value; ε(t) is the error term, which represents unpredicted fluctuations and obeys Gaussian distribution.

[0024] Compared with the prior art, the present invention has the following beneficial effects:

[0025] The genetic algorithm in the present invention simulates the genetic evolution mechanism of nature, adopts operations such as selection, crossover, and mutation, and continuously searches in the entire solution space based on the fitness function measured by the mean square error, effectively jumps out of the local optimum, and finds the hyperparameter combination that makes the Prophet model predict the best performance. While reducing the tedious work of manual parameter adjustment, it has a stronger global optimization ability, and finally uses the optimal Prophet model to perform traffic volume prediction, thereby improving the quality of traffic volume prediction.

[0026] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 It is a flow chart of a traffic volume prediction method based on genetic algorithm optimization Prophet provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the scheme according to the present invention is described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0029] The above and other technical contents, features and effects of the present invention are clearly presented in the following detailed description of the specific implementation modes in conjunction with the accompanying drawings. Through the description of the specific implementation modes, the technical means and effects adopted by the present invention to achieve the predetermined purpose can be more deeply and specifically understood. However, the attached drawings are only for reference and explanation purposes and are not used to limit the technical solutions of the present invention.

[0030] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants are intended to cover non-exclusive inclusion, so that an article or device including a series of elements includes not only those elements, but also other elements that are not explicitly listed. In the absence of more restrictions, the elements defined by the statement "including one..." do not exclude the existence of other identical elements in the article or device including the elements.

[0031] like Figure 1 FIG. 1 is a flow chart of a traffic volume prediction method based on genetic algorithm optimization of Prophet provided by an embodiment of the present invention, comprising the following steps:

[0032] Step 1: Collect historical highway traffic data and perform preprocessing to obtain preprocessed historical highway traffic data, and divide the preprocessed historical highway traffic data into training sample data and test sample data.

[0033] The preprocessed highway historical traffic data is divided by random sampling. Suppose the preprocessed highway historical traffic data is N, and the data is divided according to the ratio of 80% as training sample data and 20% as test sample data.

[0034] Step 2: Obtain a genetic algorithm with a custom fitness function based on the fitness function.

[0035] The genetic algorithm for obtaining a custom fitness function according to the fitness function includes defining the fitness function, evaluating the fitness of the Prophet model hyperparameter combination, selecting the Prophet model hyperparameter combination according to the fitness, and cross-mutating the Prophet model hyperparameter combination.

[0036] Defining the fitness function includes: using training sample data to train the Prophet model to obtain traffic volume prediction values, and defining the fitness function according to the traffic volume prediction values ​​and the actual traffic volume values.

[0037] Among them, the formula for defining the fitness function is:

[0038]

[0039] Among them, MSE is the fitness function, n is the number of test sample data, y i is the true value of traffic volume, y1 i is the traffic volume prediction value, the actual traffic volume y i The traffic volume prediction value y1 is obtained through the test sample data. i The Prophet model is trained using training sample data.

[0040] Evaluating the fitness of the Prophet model hyperparameter combination includes: substituting the hyperparameters in each hyperparameter combination of the Prophet model into the Prophet model to predict the data in the training set to obtain a predicted value sequence, and calculating the fitness value of the hyperparameter combination according to the fitness function using the predicted value sequence and the corresponding real sequence in the training sample data. The fitness value calculation formula is:

[0041]

[0042] Among them, MSE is the fitness function and F is the fitness value.

[0043] The calculation formula for selecting the Prophet model hyperparameter combination based on fitness is:

[0044]

[0045] Among them, P i is the probability of the i-th hyperparameter combination of the Prophet model being selected, m is the number of hyperparameter combinations of the Prophet model, and F i is the fitness value of the i-th hyperparameter combination of the Prophet model, F j is the fitness value of the i-th hyperparameter combination of the Prophet model, where i and j are calculation parameters.

[0046] The crossover mutation of the Prophet model hyperparameter combination includes: randomly selecting a crossover point c of two parent Prophet model hyperparameter combinations, and crossing the two parent Prophet model hyperparameter combinations according to the crossover point to obtain a crossover hyperparameter combination.

[0047] Specifically, the codes from the first to the cth bit of the first parent Prophet model hyperparameter combination in the two parent Prophet model hyperparameter combinations are concatenated with the codes from the c+1th bit to the last bit of the second parent Prophet model hyperparameter combination in the two parent Prophet model hyperparameter combinations to form a new first parent Prophet model hyperparameter combination; at the same time, the codes from the first to the cth bit of the second parent Prophet model hyperparameter combination are concatenated with the codes from the c+1th bit to the last bit of the first parent Prophet model hyperparameter combination to form a new second parent Prophet model hyperparameter combination.

[0048] Traverse the encoding of each set of hyperparameter combinations in the Prophet model and mutate them according to the set mutation probability to obtain the mutated hyperparameter combination.

[0049] The Prophet model is expressed as:

[0050] y(t)=g(t)+s(t)+h(t)+ε(t)

[0051] Among them, g(t) represents the trend term, which describes the non-periodic changing trend of the time series; s(t) represents the periodic term, which reflects the periodic changes; h(t) represents the holiday term, which reflects the impact of holidays with non-fixed periods in the time series on the predicted value; ε(t) is the error term, which represents the fluctuations not predicted by the model and obeys the Gaussian distribution.

[0052] Step 3: Use the genetic algorithm with a custom fitness function to optimize the hyperparameter combination of the Prophet model to obtain the optimal Prophet model.

[0053] By continuously iterating the selection of Prophet model hyperparameter combinations according to fitness in step 2 and the cross-mutation of Prophet model hyperparameter combinations, new Prophet model hyperparameter combinations are continuously generated, and the fitness of each hyperparameter combination of the Prophet model is evaluated according to the fitness function using the training sample data. The hyperparameter combination with high fitness is selected for the next round of iteration until the termination condition is met and the hypercombination parameters with the highest fitness are obtained. According to the hyperparameter combination with the highest fitness, the optimal Prophet model after genetic algorithm optimization is obtained.

[0054] Among them, the termination condition is that the change in fitness value is less than the set threshold or reaches the set number of iterations.

[0055] Step 4: Collect new highway historical traffic data and preprocess them to obtain new preprocessed highway historical traffic data. Predict the new preprocessed highway historical traffic data according to the optimal Prophet model to obtain the final predicted traffic volume.

[0056] The present embodiment provides a traffic volume prediction method based on genetic algorithm optimization of Prophet, which collects historical highway traffic data and pre-processes and divides them to obtain training sample data and test sample data, obtains a genetic algorithm with a custom fitness function according to a fitness function, and then optimizes the hyperparameters of the Prophet model according to the genetic algorithm with the custom fitness function to obtain an optimal Prophet model, and finally predicts the traffic volume according to the optimal Prophet model; the genetic algorithm in the present invention simulates the genetic evolution mechanism of nature, adopts operations such as selection, crossover, and mutation, and continuously searches in the entire solution space based on the fitness function measured by the mean square error, effectively jumps out of the local optimum, and finds the hyperparameter combination that makes the Prophet model predict the best performance, while reducing the tedious work of manual parameter adjustment, it has a stronger global optimization ability, and finally predicts the traffic volume through the optimal Prophet model, thereby improving the quality of traffic volume prediction.

[0057] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the scope of protection of the present invention.

Claims

1. A traffic volume forecasting method based on genetic algorithm optimized Prophet, characterized in that: The following steps are involved: Collecting historical highway traffic data and performing preprocessing to obtain preprocessed historical highway traffic data, and dividing the preprocessed historical highway traffic data to obtain training sample data and test sample data; A genetic algorithm that obtains a custom fitness function based on the fitness function; The Prophet model is optimized by combining hyperparameters according to the genetic algorithm with a custom fitness function to obtain the optimal Prophet model. New highway historical traffic data is collected and preprocessed to obtain new preprocessed highway historical traffic data, and the new preprocessed highway historical traffic data is predicted according to the optimal Prophet model.

2. A traffic volume prediction method based on genetic algorithm optimization Prophet according to claim 1, characterized in that: The genetic algorithm for obtaining a custom fitness function according to the fitness function includes defining a fitness function, evaluating the fitness of a Prophet model hyperparameter combination, selecting a Prophet model hyperparameter combination according to the fitness, and performing crossover and mutation of the Prophet model hyperparameter combination.

3. The traffic volume prediction method based on genetic algorithm optimization Prophet according to claim 2 is characterized in that: Defining the fitness function includes: using training sample data to train the Prophet model to obtain traffic volume prediction values, and defining the fitness function according to the traffic volume prediction values ​​and the actual traffic volume values.

4. The traffic volume prediction method based on genetic algorithm optimized Prophet according to claim 3 is characterized in that: The formula for defining the fitness function is: Among them, MSE is the fitness function, n is the number of test sample data, y i is the true value of traffic volume, y1 i is the traffic volume forecast value.

5. The traffic volume prediction method based on genetic algorithm optimization Prophet according to claim 2 is characterized in that: Evaluating the fitness of the Prophet model hyperparameter combination includes: substituting the hyperparameters in each hyperparameter combination of the Prophet model into the Prophet model to predict the data in the training set to obtain a predicted value sequence, and calculating the fitness value of the hyperparameter combination according to the fitness function by comparing the predicted value sequence and the corresponding real sequence in the training sample data.

6. The traffic volume prediction method based on genetic algorithm optimized Prophet according to claim 2 is characterized in that: The calculation formula for selecting the Prophet model hyperparameter combination based on fitness is: Among them, P i is the probability of the i-th hyperparameter combination of the Prophet model being selected, m is the number of hyperparameter combinations of the Prophet model, and F i is the fitness value of the i-th hyperparameter combination of the Prophet model, F j is the fitness value of the i-th hyperparameter combination of the Prophet model, where i and j are calculation parameters.

7. The traffic volume prediction method based on genetic algorithm optimization Prophet according to claim 2 is characterized in that: The crossover mutation of the Prophet model hyperparameter combination includes: randomly selecting the intersection point of two parent Prophet model hyperparameter combinations, crossing the two parent Prophet model hyperparameter combinations according to the intersection point to obtain the crossed hyperparameter combination; traversing the encoding of each group of hyperparameter combinations of the Prophet model and mutating them according to the mutation probability to obtain the mutated hyperparameter combination.

8. The traffic volume prediction method based on genetic algorithm optimized Prophet according to claim 1 is characterized in that: The Prophet model is expressed as: y(t)=g(t)+s(t)+h(t)+ε(t) Among them, g(t) represents the non-periodic trend of the time series; s(t) represents the periodic term, reflecting the periodic changes; h(t) represents the holiday term, reflecting the impact of holidays with non-fixed periods in the time series on the predicted value; ε(t) is the error term, representing unpredicted fluctuations, and obeys the Gaussian distribution.