CN117173883A - Urban traffic flow prediction method and system - Google Patents
Urban traffic flow prediction method and system Download PDFInfo
- Publication number
- CN117173883A CN117173883A CN202311085323.0A CN202311085323A CN117173883A CN 117173883 A CN117173883 A CN 117173883A CN 202311085323 A CN202311085323 A CN 202311085323A CN 117173883 A CN117173883 A CN 117173883A
- Authority
- CN
- China
- Prior art keywords
- wavelet
- gru
- prediction
- traffic flow
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 49
- 230000002068 genetic effect Effects 0.000 claims abstract description 23
- 238000013528 artificial neural network Methods 0.000 claims abstract description 21
- 230000009466 transformation Effects 0.000 claims abstract description 11
- 239000010410 layer Substances 0.000 claims description 45
- 210000002569 neuron Anatomy 0.000 claims description 19
- 238000004364 calculation method Methods 0.000 claims description 17
- 230000008859 change Effects 0.000 claims description 16
- 210000000349 chromosome Anatomy 0.000 claims description 15
- 238000012549 training Methods 0.000 claims description 15
- 238000010606 normalization Methods 0.000 claims description 11
- 238000007781 pre-processing Methods 0.000 claims description 11
- 238000005457 optimization Methods 0.000 claims description 10
- 230000006870 function Effects 0.000 claims description 9
- 238000003672 processing method Methods 0.000 claims description 9
- 238000011478 gradient descent method Methods 0.000 claims description 8
- 230000008569 process Effects 0.000 claims description 7
- 238000012545 processing Methods 0.000 claims description 6
- 238000011156 evaluation Methods 0.000 claims description 5
- 238000013507 mapping Methods 0.000 claims description 5
- 210000004027 cell Anatomy 0.000 claims description 3
- 238000013480 data collection Methods 0.000 claims description 3
- 230000035772 mutation Effects 0.000 claims description 3
- 230000004913 activation Effects 0.000 claims description 2
- 239000002356 single layer Substances 0.000 claims description 2
- 230000001131 transforming effect Effects 0.000 claims 2
- 238000000354 decomposition reaction Methods 0.000 abstract description 24
- 238000010586 diagram Methods 0.000 description 5
- 230000000694 effects Effects 0.000 description 5
- 238000009825 accumulation Methods 0.000 description 4
- 238000012360 testing method Methods 0.000 description 4
- 101001095088 Homo sapiens Melanoma antigen preferentially expressed in tumors Proteins 0.000 description 2
- 102100037020 Melanoma antigen preferentially expressed in tumors Human genes 0.000 description 2
- 230000007774 longterm Effects 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 238000005070 sampling Methods 0.000 description 2
- 238000000926 separation method Methods 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000007418 data mining Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000012804 iterative process Methods 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02A—TECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
- Y02A30/00—Adapting or protecting infrastructure or their operation
- Y02A30/60—Planning or developing urban green infrastructure
Landscapes
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Traffic Control Systems (AREA)
Abstract
The invention provides a method and a system for predicting urban traffic flow, wherein the method comprises the following steps: collecting target urban traffic flow sequence data, carrying out wavelet transformation on the sequence data to obtain wavelet subsequences, carrying out modeling prediction on the subsequences according to a GRU neural network, optimizing super parameters in a GRU network model by using a genetic algorithm, constructing a GA-GRU optimal combination model to obtain optimal subsequence prediction results, carrying out wavelet reconstruction on the optimal prediction results of all the subsequences, and outputting final prediction results. According to the urban traffic flow prediction method, accurate decomposition of sequence data is achieved through wavelet decomposition, sub-sequence modeling prediction is achieved through GRU neural network, a GRU model is optimized through a genetic algorithm to enable the sub-sequence to restore real data, and finally each optimal sub-sequence is reconstructed, so that final accurate prediction of traffic flow data is achieved.
Description
Technical Field
The invention relates to the technical field of traffic management, in particular to a method and a system for predicting urban traffic flow.
Background
In recent years, as the automobile possession increases year by year, traffic congestion becomes more severe, and the traveling safety and the traffic experience of people are affected to some extent, so that efficient prediction of traffic flow is a very important research topic.
Currently, existing prediction methods are mainly classified into short-term prediction and long-term prediction. The short-term prediction can use a mathematical statistics method to process data of traffic flow investigated in the past, and a prediction result is obtained by calculation according to the development rule and trend of the traffic flow; the long-term prediction can be performed by using a traffic prediction model to comprehensively analyze and research the traveling activities of urban residents in the future, and the traffic prediction is performed by steps of people flow distribution, traffic mode division and the like according to land use conditions and road traffic network planning.
However, urban traffic flow is affected by various factors including weather, date, traffic rules, etc., and conventional prediction methods do not fully mine characteristic information of urban traffic flow data, and do not consider the situation that the prediction result is interfered when the fluctuation of the data is large, and it is often difficult to form a stable and accurate urban traffic flow prediction model.
Disclosure of Invention
Based on the method, the invention aims to provide a city traffic flow prediction method, which is based on a combined model of WT-GA-GRU and aims to construct a stable and accurate city traffic flow prediction model by means of data mining of characteristic information of city traffic flow data, analysis of large fluctuation change of the data and the like.
The invention provides a city traffic flow prediction method, which comprises the following steps:
collecting sequence data of the traffic flow of the target city;
performing wavelet transformation on the sequence data to obtain wavelet subsequences on each scale domain;
modeling and predicting each wavelet subsequence according to the GRU neural network to obtain GRU network models corresponding to each wavelet subsequence;
optimizing super parameters in each GRU network model by utilizing a genetic algorithm, and constructing a GA-GRU optimal combination model to obtain optimal prediction results of each wavelet subsequence;
and carrying out wavelet reconstruction on the optimal prediction results of the wavelet subsequences, comprehensively generating a WT-GA-GRU model, and outputting the final prediction result of the target urban traffic flow.
Compared with the prior art, the method has the advantages that through carrying out wavelet decomposition on the traffic flow sequence data into a high-frequency detail component and a low-frequency approximation component, the basic change trend of the urban traffic flow data and disturbance factors of the data are considered, the accurate decomposition of the sequence data under different conditions is realized, and a prediction model is more targeted; modeling is carried out on each subsequence component through the GRU neural network, the fitting effect of a prediction algorithm is better, the prediction accuracy is higher, and the preliminary prediction of each decomposed subsequence is realized; optimizing the super parameters in the GRU network model through a genetic algorithm, and finding and storing the super parameters with the minimum error and the GA-GRU optimal combination model so as to enable the decomposed subsequence to restore the real data change; and finally, carrying out wavelet reconstruction on each optimal subsequence, and generating a WT-GA-GRU prediction model after comprehensive accumulation, thereby further improving the precision of the final prediction result.
Further, the step of performing wavelet transformation on the sequence data to obtain wavelet subsequences on each scale domain includes:
the wavelet is decomposed into signal components in different frequency bands after transformation, and a high-frequency detail component and a low-frequency approximate component are respectively obtained;
the low-frequency approximate component is used for reflecting the change trend and characteristics of the urban traffic flow data, and the high-frequency detailed component is used for reflecting the disturbance factors of the urban traffic flow data;
further, the step of performing wavelet transformation on the sequence data to obtain wavelet subsequences on each scale domain includes:
and preprocessing the wavelet subsequence by adopting a normalization processing method.
Further, the step of preprocessing the wavelet sub-sequence by adopting a normalization processing method comprises the following steps:
mapping the data of the wavelet subsequence to a [0,1] interval, wherein the specific method comprises the following steps: and respectively marking the maximum value and the minimum value in the wavelet subsequence data as Xmax and Xmin, subtracting the Xmin from each data in the wavelet subsequence, and dividing the Xmax-Xmin.
Further, the step of modeling and predicting each wavelet sub-sequence according to the GRU neural network to obtain a GRU network model corresponding to each wavelet sub-sequence includes:
the GRU network model comprises an input layer, a hidden layer, an output layer, a network training layer and a network prediction layer;
the input layer is used for preprocessing the wavelet subsequence to meet network input requirements;
the hidden layer is used for building a monolayer circulating neural network according to GRU cells, and the hidden layer uses tanh as an activation function;
the output layer is used for providing a prediction result network;
the network prediction layer is used for predicting point by point according to an iterative method;
and according to the calculation errors of the predicted value and the observed value, conducting the errors to neurons of the hidden layer along the reverse direction by using a back propagation algorithm, updating each weight by the neurons through a gradient descent method, and repeating the back propagation calculation process until the iteration is finished to obtain a final predicted result network.
Further, the step of conducting the error to the neurons of the hidden layer along the reverse direction by using the back propagation algorithm according to the calculation errors of the predicted value and the observed value, updating each weight by the neurons through a gradient descent method, and repeating the back propagation calculation process until the iteration is finished to obtain a final predicted result network comprises the following steps:
root mean square error is selectedAs an error evaluation index, a calculation formula of the error evaluation index is as follows:
wherein N is the number of data samples,for predictive value +.>Is an actual value.
Further, the step of optimizing the super parameters in each of the GRU network models by using a genetic algorithm to construct a GA-GRU optimal combination model, and obtaining the optimal prediction result of each wavelet subsequence comprises the following steps:
initializing the GRU network model population, and encoding a super-parameter value to be optimized, wherein the super-parameter comprises a time window and the number of hidden layer neurons;
constructing a GRU network model according to the super parameters in the individual, training the GRU network model, and calculating the fitness value of each chromosome according to the error and the fitness function;
the genetic algorithm starts iteration, the chromosome is updated by using selection, crossing and mutation operations, and the super-parameter combination corresponding to the updated chromosome is assigned to the GRU neural network for model training;
calculating and updating fitness values of the chromosomes;
if the current maximum fitness value has no significant change or reaches the maximum iteration number of the population, stopping optimization;
after the iteration of the genetic algorithm is finished, the optimal super parameters and the corresponding GRU network model are saved, and the prediction of each subsequence is completed.
An urban traffic flow prediction system according to an embodiment of the present invention, the system comprising:
the data collection module is used for collecting sequence data of the traffic flow of the target city;
the data processing module is used for carrying out wavelet transformation on the sequence data to obtain wavelet subsequences on each scale domain, and preprocessing the wavelet subsequences by adopting a normalization processing method to obtain a high-frequency detail component and a low-frequency approximate component;
the model training module is used for respectively carrying out modeling prediction on each wavelet subsequence according to the GRU neural network to obtain GRU network models respectively corresponding to each wavelet subsequence;
the model optimization module is used for optimizing super parameters in each GRU network model by utilizing a genetic algorithm, constructing a GA-GRU optimal combination model and obtaining an optimal prediction result of each wavelet subsequence;
and the traffic prediction module is used for carrying out wavelet reconstruction on the optimal prediction results of the wavelet subsequences, comprehensively generating a WT-GA-GRU model and outputting the final prediction result of the traffic flow of the target city.
The invention also provides a forward computing module and a backward computing module:
the forward computing module is used for inputting the sub-sequence data after normalization processing into a GRU neural network to perform forward computation;
the back calculation module is used for conducting errors to neurons of the hidden layer along the reverse direction by combining a back propagation algorithm, and the neurons update the weights through a gradient descent method.
Another aspect of the present invention also provides an electronic device, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory has instructions executable by the one processor to enable the at least one processor to perform the urban traffic prediction method of any one of the above.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
Fig. 1 is a flowchart of a method for predicting urban traffic flow according to a first embodiment of the present invention;
FIG. 2 is a flow chart of a method for predicting urban traffic flow according to a second embodiment of the invention;
fig. 3 is a diagram of urban traffic flow data according to a method for predicting urban traffic flow according to a second embodiment of the present invention;
fig. 4 is a wavelet transform chart of a city traffic flow prediction method according to a second embodiment of the present invention;
FIG. 5 is a block diagram of a GRU unit of a urban traffic flow prediction method according to a second embodiment of the invention;
FIG. 6 is a block diagram of a GA-GRU structure of a method for predicting urban traffic flow according to a second embodiment of the invention;
FIG. 7 is a graph showing the prediction result of the urban traffic flow prediction method based on the WT-GA-GRU model of the present invention;
fig. 8 is a system diagram of an urban traffic flow prediction system according to a third embodiment of the present invention.
The invention will be further described in the following detailed description in conjunction with the above-described figures.
Detailed Description
In order that the invention may be readily understood, a more complete description of the invention will be rendered by reference to the appended drawings. Several embodiments of the invention are shown in the drawings. This invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and/or" as used herein includes any and all combinations of one or more of the associated listed items.
Referring to fig. 1, a flowchart of a method for predicting urban traffic flow according to a first embodiment of the invention is shown, the method includes steps S01 to S05, wherein:
step S01: collecting sequence data of the traffic flow of the target city;
specifically, the acquisition of sequence data of the target urban traffic flow requires setting observation time, and each observation time records data once; typically, the observation time is 2-15 minutes, and when the observation time is larger, the acquired data is smoother, but the data representativeness is reduced due to the overlarge sampling time.
Step S02: performing wavelet transformation on the sequence data to obtain wavelet subsequences on each scale domain;
it should be noted that, since the number of decomposition layers of the wavelet is mainly related to the signal-to-noise ratio, when the signal-to-noise ratio is high, the input is mainly based on the signal, and the number of decomposition layers is not too large at this time, otherwise, the distortion is serious and the error is large during reconstruction; when the signal-to-noise ratio is low, the input is mainly noise, and the number of decomposition layers is a little larger at this time, so that the signal-to-noise separation is facilitated, so that the time series data of the traffic flow needs to be decomposed layer by layer, each layer of decomposition further subdivides the approximate component into a lower-frequency approximate component and a higher-frequency detailed component, the approximate component keeps the low-frequency information and the approximate trend in the original traffic flow data, and the detailed component contains the high-frequency detail and the fine change of the original signal;
further, preprocessing the traffic flow sequence data by adopting a normalization processing method, and mapping the original sequence data to a [0,1] interval;
it will be appreciated that mapping the original sequence data into a certain inter-cell space makes the data more regular, since the decomposed sub-sequence data has a larger span of values and is cumbersome and messy to handle.
Step S03: modeling and predicting each wavelet subsequence according to the GRU neural network to obtain GRU network models corresponding to each wavelet subsequence;
the method includes the steps that collected historical sequence data are divided into a training set and a testing set, the training set is used for constructing a GRU traffic flow prediction model, and the testing set is used for predicting traffic flow of a generated target model; taking the minimum loss function as an optimization target, transmitting the error to neurons of the hidden layer along the reverse direction by using a back propagation algorithm according to the calculation errors of the predicted value and the observed value, updating each weight by the neurons through a gradient descent method, and repeating the process until the iteration is finished to obtain a final hidden layer network;
it can be appreciated that, because the characteristics of the decomposed sub-sequence data are different, a GRU network model corresponding to each sub-sequence needs to be constructed, so that the sub-sequence is more capable of restoring the real data change.
Step S04: optimizing super parameters in each GRU network model by utilizing a genetic algorithm, and constructing a GA-GRU optimal combination model to obtain optimal prediction results of each wavelet subsequence;
it should be noted that, in the genetic algorithm, the chromosome is a data structure representing a possible solution, in the iterative process of the genetic algorithm, the super parameters corresponding to each chromosome are utilized to build a GRU prediction model, and then iterative optimization is continuously performed until the best super parameter combination is found;
it can be understood that, because the predicted result can be produced in the GRU network model, the predicted result and the observed result can be compared to find out the individual data with the minimum error value, the GRU network model is built and trained under the super parameter corresponding to the data, the fitness value of each chromosome is calculated according to the error and the fitness function, the optimization iteration is continuously carried out, and the optimal super parameter and the corresponding GRU network model are saved to obtain the optimal predicted result of each subsequence.
Step S05: carrying out wavelet reconstruction on the optimal prediction results of the wavelet subsequences, comprehensively generating a WT-GA-GRU model, and outputting the final prediction result of the target urban traffic flow;
in summary, according to the urban traffic flow prediction method, by performing wavelet decomposition on the traffic flow sequence data into a high-frequency detail component and a low-frequency approximation component, the basic change trend of the urban traffic flow data and disturbance factors of the data are considered, the accurate decomposition of the sequence data under different conditions is realized, and a prediction model is more targeted; modeling is carried out on each subsequence component through the GRU neural network, the fitting effect of a prediction algorithm is better, the prediction accuracy is higher, and the preliminary prediction of each decomposed subsequence is realized; optimizing the super parameters in the GRU network model through a genetic algorithm, and finding and storing the super parameters with the minimum error and the GA-GRU optimal combination model so as to enable the decomposed subsequence to restore the real data change; and finally, carrying out wavelet reconstruction on each optimal subsequence, and generating a WT-GA-GRU prediction model after comprehensive accumulation, thereby further improving the precision of the final prediction result.
Referring to fig. 2, a flowchart of a method for predicting urban traffic flow according to a second embodiment of the invention is shown, the method includes steps S101 to S106, wherein:
step S101: recording the traffic flow of a target city once every 5 minutes of observation;
it should be noted that, in general, the observation time is 2-15 minutes, and when the observation time is longer, the acquired data is smoother, but the representative data is reduced due to the overlarge sampling time, so that the observation time of the urban traffic flow is 5 minutes; in this embodiment, the data of driving of the taxi in Shenzhen city from 8.8.1.month to 9.8.month is adopted, the observation time is 5 minutes, and the total number of data is 864, as shown in fig. 3, wherein the data shown after 4000 minutes is a test set, and the data shown in the interval of 0-4000 minutes is a training set.
Step S102: performing wavelet decomposition on the data of the traffic flow of the target city to obtain 1 low-frequency approximate component and 3 high-frequency detail components;
it should be noted that the wavelet decomposition adopts multi-layer decomposition, and each layer of decomposition further subdivides the approximate component into a lower-frequency approximate component and a higher-frequency detail component, the approximate component retains the low-frequency information and general trend in the original traffic flow data, and the detail component contains the high-frequency detail and fine variation of the original signal. The number of decomposition layers of the wavelet is mainly related to the signal-to-noise ratio, when the signal-to-noise ratio is higher, the input is mainly based on the signal, and the number of decomposition layers is not needed to be too large at the moment, otherwise, the distortion is serious during reconstruction, and the error is also larger; when the signal-to-noise ratio is low, the input is mainly based on noise, and the number of decomposition layers is selected to be a little larger at the moment, so that the signal-to-noise separation is facilitated. The Daubechies wavelet basis function is selected to decompose the traffic flow time series data, the decomposition layer number is 3, and finally 1 low-frequency approximate component and 3 high-frequency detail components are obtained, and a wavelet decomposition flow chart is shown in fig. 4.
Step S103: preprocessing each component of the wavelet subsequence by adopting a normalization processing method;
it can be understood that, because the span of the sub-sequence data values after decomposition is larger, the processing is complicated and messy, so that the mapping of the original sequence data to a certain cell can lead the data to be more regular;
specifically, the original sequence data is mapped to the [0,1] interval, and the specific method is as follows: firstly, calculating the maximum value and the minimum value of the sequence data, and respectively marking the maximum value and the minimum value as Xmax and Xmin; each of the sequence data is then subtracted by Xmin and divided by Xmax-Xmin.
Step S104: constructing a GRU prediction model according to the preprocessed wavelet subsequence;
it will be appreciated that the network architecture is shown in fig. 5. Let the traffic flow data of the first n historical moments be x= { X 1 ,…,x t ,…,x n If the time window is marked as d, the current moment is taken as the current moment as the prediction result x t X is then t The corresponding input is { x } t-d+1 ,…,x t-i ,…,x t-1 Reconstructing the data set by analogy, and then dividing the training set and the test set; root mean square error is selectedAs an error calculation formula, wherein t represents time, +.>Representing the true value at time t,a predicted value at time t; and setting the minimum loss function as an optimization target, conducting the error to neurons of the hidden layer along the reverse direction by using a back propagation algorithm according to the calculation errors of the predicted value and the observed value, updating each weight by the neurons through a gradient descent method, and repeating the process until the iteration is finished to obtain a final hidden layer network.
Step S105: optimizing super parameters of each GRU prediction model by utilizing a genetic algorithm, and constructing a GA-GRU optimal combination model to obtain optimal prediction results of each wavelet subsequence;
specifically, the flow is shown in fig. 6, a population is initialized, the super parameters to be optimized are binary coded, and the super parameters comprise a time window and the number of neurons of a hidden layer;
establishing a GRU model according to the super parameters in the individual, training the GRU model, and calculating the fitness value of each chromosome according to the error and the fitness function;
the genetic algorithm starts iteration, the chromosome is updated by using selection, crossing and mutation operations, and the super-parameter combination corresponding to the updated chromosome is assigned to the GRU neural network for model training;
calculating and updating fitness values of the chromosomes;
if the current maximum fitness value has no significant change or reaches the maximum iteration number of the population, stopping optimization;
after the iteration of the genetic algorithm is finished, the optimal super parameters and the corresponding GRU model are stored, and the prediction of the subsequence is completed.
Step S106: and carrying out wavelet reconstruction on the optimal prediction result of each wavelet sub-sequence, and comprehensively accumulating to obtain the final prediction result of the traffic flow time sequence.
It can be understood that the final prediction result of the WT-GA-GRU model in the traffic flow time sequence is shown in fig. 7, the error pairs of different models are shown in table 1, and the root mean square error RMSE, the mean absolute error MAE and the mean absolute percentage error MAPE are respectively used as evaluation indexes, and are respectively shown in the following formulas, wherein RMSE is a standard deviation, N is the number of data samples,for predictive value +.>The actual value is:
table 1 shows a comparison of prediction errors of the WT-GA-GRU model and other models
Predictive model | MAE | RMSE | MAPE |
GRU | 305.5292 | 402.5866 | 38.7984 |
GA-GRU | 87.1695 | 116.8287 | 12.3668 |
WT-GA-GRU | 65.0693 | 91.0061 | 8.4357 |
In summary, according to the urban traffic flow prediction method, the wavelet decomposition is carried out on the traffic flow sequence data to obtain a high-frequency detail component and a low-frequency approximate component, so that the basic change trend of the urban traffic flow data and disturbance factors of the data are considered, the accurate decomposition of the sequence data under different conditions is realized, and a prediction model is more targeted; modeling is carried out on each subsequence component through the GRU neural network, the fitting effect of a prediction algorithm is better, the prediction accuracy is higher, and the preliminary prediction of each decomposed subsequence is realized; optimizing the super parameters in the GRU network model through a genetic algorithm, and finding and storing the super parameters with the minimum error and the GA-GRU optimal combination model so as to enable the decomposed subsequence to restore the real data change; and finally, carrying out wavelet reconstruction on each optimal subsequence, and generating a WT-GA-GRU prediction model after comprehensive accumulation, thereby further improving the precision of the final prediction result.
Referring to fig. 8, a schematic structural diagram of an urban traffic flow prediction system according to a third embodiment of the invention is shown, the system comprises:
a data collection module 10 for collecting the sequence data of the traffic flow of the target city;
the data processing module 20 is configured to perform wavelet transformation on the sequence data to obtain wavelet subsequences on each scale domain, and perform pretreatment on the wavelet subsequences by adopting a normalization processing method to obtain a high-frequency detail component and a low-frequency approximation component;
the model training module 30 is configured to perform modeling prediction on each of the sub-sequences after preprocessing according to the GRU neural network, so as to obtain a GRU network model corresponding to each of the sub-sequences;
the model optimization module 40 is configured to optimize the super parameters in each of the GRU network models by using a genetic algorithm, and construct a GA-GRU optimal combination model, so as to obtain an optimal prediction result of each of the subsequences;
and the traffic prediction module 50 is used for carrying out wavelet reconstruction on the optimal prediction results of the subsequences, comprehensively generating a WT-GA-GRU model and outputting the final prediction results.
In summary, according to the urban traffic flow prediction system, the wavelet decomposition is carried out on the traffic flow sequence data to obtain a high-frequency detail component and a low-frequency approximate component, so that the basic change trend of the urban traffic flow data and disturbance factors of the data are considered, the accurate decomposition of the sequence data under different conditions is realized, and a prediction model is more targeted; modeling is carried out on each subsequence component through the GRU neural network, the fitting effect of a prediction algorithm is better, the prediction accuracy is higher, and the preliminary prediction of each decomposed subsequence is realized; optimizing the super parameters in the GRU network model through a genetic algorithm, and finding and storing the super parameters with the minimum error and the GA-GRU optimal combination model so as to enable the decomposed subsequence to restore the real data change; and finally, carrying out wavelet reconstruction on each optimal subsequence, and generating a WT-GA-GRU prediction model after comprehensive accumulation, thereby further improving the precision of the final prediction result.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The above examples merely represent a few embodiments of the present invention, which are described in more detail and are not to be construed as limiting the scope of the present invention. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the invention, which are all within the scope of the invention. Accordingly, the scope of the invention should be assessed as that of the appended claims.
Claims (10)
1. A method for predicting urban traffic flow, the method comprising:
collecting sequence data of the traffic flow of the target city;
performing wavelet transformation on the sequence data to obtain wavelet subsequences on each scale domain;
modeling and predicting each wavelet subsequence according to the GRU neural network to obtain GRU network models corresponding to each wavelet subsequence;
optimizing super parameters in each GRU network model by utilizing a genetic algorithm, and constructing a GA-GRU optimal combination model to obtain optimal prediction results of each wavelet subsequence;
and carrying out wavelet reconstruction on the optimal prediction results of the wavelet subsequences, comprehensively generating a WT-GA-GRU model, and outputting the final prediction result of the target urban traffic flow.
2. The urban traffic flow prediction method according to claim 1, wherein said step of wavelet transforming said sequence data to obtain wavelet sub-sequences over each scale domain comprises:
the wavelet is decomposed into signal components in different frequency bands after transformation, and a high-frequency detail component and a low-frequency approximate component are respectively obtained;
the low-frequency approximation component is used for reflecting the change trend and the characteristics of the urban traffic flow data, and the high-frequency detail component is used for reflecting the disturbance factors of the urban traffic flow data.
3. The urban traffic flow prediction method according to claim 1, wherein said step of wavelet transforming said sequence data to obtain wavelet sub-sequences over each scale domain comprises, after:
and preprocessing the wavelet subsequence by adopting a normalization processing method.
4. The urban traffic flow prediction method according to claim 3, wherein said step of preprocessing said wavelet sub-sequences using normalization processing method comprises:
mapping the data of the wavelet subsequence to a [0,1] interval, wherein the specific method comprises the following steps: and respectively marking the maximum value and the minimum value in the wavelet subsequence data as Xmax and Xmin, subtracting the Xmin from each data in the wavelet subsequence, and dividing the Xmax-Xmin.
5. The urban traffic flow prediction method according to claim 1, wherein said step of modeling and predicting each of said wavelet sub-sequences according to a GRU neural network, respectively, and obtaining a GRU network model corresponding to each of said wavelet sub-sequences, respectively, comprises:
the GRU network model comprises an input layer, a hidden layer, an output layer, a network training layer and a network prediction layer;
the input layer is used for preprocessing the wavelet subsequence to meet network input requirements;
the hidden layer is used for building a monolayer circulating neural network according to GRU cells, and the hidden layer uses tanh as an activation function;
the output layer is used for providing a prediction result network;
the network prediction layer is used for predicting point by point according to an iterative method;
and according to the calculation errors of the predicted value and the observed value, conducting the errors to neurons of the hidden layer along the reverse direction by using a back propagation algorithm, updating each weight by the neurons through a gradient descent method, and repeating the back propagation calculation process until the iteration is finished to obtain a final predicted result network.
6. The urban traffic flow prediction method according to claim 5, wherein the step of conducting the error to neurons of the hidden layer in the reverse direction by using a back propagation algorithm according to the calculated errors of the predicted value and the observed value, updating each weight by the neurons by using a gradient descent method, and repeating the back propagation calculation process until the iteration is finished to obtain a final prediction result network comprises:
root mean square error is selectedAs an error evaluation index, a calculation formula of the error evaluation index is as follows:
wherein N is the number of data samples,for predictive value +.>Is an actual value.
7. The urban traffic flow prediction method according to claim 1, wherein said optimizing the super parameters in each of said GRU network models using genetic algorithm, constructing a GA-GRU optimal combination model, obtaining the optimal prediction result of each of said wavelet subsequences comprises:
initializing the GRU network model population, and encoding a super-parameter value to be optimized, wherein the super-parameter comprises a time window and the number of hidden layer neurons;
constructing a GRU network model according to the super parameters in the individual, training the GRU network model, and calculating the fitness value of each chromosome according to the error and the fitness function;
the genetic algorithm starts iteration, the chromosome is updated by using selection, crossing and mutation operations, and the super-parameter combination corresponding to the updated chromosome is assigned to the GRU neural network for model training;
calculating and updating fitness values of the chromosomes;
if the current maximum fitness value has no significant change or reaches the maximum iteration number of the population, stopping optimization;
after the iteration of the genetic algorithm is finished, the optimal super parameters and the corresponding GRU network model are saved, and the prediction of each subsequence is completed.
8. An urban traffic flow prediction system, the system comprising:
the data collection module is used for collecting the sequence data of the traffic flow of the target city;
the data processing module is used for carrying out wavelet transformation on the sequence data to obtain wavelet subsequences on each scale domain, and preprocessing the wavelet subsequences by adopting a normalization processing method to obtain a high-frequency detail component and a low-frequency approximate component;
the model training module is used for respectively carrying out modeling prediction on each sub-sequence after pretreatment according to the GRU neural network to obtain GRU network models respectively corresponding to the sub-sequences;
the model optimization module is used for optimizing super parameters in each GRU network model by utilizing a genetic algorithm, constructing a GA-GRU optimal combination model and obtaining optimal prediction results of each subsequence;
and the traffic prediction module is used for carrying out wavelet reconstruction on the optimal prediction results of the subsequences, comprehensively generating a WT-GA-GRU model and outputting a final prediction result.
9. The urban traffic flow prediction system according to claim 8, further comprising a forward calculation module and a reverse calculation module:
the forward computing module is used for inputting the sub-sequence data after normalization processing into a GRU neural network to perform forward computation;
the back calculation module is used for conducting errors to neurons of the hidden layer along the reverse direction by combining a back propagation algorithm, and the neurons update the weights through a gradient descent method.
10. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory has instructions executable by the one processor to enable the at least one processor to perform the urban traffic prediction method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311085323.0A CN117173883A (en) | 2023-08-28 | 2023-08-28 | Urban traffic flow prediction method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311085323.0A CN117173883A (en) | 2023-08-28 | 2023-08-28 | Urban traffic flow prediction method and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117173883A true CN117173883A (en) | 2023-12-05 |
Family
ID=88936822
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311085323.0A Pending CN117173883A (en) | 2023-08-28 | 2023-08-28 | Urban traffic flow prediction method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117173883A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118114887A (en) * | 2024-04-29 | 2024-05-31 | 中国铁建电气化局集团有限公司 | Prediction method and device for crowd flow of evacuation channel |
-
2023
- 2023-08-28 CN CN202311085323.0A patent/CN117173883A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118114887A (en) * | 2024-04-29 | 2024-05-31 | 中国铁建电气化局集团有限公司 | Prediction method and device for crowd flow of evacuation channel |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112949945B (en) | Wind power ultra-short-term prediction method for improving bidirectional long-term and short-term memory network | |
Liang et al. | A novel wind speed prediction strategy based on Bi-LSTM, MOOFADA and transfer learning for centralized control centers | |
CN111860982A (en) | Wind power plant short-term wind power prediction method based on VMD-FCM-GRU | |
CN110580543A (en) | Power load prediction method and system based on deep belief network | |
CN113836823A (en) | Load combination prediction method based on load decomposition and optimized bidirectional long-short term memory network | |
CN117173883A (en) | Urban traffic flow prediction method and system | |
CN111027662A (en) | SD-LSSVR short-time traffic flow prediction method based on chaos quantum particle swarm optimization | |
CN111144644A (en) | Short-term wind speed prediction method based on variation variance Gaussian process regression | |
CN113988426A (en) | Electric vehicle charging load prediction method and system based on FCM clustering and LSTM | |
CN109583588A (en) | A kind of short-term wind speed forecasting method and system | |
CN114912666A (en) | Short-time passenger flow volume prediction method based on CEEMDAN algorithm and attention mechanism | |
CN111141879B (en) | Deep learning air quality monitoring method, device and equipment | |
CN116187835A (en) | Data-driven-based method and system for estimating theoretical line loss interval of transformer area | |
CN116933946A (en) | Rail transit OD passenger flow prediction method and system based on passenger flow destination structure | |
CN115034430A (en) | Carbon emission prediction method, device, terminal and storage medium | |
CN115905818A (en) | Landslide early warning method based on data mining | |
CN116106761A (en) | Real-time lithium ion battery electric quantity estimation method based on typical correlation analysis | |
CN116933175A (en) | Electric automobile charging load prediction method and device | |
CN115796351A (en) | Rainfall shorthand prediction method and device based on variational modal decomposition and microwave attenuation | |
CN116665483A (en) | Novel method for predicting residual parking space | |
CN114973665A (en) | Short-term traffic flow prediction method combining data decomposition and deep learning | |
CN115034473A (en) | Electricity price prediction method, system and device | |
Huang et al. | A decomposition‐based multi‐time dimension long short‐term memory model for short‐term electric load forecasting | |
CN113449920A (en) | Wind power prediction method, system and computer readable medium | |
CN117592593A (en) | Short-term power load prediction method based on improved quadratic modal decomposition and WOA optimization BILSTM-intent |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |