CN112884222A - Time-period-oriented LSTM traffic flow density prediction method - Google Patents
Time-period-oriented LSTM traffic flow density prediction method Download PDFInfo
- Publication number
- CN112884222A CN112884222A CN202110185310.5A CN202110185310A CN112884222A CN 112884222 A CN112884222 A CN 112884222A CN 202110185310 A CN202110185310 A CN 202110185310A CN 112884222 A CN112884222 A CN 112884222A
- Authority
- CN
- China
- Prior art keywords
- traffic flow
- flow density
- time
- data
- prediction
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 57
- 238000013528 artificial neural network Methods 0.000 claims abstract description 59
- 238000012549 training Methods 0.000 claims abstract description 41
- 238000012937 correction Methods 0.000 claims abstract description 11
- 238000003064 k means clustering Methods 0.000 claims abstract description 8
- 238000004904 shortening Methods 0.000 claims abstract description 6
- 238000012545 processing Methods 0.000 claims description 38
- 238000012360 testing method Methods 0.000 claims description 22
- 238000012795 verification Methods 0.000 claims description 17
- 238000011160 research Methods 0.000 claims description 15
- 238000010606 normalization Methods 0.000 claims description 14
- 238000004458 analytical method Methods 0.000 claims description 9
- 101001095088 Homo sapiens Melanoma antigen preferentially expressed in tumors Proteins 0.000 claims description 8
- 102100037020 Melanoma antigen preferentially expressed in tumors Human genes 0.000 claims description 8
- 238000007781 pre-processing Methods 0.000 claims description 6
- 230000008569 process Effects 0.000 claims description 5
- 238000004364 calculation method Methods 0.000 claims description 4
- 241000287196 Asthenes Species 0.000 claims description 3
- 238000006243 chemical reaction Methods 0.000 claims description 3
- 230000001186 cumulative effect Effects 0.000 claims description 3
- 230000003247 decreasing effect Effects 0.000 claims description 3
- 230000000694 effects Effects 0.000 claims description 3
- 238000004422 calculation algorithm Methods 0.000 abstract description 4
- 230000009286 beneficial effect Effects 0.000 abstract description 3
- 238000004088 simulation Methods 0.000 description 4
- 238000002474 experimental method Methods 0.000 description 3
- 230000015654 memory Effects 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 238000003062 neural network model Methods 0.000 description 2
- ORILYTVJVMAKLC-UHFFFAOYSA-N Adamantane Natural products C1C(C2)CC3CC1CC2C3 ORILYTVJVMAKLC-UHFFFAOYSA-N 0.000 description 1
- 230000004913 activation Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 238000009795 derivation Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000012886 linear function Methods 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 238000000691 measurement method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000306 recurrent effect Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 230000006403 short-term memory Effects 0.000 description 1
- 238000010183 spectrum analysis Methods 0.000 description 1
- 238000010200 validation analysis Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/04—Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/23—Clustering techniques
- G06F18/232—Non-hierarchical techniques
- G06F18/2321—Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
- G06F18/23213—Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/044—Recurrent networks, e.g. Hopfield networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q50/00—Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
- G06Q50/10—Services
- G06Q50/26—Government or public services
-
- G—PHYSICS
- G08—SIGNALLING
- G08G—TRAFFIC CONTROL SYSTEMS
- G08G1/00—Traffic control systems for road vehicles
- G08G1/01—Detecting movement of traffic to be counted or controlled
- G08G1/0104—Measuring and analyzing of parameters relative to traffic conditions
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- General Engineering & Computer Science (AREA)
- Artificial Intelligence (AREA)
- Life Sciences & Earth Sciences (AREA)
- Economics (AREA)
- General Health & Medical Sciences (AREA)
- Human Resources & Organizations (AREA)
- Strategic Management (AREA)
- Tourism & Hospitality (AREA)
- Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Biophysics (AREA)
- Molecular Biology (AREA)
- Biomedical Technology (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- General Business, Economics & Management (AREA)
- Development Economics (AREA)
- Evolutionary Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Computational Linguistics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Marketing (AREA)
- Entrepreneurship & Innovation (AREA)
- Operations Research (AREA)
- Quality & Reliability (AREA)
- Game Theory and Decision Science (AREA)
- Probability & Statistics with Applications (AREA)
- Chemical & Material Sciences (AREA)
- Analytical Chemistry (AREA)
- Educational Administration (AREA)
- Primary Health Care (AREA)
- Traffic Control Systems (AREA)
Abstract
The invention discloses a time-slot-oriented LSTM traffic flow density prediction method. The invention creatively provides a concept of traffic flow density, obtains a data set of the traffic flow density of each vehicle in the area, and effectively reflects the actual traffic jam condition in the urban traffic hot spot area. And local extension or shortening is carried out on a time axis by utilizing a dynamic time warping method, so that the similarity among the traffic flow density sequence slices is more accurately measured. And classifying the traffic flow density slice sequences according to the similarity by using a K-Means clustering method, so as to be beneficial to reflecting the typical mode of the traffic flow density. And respectively training neural networks aiming at traffic flow density data with similar patterns, and performing weighted summation on the output predicted values of the neural networks according to the time labels or the distances of the data clustering centers, thereby fully utilizing the characteristics of the sequence structure of the data. And finally, performing similar day correction on the weighted summation result by using the past data with the same type of the working day, so as to improve the algorithm prediction precision.
Description
Technical Field
The invention belongs to the field of traffic prediction, and particularly relates to a time-slot-oriented LSTM traffic flow density prediction method.
Background
With the promotion of the society and economy development of China and the steady progress of urbanization construction, the physical and living conditions of people are improved, the holding capacity of motor vehicles and the road traffic volume are increased rapidly, and the traffic jam phenomenon of cities, particularly big cities, becomes a focus problem at present. The problems of traffic network retardation, disordered traffic order and the like are gradually highlighted, and huge impact and pressure are brought to urban traffic management. The problems of commuting time waste, energy and economic loss, air quality reduction and the like caused by the phenomenon are increasingly highlighted. At present, the problem of urban road traffic congestion not only restricts the further development of social economy, but also is an important reason influencing the trip experience of people and reducing the quality of life of people. Therefore, research on urban road vehicle motion prediction methods must be strengthened to further complete the task of solving urban traffic congestion.
In view of the problem of predicting the traffic flow of urban roads, experts and scholars in the related field have conducted many studies, and therefore prediction methods with higher complexity and better performance are continuously proposed, or the existing prediction methods are improved from different angles. Generally, these prediction methods can be broadly divided into two categories: the method is supported by classical mathematical and physical theory knowledge and is suitable for processing small-scale, simple and single traffic flow data, but the method cannot meet the requirement of actual precision along with the complication of a traffic system; the other type of prediction model is formed by taking modern scientific technology and methods as main research means, and comprises a nonparametric regression model, a multidimensional fractal-based method, a spectrum analysis method, a neural network model and the like, wherein the methods pay attention to improving the fitting effect on the real traffic flow phenomenon, do not pursue strict mathematical derivation and clear physical significance, and show advantages in processing more complex traffic flow data. A Long-Short Term Memory neural network (Long-Short Term Memory) is one of the commonly used neural network models, and has a relatively good performance in traffic flow prediction in recent years. However, since the simulation is simply performed according to the time correlation of the traffic flow data and the objective law of actual road traffic is not considered, there is still room for improvement in terms of improving the accuracy.
Disclosure of Invention
The invention aims to provide a time period-oriented LSTM (long short term memory neural network) traffic flow density prediction method by combining four modules of clustering, neural network, ensemble learning and similar day correction, because the current deep learning method for predicting a time sequence aiming at a certain time period or time label is very limited and a clustering idea is rarely introduced into a prediction process. The traffic flow density is defined by the number of track points left by the vehicle in unit time, and the traffic jam condition can be reflected better.
The technical scheme of the invention is a time slot-oriented LSTM traffic flow density prediction method, which comprises a data processing stage, a training stage, a parameter adjusting stage and a testing stage;
the data processing stage specifically comprises: selecting a research area, selecting a part which has intersection with the research area from the acquired vehicle track information, calculating according to a traffic flow density formula to obtain a traffic flow density data set of each vehicle in the area, and dividing the traffic flow density data set into a training set, a verification set and a test set;
the training phase comprises the following steps:
s11, segmenting traffic flow density data in a training set according to a given length to obtain time sequence slices, recording time labels of the time sequence slices, calculating similarity among the time sequence slices by using a dynamic time warping method, and classifying the traffic flow density slices according to the similarity by using a K-Means clustering method to obtain N clustering clusters and corresponding time labels;
step S12, constructing a time-slot-oriented LSTM neural network, and performing time-series sliding window processing, splicing processing and normalization processing on input data of the neural network according to the specified sliding window length;
step S13, taking the data of N clusters, and respectively training N LSTM neural networks;
the parameter adjusting stage comprises the following steps:
step S21, preprocessing the verification set data, specifically including:
setting the length of a sliding window as seq _ len, performing time series sliding window processing on each sequence in the verification set, wherein the time series window size is seq _ len, the sliding window step length is 1, and then performing splicing processing and normalization processing;
step S22, inputting the processed verification set data into L neural networks according to given standards, wherein L is less than N, and performing denormalization operation and weighted summation on L prediction results;
step S23, the weighted summation result is corrected by using the past data, and the final prediction result is output;
step S24, adjusting parameters, carrying out clustering and neural network training by using the training set data again, and then repeating S22 and S23 and carrying out error analysis;
step S25, repeating step S24 for a plurality of times, and finally reserving parameters which enable the three indexes to be relatively best in performance as model parameters;
the testing phase comprises the following steps:
step S31, the preprocessing operation of the step S21 is carried out on the test set data;
step S32, inputting the processed test set data into L neural networks according to a given standard, wherein L is less than N, performing inverse normalization operation and weighted summation on L prediction results, correcting the weighted summation result by using past data, and outputting a final prediction result;
step S33, the training set data is reused to carry out clustering and neural network training, and then step S32 is carried out;
and step S34, repeating the step S33M times, and calculating the mean value and standard deviation of the MAE, the MSE and the MAPE of the corrected predicted value and the true value.
Further, the vehicle track information is derived from a network data set;
the research area is an urban traffic hot spot area;
the acquired vehicle track information is the motor vehicle track points acquired after the interval time;
accumulating the number of track points in a selected research area within a specified interval time to obtain a traffic flow density data set of the specified interval time, wherein the specified interval time is formulated according to a prediction demand;
if the specified interval time is delta t and the frequency of the occurrence frequency of the vehicle track points in the research area in the interval time is n, the traffic flow density data is defined as follows:
and dividing the traffic flow density data set into a training set, a verification set and a test set.
Further, the specific implementation manner of obtaining N clustering clusters in step S11 is as follows;
firstly, the similarity between time series slices is calculated by utilizing a dynamic time warping method, the concrete realization mode is as follows,
the dynamic time warping method carries out local extension or shortening on a time axis to calculate the similarity between time sequences, if two time sequences needing to calculate the similarity are X and Y, the lengths are | X | and | Y |, i represents the traffic flow density at the time i in X, j represents the traffic flow density at the time j in Y, the rounding path W is defined as:
W=w1,w2,...,wk,Max(|X|,|Y|)≤k≤|X|+|Y|
in the formula: w is a1=(1,1),wk=(|X|,|Y|);
The cumulative rounding distance D (i, j) from (1,1) to (i, j) is defined as:
D(i,j)=Dist(i,j)+Min[D(i-1,j),D(i,j-1),D(i-1,j-1)]
in the formula: dist (i, j) denotes Xi,YjThe distance between the two points;
solving by using dynamic programming to obtain a normalized path distance D (| X |, | Y |);
then, classifying the traffic flow density slice sequences according to the similarity by a K-Means clustering method to obtain various typical sequences of the traffic flow sequences, and integrating N clustering clusters and clustering centers.
Further, the specific implementation manner of performing time-series sliding window processing, splicing processing and normalization processing on the input data according to the specified length in step S12 is as follows;
the time series sliding window processing comprises the following steps:
if the traffic flow density slice data in the cluster is expressed as S1,S2,...,SnThe length of a traffic flow density slice is time _ span, the length of a sliding window is seq _ len, and S is firstly carried outi(i 1.. said, n) is spliced with the first seq _ len-1 traffic flow density values which are logically corresponding to the time in the non-sliced traffic flow density data set and recorded asThen toPerforming time series sliding window processing with the time series window size of seq _ len and the sliding window step length of 1;
the splicing treatment comprises the following steps:
recording x as a traffic flow density slice cut by the sliding window, and recording y as a traffic flow density value at the next moment of the slice;
then the traffic flow density sliding window data set is obtained and expressed as:
{(xi,yi)}1≤i≤n×time_span
the normalization process is: for { x0,...,xnAnd (5) defining the normalized traffic flow density as follows:
The normalized traffic flow density sliding window data set is the data received in the neural network
Further, the given criteria in step S22 are divided into two criteria, one is a time stamp as a criterion, and the other is a distance from the cluster center as a criterion;
the time label is taken as a standard, namely, the time label of input data is judged firstly, then the neural network with the same time label is selected, and if the training set of the neural network does not contain the time label, the data is not input into the neural network;
calculating the DTW distance between the input data and the clustering center of the clustering cluster corresponding to each neural network by taking the distance between the input data and the clustering center as a standard, and selecting the neural network for prediction when the distance is smaller than a given threshold value;
the denormalization operation being the prediction of the resultConversion to { x ] according to the following formula0,...,xn}:
The weighted summation is also divided into two types, and the weighted summation corresponds to the given standard in two input types respectively;
setting the L denormalized prediction results as y by taking the time label as a standard1,...,yLAt the k-thIn the cluster corresponding to each neural network, N is the total number of slices with the same time labels as the input datakAnd if the total number of slices containing the time label in the training set is N, the weight of the predicted value output by the kth neural network is as follows:
using the distance from the cluster center as the standard, if the input data and the cluster centerThe DTW distance of (1) is decreased in sequence, and the corresponding prediction result is y1,...,yLAnd then:
c1≤...≤cL
c1+...+cL=1
finally, the predicted values obtained by weighting are:
further, the specific implementation manner of step S23 is as follows;
if the input data of the neural network is in the specified correction time period, n past time sequence data { p) with the same type as the working day of the input data of the neural network exist0,...,pn-1The weighted traffic flow density predicted value is OwAnd defining the corrected traffic flow density predicted value O as:
in the formula: α represents the similar day correction coefficient, and d represents the correction day range.
Further, the error analysis in step S24 includes the calculation of three indexes MAE, MAPE and MSE, which are defined as follows:
in the formula: y represents the true value of the traffic flow density, O represents the predicted value of the traffic flow density, and N represents the number of the predicted values of the traffic flow density. Compared with the prior art, the invention has the following advantages and beneficial effects:
the concept of traffic flow density is creatively provided, the traffic flow density data set of each vehicle in the area is obtained, and the actual traffic jam condition in the urban traffic hot spot area can be effectively reflected.
And local extension or shortening is carried out on a time axis by utilizing a dynamic time warping method, so that the similarity among the traffic flow density sequence slices is more accurately measured.
And classifying the traffic flow density slice sequences according to the similarity by using a K-Means clustering method, so as to be beneficial to reflecting the typical mode of the traffic flow density.
An initial normalization method is provided, and experiments prove that the method is more stable.
Respectively training neural networks aiming at traffic flow density data with similar patterns, and weighting and summing the output predicted values of the neural networks according to the time labels or the distances of the data clustering centers in the integrated learning step, thereby fully utilizing the characteristics of the sequence structure of the data.
And similar day correction is carried out on the weighted summation result by using the past data with the same type of the working day, and the long-time dependency of the traffic flow density is further utilized to improve the algorithm prediction precision.
And calculating the average absolute error MAE of the three indexes, performing error analysis on the average absolute percentage error MAPE and the mean square error MSE, and describing the deviation and the stability of the algorithm in multiple angles.
Drawings
FIG. 1 is a general flow chart of a time slot-oriented LSTM traffic flow density prediction method;
FIG. 2 is a flow chart of a time slot-oriented LSTM traffic flow density prediction method training phase;
FIG. 3 is a flow chart of a validation phase of the time slot-oriented LSTM traffic flow density prediction method;
fig. 4 is a flow chart of the testing phase of the LSTM traffic flow density prediction method facing the time slot.
Detailed Description
The model is further described in detail below with reference to the accompanying drawings and examples. The specific embodiments described herein are merely illustrative of the present model and are not intended to be limiting of the present model.
As shown in fig. 1, the invention provides a time slot-oriented LSTM traffic flow density prediction method, which is divided into a data processing stage, a training stage, a parameter adjusting stage and a testing stage, wherein the data processing stage specifically includes:
selecting a research area, selecting a part which has intersection with the area from the acquired vehicle track information, calculating a traffic flow density sequence of vehicles in the area according to a traffic flow density definition formula, and dividing the sequence into a training set, a verification set and a test set.
The vehicle trajectory information is derived from a network data set.
The research area is an urban traffic hot spot area.
The acquired vehicle track information is the number of motor vehicle track points acquired after the interval time.
And accumulating the number of the track points in the selected study area within the specified interval time to obtain a traffic flow density data set of the specified interval time, wherein the specified interval time can be set according to the prediction requirement (for example, 2 minutes).
If the specified interval time is delta t and the frequency of the occurrence frequency of the vehicle track points in the research area in the interval time is n, the traffic flow density data is defined as follows:
different from the traditional traffic flow definition, the traffic flow density is the number of track points in unit time, and the actual congestion condition can be reflected better. In practical situations, a phenomenon that traffic flow is large but traffic is smooth may occur, vehicle track points are a two-dimensional time sequence formed by acquiring longitude and latitude data of vehicles every time a fixed time interval passes, and if the number of track points left by all vehicles in a certain area is large in unit time, the probability is that each vehicle forms a stagnation in the area.
And dividing the traffic flow density data set into a training set, a verification set and a test set. Specifically, if the acquired vehicle track information contains T days in total, the traffic flow density data set of the previous T-2 days is used as a training set, the data set of the T-1 day is used as a verification set, and the data set of the T day is used as a test set.
As shown in fig. 2, the training phase includes the following steps:
and step S11, dividing the traffic flow density data in the training set according to a given length to obtain time series slices, and recording the time labels of the slices according to the positions of the slices in the day. And calculating the similarity among the time sequence slices by using a dynamic time warping method, and classifying the traffic flow density slices according to the similarity by using a K-Means clustering method to obtain N clustering clusters, wherein the slices in each cluster have respective time labels.
The given length may be established according to predicted demand (e.g., 3 hours).
The Dynamic Time Warping (Dynamic Time Warping) method is a sequence measurement method, and local extension or shortening is performed on a Time axis to calculate similarity between Time sequences.
The dynamic time warping method carries out local extension or shortening on a time axis to calculate the similarity between time sequences, if two time sequences needing to calculate the similarity are X and Y, the lengths are | X | and | Y |, i represents the traffic flow density at the time i in X, j represents the traffic flow density at the time j in Y, the rounding path W is defined as:
W=w1,w2,...,wk,Max(|X|,|Y)≤k≤|X|+|Y|
in the formula: w is a1=(1,1),wk=(|X|,|Y|);
The cumulative rounding distance D (i, j) from (1,1) to (i, j) is defined as:
D(i,j)=Dist(i,j)+Min[D(i-1,j),D(i,j-1),D(i-1,j-1)]
in the formula: dist (i, j) denotes Xi,YjThe distance between the two points;
solving by using dynamic programming to obtain a normalized path distance D (| X |, | Y |);
and the K-Means clustering is used for classifying the traffic flow density slices according to similarity (dynamic time warping measurement) to obtain various typical sequences of traffic flow sequences, and integrating N clustering clusters and clustering centers. The value of N may be formulated based on predicted demand.
And step S12, constructing an LSTM neural network facing a time period, and performing time series sliding window processing, splicing processing and normalization processing on input data of the neural network according to the specified sliding window length.
The time series sliding window processing comprises the following steps:
if the traffic flow density slice data in the cluster is expressed as S1,S2,...,SnThe length of a traffic flow density slice is time _ span, the length of a sliding window is seq _ len, and S is firstly carried outi(i 1.. said, n) is spliced with the first seq _ len-1 traffic flow density values which are logically corresponding to the time in the non-sliced traffic flow density data set and recorded asThen toPerforming time series sliding window processing with the time series window size of seq _ len and the sliding window step length of 1;
the splicing treatment comprises the following steps:
recording x as a traffic flow density slice cut by the sliding window, and recording y as a traffic flow density value at the next moment of the slice;
then the traffic flow density sliding window data set is obtained and expressed as:
{(xi,yi)}1≤i≤n×time_span
the normalization process is: for { x0,...,xnAnd (5) defining the normalized traffic flow density as follows:
The normalized traffic flow density sliding window data set is the data received in the neural network
And step S13, taking the data of the N clusters, and respectively training N LSTM neural networks.
As shown in fig. 3, the parameter adjusting stage includes the following steps:
step S21, preprocessing the verification set data, specifically including:
and setting the length of the sliding window as seq _ len, performing time series sliding window processing with the time series window size of seq _ len and the sliding window step length of 1 on each sequence in the verification set, and then performing splicing processing and normalization processing which are the same as S12.
And step S22, inputting the processed data into L neural networks (L < N) according to given standards, and performing denormalization operation and weighted summation on L prediction results.
The neural network consists of 1 or 2 layers (adjustable parameters) of LSTM layers, a Dropout layer behind the LSTM layer and a last layer of full-connection layer, the activation function of the full-connection layer is a linear function, the network uses an Adam optimizer, and 1 traffic flow density value is output as a predicted value at the next moment when the traffic flow density of seq _ len length is received.
The given criteria are one based on time labels and one based on distances from the cluster center.
The time labels are used as the standard, namely the time labels of input data are firstly judged, and then the neural networks with the same time labels are selected. If the training set of a neural network does not contain the time tag, no data is input into the neural network.
And calculating the DTW distance between the input data and the clustering center of the clustering cluster corresponding to each neural network by taking the distance between the input data and the clustering center as a standard, and selecting the network for prediction when the distance is smaller than a given threshold value.
The data input process selects the neural network trained by the data similar to the data mode to be predicted, makes full use of the data structure characteristics of the traffic flow density sequence, and has strong pertinence; and the neural network with weak pattern similarity is omitted, so that the calculation amount is saved.
The denormalization operation being the prediction of the resultConversion to { x ] according to the following formula0,...,xn}:
There are also two ways of weighted summation, corresponding to the given criteria at the two inputs.
Setting the L denormalized prediction results as y by taking the time label as a standard1,...,yLIn the cluster corresponding to the kth neural network, the slice having the same time stamp as the input data has N in totalkAnd if the total number of slices containing the time label in the training set is N, the weight of the predicted value output by the kth neural network is as follows:
using the distance from the cluster center as the standard, if the input data and the cluster centerThe DTW distance of (1) is decreased in sequence, and the corresponding prediction result is y1,...,yLAnd then:
c1≤...≤cL
c1+...+cL=1
finally, the predicted values obtained by weighting are:
in step S23, the weighted sum result is corrected using the past data, and the final prediction result is output.
If the input data of the neural network is in the specified correction time period, n past time sequence data { p) with the same type as the working day of the input data of the neural network exist0,...,pn-1The weighted traffic flow density predicted value is OwAnd defining the corrected traffic flow density predicted value O as:
in the formula: alpha represents the correction coefficient of the similar day, and d is the range of the correction days.
And step S24, adjusting parameters, carrying out clustering and neural network training by using the training set data again, and then repeating S22 and S23 and carrying out error analysis.
The error analysis includes the calculation of three indices, MAE, MAPE and MSE, defined as follows:
in the formula: y represents the true value of the traffic flow density, O represents the predicted value of the traffic flow density, and N represents the number of the predicted values of the traffic flow density.
And step S25, repeating the step S24 for a plurality of times, and finally reserving parameters which enable the three indexes to be relatively best in performance as model parameters.
As shown in fig. 4, the test phase performs a test to analyze the predicted result and the actual value, and exemplifies the effectiveness of the model. The method comprises the following specific steps:
step S31, preprocessing the test set data in the same way as S21;
step S32, inputting the processed test set data into L neural networks (L < N) by taking a time label or a distance from a cluster center as a standard, performing denormalization operation and weighted summation on L prediction results, correcting the weighted summation result by using past data, and outputting a final prediction result;
step S33, clustering and neural network training are carried out by using the training set data again, and then step S32 is carried out;
and step S34, repeating the step S33M times, and calculating the Mean value (Mean) and standard deviation (Std) of the MAE, the MSE and the MAPE of the corrected predicted value and the real value so as to simulate the prediction effect of the model under the real condition.
The effectiveness of the present invention can be further exemplified by the following simulation experiments. It is noted that the parameters used in the experiments do not influence the generality of the present invention.
1) Simulation conditions are as follows:
8G memory, 128G hard disk, Intel Core i3-8750H processor, operating system Windows, simulation software SQL, SPSS and Jupyter Notebook.
2) Simulation content:
analytical modeling was performed using the KDD CUP 2020 dataset of the dropletin cover data open platform. And selecting local areas of the metropolis, wherein the time range is from 2016, 11, month and 1 to 11, month and 30, original vehicle track data are recorded at intervals of 2-4 seconds, the original data are combined into 2-minute time intervals, and the data are normalized by the method. In the experiment, traffic flow density data from 11 month 1 to 11 month 28 days are used as a training set, traffic flow density data from 11 month 29 days is used as a verification set, and traffic flow density data from 11 month 30 days is used as a test set.
The model proposed by the method of the invention (denoted as TPO) was compared with a classical time series prediction model, including the recurrent neural network LSTM (denoted as C). TPO and C are subjected to parameter adjustment work on a verification set, and respective optimal parameters are obtained.
The traffic flow density in the local area was predicted in 11 months and 30 days, and error analysis was performed, and the results are shown in table 1.
Compared with the C algorithm, the MAE of the invention is 3.3 multiplied by 10 less on the mean value46X 10 less standard deviation7(ii) a MAPE is 0.09 less in mean value and 0.014 less in standard deviation, and the accuracy and stability of traffic flow density prediction are improved.
TABLE 1 comparison of Performance of the prediction models
The foregoing describes a specific embodiment of the present invention. It should be understood that the above description is only a specific embodiment of the present invention, and is not intended to limit the present invention, and those skilled in the art may make various changes or modifications within the scope of the appended claims without affecting the spirit of the present invention.
Claims (8)
1. A time slot-oriented LSTM traffic flow density prediction method is characterized by comprising the following steps: a data processing stage, a training stage, a parameter adjusting stage and a testing stage;
the data processing stage specifically comprises: selecting a research area, selecting a part which has intersection with the research area from the acquired vehicle track information, calculating according to a traffic flow density formula to obtain a traffic flow density data set of each vehicle in the area, and dividing the traffic flow density data set into a training set, a verification set and a test set;
the training phase comprises the following steps:
s11, segmenting traffic flow density data in a training set according to a given length to obtain time sequence slices, recording time labels of the time sequence slices, calculating similarity among the time sequence slices by using a dynamic time warping method, and classifying the traffic flow density slices according to the similarity by using a K-Means clustering method to obtain N clustering clusters and corresponding time labels;
step S12, constructing a time-slot-oriented LSTM neural network, and performing time-series sliding window processing, splicing processing and normalization processing on input data of the neural network according to a specified length;
step S13, taking the data of N clusters, and respectively training N LSTM neural networks;
the parameter adjusting stage comprises the following steps:
step S21, preprocessing the verification set data, specifically including:
setting the length of a sliding window as seq _ len, performing time series sliding window processing on each sequence in the verification set, wherein the time series window size is seq _ len, the sliding window step length is 1, and then performing splicing processing and normalization processing;
step S22, inputting the processed verification set data into L neural networks according to given standards, wherein L is less than N, and performing denormalization operation and weighted summation on L prediction results;
step S23, the weighted summation result is corrected by using the past data, and the final prediction result is output;
step S24, adjusting parameters, carrying out clustering and neural network training by using the training set data again, and then repeating S22 and S23 and carrying out error analysis;
step S25, repeating step S24 for multiple times, and finally reserving parameters which enable the best relative performance in error analysis as model parameters;
the testing phase comprises the following steps:
step S31, the preprocessing operation of the step S21 is carried out on the test set data;
step S32, inputting the processed test set data into L neural networks according to a given standard, wherein L is less than N, performing inverse normalization operation and weighted summation on L prediction results, correcting the weighted summation result by using past data, and outputting a final prediction result;
step S33, the training set data is reused to carry out clustering and neural network training, and then step S32 is carried out;
and step S34, repeating the step S33M times, and predicting the traffic flow density.
2. The time slot-oriented LSTM traffic flow density prediction method according to claim 1, characterized in that: the vehicle track information is derived from a network data set;
the research area is an urban traffic hot spot area;
the acquired vehicle track information is the motor vehicle track points acquired after the interval time;
accumulating the number of track points in the appointed interval time in the selected research area to obtain a traffic flow density data set of the appointed interval time of each road segment, wherein the appointed interval time is made according to a prediction requirement;
if the specified interval time is delta t and the frequency of the occurrence frequency of the vehicle track points in the research area in the interval time is n, the traffic flow density data is defined as follows:
and dividing the traffic flow density data set into a training set, a verification set and a test set.
3. The time slot-oriented LSTM traffic flow density prediction method according to claim 1, characterized in that: the specific implementation manner of obtaining the N clusters in step S11 is as follows;
firstly, the similarity between time series slices is calculated by utilizing a dynamic time warping method, the concrete realization mode is as follows,
the dynamic time warping method carries out local extension or shortening on a time axis to calculate the similarity between time sequences, if two time sequences needing to calculate the similarity are X and Y, the lengths are | X | and | Y |, i represents the traffic flow density at the time i in X, j represents the traffic flow density at the time j in Y, the rounding path W is defined as:
W=w1,w2,...,wk,Max(|X|,|Y|)≤k≤|X|+|Y|
in the formula: w is a1=(1,1),wk=(|X|,|Y|);
The cumulative rounding distance D (i, j) from (1,1) to (i, j) is defined as:
D(i,j)=Dist(i,j)+Min[D(i-1,j),D(i,j-1),D(i-1,j-1)]
in the formula: dist (i, j) denotes Xi,YjThe distance between the two points;
solving by using dynamic programming to obtain a normalized path distance D (| X |, | Y |);
then, classifying the traffic flow density slice sequences according to the similarity by a K-Means clustering method to obtain various typical sequences of the traffic flow sequences, and integrating N clustering clusters and clustering centers.
4. The time slot-oriented LSTM traffic flow density prediction method according to claim 1, characterized in that: the specific implementation manner of performing time series sliding window processing, splicing processing and normalization processing on the input data according to the specified length in step S12 is as follows;
the time series sliding window processing comprises the following steps:
if the traffic flow density slice data in the cluster is expressed as S1,S2,...,SnThe length of a traffic flow density slice is time _ span, the length of a sliding window is seq _ len, and S is firstly carried outi(i 1.. said, n) is spliced with the first seq _ len-1 traffic flow density values which are logically corresponding to the time in the non-sliced traffic flow density data set and recorded asThen toPerforming time series sliding window processing with the time series window size of seq _ len and the sliding window step length of 1;
the splicing treatment comprises the following steps:
recording x as a traffic flow density slice cut by the sliding window, and recording y as a traffic flow density value at the next moment of the slice;
then the traffic flow density sliding window data set is obtained and expressed as:
{(xi,yi)}1≤i≤n×time_span
the normalization process is: for { x0,...,xnAnd (5) defining the normalized traffic flow density as follows:
5. The time slot-oriented LSTM traffic flow density prediction method according to claim 1, characterized in that: the given criteria in step S22 are divided into two criteria, one is a criterion of time stamp, and the other is a criterion of distance from the cluster center;
the time label is taken as a standard, namely, the time label of input data is judged firstly, then the neural network with the same time label is selected, and if the training set of the neural network does not contain the time label, the data is not input into the neural network;
calculating the DTW distance between the input data and the clustering center of the clustering cluster corresponding to each neural network by taking the distance between the input data and the clustering center as a standard, and selecting the neural network for prediction when the distance is smaller than a given threshold value;
the denormalization operation being the prediction of the resultConversion to { x ] according to the following formula0,...,xn}:
The weighted summation is also divided into two types, and the weighted summation corresponds to the given standard in two input types respectively;
setting the L denormalized prediction results as y by taking the time label as a standard1,...,yLIn the cluster corresponding to the kth neural network, the slice having the same time stamp as the input data has N in totalkAnd if the total number of slices containing the time label in the training set is N, the weight of the predicted value output by the kth neural network is as follows:
using the distance from the cluster center as the standard, if the input data and the cluster centerThe DTW distance of (1) is decreased in sequence, and the corresponding prediction result is y1,...,yLAnd then:
c1≤...≤cL
c1+...+cL=1
finally, the predicted values obtained by weighting are:
6. the time slot-oriented LSTM traffic flow density prediction method according to claim 1, characterized in that: the specific implementation of step S23 is as follows;
if there are n past time sequence data { p) with the same type as the working day of the input data0,...,pn-1The weighted traffic flow density predicted value is OwAnd defining the corrected traffic flow density predicted value O as:
in the formula: α represents the similar day correction coefficient, and d represents the correction day range.
7. The time slot-oriented LSTM traffic flow density prediction method according to claim 1, characterized in that: the error analysis in step S24 includes the calculation of three indices MAE, MAPE and MSE, defined as follows:
in the formula: y represents the true value of the traffic flow density, O represents the predicted value of the traffic flow density, and N represents the number of the predicted values of the traffic flow density.
8. The time slot-oriented LSTM traffic flow density prediction method according to claim 1, characterized in that: in step S34, the mean and standard deviation of the MAE, MSE, MAPE of the corrected predicted value and the true value are calculated to simulate the prediction effect under the true condition.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110185310.5A CN112884222B (en) | 2021-02-10 | 2021-02-10 | Time-period-oriented LSTM traffic flow density prediction method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110185310.5A CN112884222B (en) | 2021-02-10 | 2021-02-10 | Time-period-oriented LSTM traffic flow density prediction method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112884222A true CN112884222A (en) | 2021-06-01 |
CN112884222B CN112884222B (en) | 2022-06-14 |
Family
ID=76056434
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110185310.5A Active CN112884222B (en) | 2021-02-10 | 2021-02-10 | Time-period-oriented LSTM traffic flow density prediction method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112884222B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113570004A (en) * | 2021-09-24 | 2021-10-29 | 西南交通大学 | Riding hot spot area prediction method, device, equipment and readable storage medium |
CN114943386A (en) * | 2022-06-10 | 2022-08-26 | 北京宏瓴科技发展有限公司 | Electric vehicle battery replacement demand prediction method and system based on time sequence |
CN115457764A (en) * | 2022-08-24 | 2022-12-09 | 华南理工大学 | Road section traffic density estimation method, device and medium based on vehicle track data |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105701571A (en) * | 2016-01-13 | 2016-06-22 | 南京邮电大学 | Short-term traffic flow prediction method based on nerve network combination model |
CN109377752A (en) * | 2018-10-19 | 2019-02-22 | 桂林电子科技大学 | Short-term traffic flow variation prediction method, apparatus, computer equipment and storage medium |
CN110889546A (en) * | 2019-11-20 | 2020-03-17 | 浙江省交通规划设计研究院有限公司 | Attention mechanism-based traffic flow model training method |
CN111292534A (en) * | 2020-02-13 | 2020-06-16 | 北京工业大学 | Traffic state estimation method based on clustering and deep sequence learning |
-
2021
- 2021-02-10 CN CN202110185310.5A patent/CN112884222B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105701571A (en) * | 2016-01-13 | 2016-06-22 | 南京邮电大学 | Short-term traffic flow prediction method based on nerve network combination model |
CN109377752A (en) * | 2018-10-19 | 2019-02-22 | 桂林电子科技大学 | Short-term traffic flow variation prediction method, apparatus, computer equipment and storage medium |
CN110889546A (en) * | 2019-11-20 | 2020-03-17 | 浙江省交通规划设计研究院有限公司 | Attention mechanism-based traffic flow model training method |
CN111292534A (en) * | 2020-02-13 | 2020-06-16 | 北京工业大学 | Traffic state estimation method based on clustering and deep sequence learning |
Non-Patent Citations (5)
Title |
---|
HANYI ZOU,ETC: "Short-Term Traffic Flow Prediction using DTW-BiGRU Model", 《2020 35TH YOUTH ACADEMIC ANNUAL CONFERENCE OF CHINESE ASSOCIATION OF AUTOMATION (YAC)》 * |
JINLEI ZHANG,ETC: "Cluster-Based LSTM Network for Short-Term Passenger Flow Forecasting in Urban Rail Transit", 《IEEE》 * |
刘易诗等: "基于时空关联度加权的LSTM短时交通速度预测", 《地理信息世界》 * |
权波等: "基于LSTM的船舶航迹预测模型", 《计算机科学》 * |
薛佳瑶等: "基于卷积循环神经网络的城市区域车流量预测模型", 《信息工程大学学报》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113570004A (en) * | 2021-09-24 | 2021-10-29 | 西南交通大学 | Riding hot spot area prediction method, device, equipment and readable storage medium |
CN114943386A (en) * | 2022-06-10 | 2022-08-26 | 北京宏瓴科技发展有限公司 | Electric vehicle battery replacement demand prediction method and system based on time sequence |
CN115457764A (en) * | 2022-08-24 | 2022-12-09 | 华南理工大学 | Road section traffic density estimation method, device and medium based on vehicle track data |
CN115457764B (en) * | 2022-08-24 | 2023-07-18 | 华南理工大学 | Road section traffic density estimation method, device and medium based on vehicle track data |
Also Published As
Publication number | Publication date |
---|---|
CN112884222B (en) | 2022-06-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107610464B (en) | A kind of trajectory predictions method based on Gaussian Mixture time series models | |
CN110097755B (en) | Highway traffic flow state identification method based on deep neural network | |
CN112884222B (en) | Time-period-oriented LSTM traffic flow density prediction method | |
CN106650767B (en) | Flood forecasting method based on cluster analysis and real-time correction | |
CN111047078B (en) | Traffic characteristic prediction method, system and storage medium | |
CN114548592A (en) | Non-stationary time series data prediction method based on CEMD and LSTM | |
CN112396234A (en) | User side load probability prediction method based on time domain convolutional neural network | |
CN112966871A (en) | Traffic jam prediction method and system based on convolution long-short term memory neural network | |
CN110020712A (en) | A kind of optimization population BP neural network forecast method and system based on cluster | |
CN116187835A (en) | Data-driven-based method and system for estimating theoretical line loss interval of transformer area | |
CN115496257A (en) | Short-term vehicle speed prediction based on space-time fusion | |
CN105913078A (en) | Multi-mode soft measurement method for improving adaptive affine propagation clustering | |
Wibawa et al. | Long Short-Term Memory to Predict Unique Visitors of an Electronic Journal | |
CN110516792A (en) | Non-stable time series forecasting method based on wavelet decomposition and shallow-layer neural network | |
CN114997366A (en) | Protein structure model quality evaluation method based on graph neural network | |
Dhole et al. | An ensemble approach to multi-source transfer learning for air quality prediction | |
Liang et al. | Forecasting tourist arrivals using dual decomposition strategy and an improved fuzzy time series method | |
CN116110219B (en) | Traffic accident prediction method | |
CN116865255A (en) | Short-term wind power prediction method based on improved entropy weight method and SECEEMD | |
Mead | Hybrid CNN and LSTM Model (HCLM) for Short-Term Traffic Volume Prediction | |
CN113657533A (en) | Multi-element time sequence segmentation clustering method for space-time scene construction | |
CN117591919B (en) | Passenger flow prediction method, passenger flow prediction device, electronic equipment and storage medium | |
Chen | Brain Tumor Prediction with LSTM Method | |
CN112651537A (en) | Photovoltaic power generation ultra-short term power prediction method and system | |
Jawed et al. | Fqformer: A fully quantile transformer for time series forecasting |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |