CN111915881B - Small sample traffic flow prediction method based on variational automatic encoder - Google Patents
Small sample traffic flow prediction method based on variational automatic encoder Download PDFInfo
- Publication number
- CN111915881B CN111915881B CN202010529619.7A CN202010529619A CN111915881B CN 111915881 B CN111915881 B CN 111915881B CN 202010529619 A CN202010529619 A CN 202010529619A CN 111915881 B CN111915881 B CN 111915881B
- Authority
- CN
- China
- Prior art keywords
- traffic flow
- distribution
- real traffic
- hidden
- hidden variable
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 238000013507 mapping Methods 0.000 claims abstract description 19
- 238000012549 training Methods 0.000 claims description 21
- 238000013528 artificial neural network Methods 0.000 claims description 17
- 238000005070 sampling Methods 0.000 claims description 6
- 230000001172 regenerating effect Effects 0.000 claims description 3
- 238000001514 detection method Methods 0.000 abstract description 7
- 230000006870 function Effects 0.000 description 10
- 238000013135 deep learning Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000007619 statistical method Methods 0.000 description 2
- 239000000126 substance Substances 0.000 description 2
- 206010039203 Road traffic accident Diseases 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 238000013480 data collection Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000005206 flow analysis Methods 0.000 description 1
- 230000004907 flux Effects 0.000 description 1
- 230000000737 periodic effect Effects 0.000 description 1
- 230000000306 recurrent effect Effects 0.000 description 1
Images
Classifications
-
- 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
-
- 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/045—Combinations of 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
- G06N3/084—Backpropagation, e.g. using gradient descent
-
- 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
- G08G1/0125—Traffic data processing
-
- G—PHYSICS
- G08—SIGNALLING
- G08G—TRAFFIC CONTROL SYSTEMS
- G08G1/00—Traffic control systems for road vehicles
- G08G1/065—Traffic control systems for road vehicles by counting the vehicles in a section of the road or in a parking area, i.e. comparing incoming count with outgoing count
-
- 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
- Y02T—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
- Y02T10/00—Road transport of goods or passengers
- Y02T10/10—Internal combustion engine [ICE] based vehicles
- Y02T10/40—Engine management systems
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Health & Medical Sciences (AREA)
- General Engineering & Computer Science (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Artificial Intelligence (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Biomedical Technology (AREA)
- Life Sciences & Earth Sciences (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Chemical & Material Sciences (AREA)
- Analytical Chemistry (AREA)
- Traffic Control Systems (AREA)
Abstract
The invention discloses a small sample traffic flow prediction method based on a variational automatic encoder, which comprises the following steps of firstly collecting the real traffic flow x running in a road through a road section camera or a detector; then, coding the real traffic flow x into a hidden variable z through a VAE network; decoding the hidden variable z into a reconstructed real traffic flow x' through a VAE network; finally, inputting the real traffic flow x and the reconstructed real traffic flow x' into an Encoder-Decoder end-to-end frame to obtain a mapping relation between the input data and an RNN unit hidden layer result in an Encoder module in the Encoder-Decoder end-to-end frame; and then the future traffic flow is predicted. The invention solves the problem of low traffic flow prediction accuracy caused by small traffic flow data detection samples in the prior art.
Description
Technical Field
The invention belongs to the technical field of traffic flow, and particularly relates to a small sample traffic flow prediction method based on a variational automatic encoder.
Background
With the development of social economy, the number of motor vehicles and non-motor vehicles on roads is increased, the traffic demand of people is increased, the contradiction between the supply and demand of traffic is increased, and the continuous traffic accidents, the traffic jam at intersections and the problem that the two sides of the roads are difficult to stop at present become obstacles in the stable development process of cities. How to obtain historical traffic flow data through detection equipment on a road section with a large traffic flow, and obtaining a traffic flow result of a current road at a future moment through a series of statistical analysis, correlation model analysis and the like, has great significance for safe and stable operation of road traffic.
In predicting the traffic flow, it is first necessary to acquire traffic flow data. At present, the collection of road traffic flow data mainly depends on a detector, a camera or an underground pressure sensor and the like. However, to improve the accuracy of the traffic transportation model, a large amount of data is needed for statistical analysis, and a large-scale traffic data acquisition process is lengthy. Moreover, if the data collection device is damaged, a loss of part of the data is caused. The deep learning method has obvious effect on the aspect of traffic flow analysis, can accurately obtain some characteristics and results on the aspect of future traffic transportation, and has the great characteristic that a large amount of data is required for network training, so that the deep learning method is contrary to the current traffic flow data acquisition aspect.
Therefore, aiming at the problems, the invention combines the early-stage short-time collected data, constructs the generated data distribution which accords with the real traffic flow data distribution through the learning of the VAE generator, enlarges the traffic flow data scale, and the road traffic flow data belongs to the time sequence data, so that the future traffic flow is predicted by utilizing an end-to-end model frame of a code-Decoder (Encoder-Decoder) to realize the sequence-to-sequence model, and the road traffic safety level is improved.
The basic idea for solving the problem of traffic flow data prediction of small samples is as follows: the current road traffic flow data are obtained through the detection equipment, the obtained historical traffic flow data of the small sample are trained through the VAE generator, the original historical traffic flow data of the small sample are expanded, and the traffic flow data prediction accuracy is improved. And then, uniformly inputting the real data and the generated data into an Encoder-Decoder model framework, wherein an Encoder mainly reads and encodes input sequence data, a Decoder mainly reads the output of the Encoder and performs multi-step prediction and output on the sequence, and a Recurrent Neural Network (RNN) model appears in the Decoder framework. At present, a generator of a mainstream mainly generates a countermeasure network (GAN) and a VAE, and the GAN mainly utilizes an internal generator and a discriminator to play games, so that the error of an opposite side is maximized, data conforming to real data distribution is finally generated, the consumption time of the network in the training process is longer, and the training cannot be normally continued because the generator cannot judge whether the network effect is better or not in the training process, so that the generator obtains the same data as before.
Disclosure of Invention
The invention aims to provide a small sample traffic flow prediction method based on a variational automatic encoder, which solves the problem of low traffic flow prediction accuracy caused by small traffic flow data detection samples in the prior art.
The technical scheme adopted by the invention is that a small sample traffic flow prediction method based on a variational automatic encoder is implemented according to the following steps:
step 3, decoding the hidden variable z into a reconstructed real traffic flow x' through a VAE network;
step 4, inputting the real traffic flow x and the reconstructed real traffic flow x' into an Encoder-Decoder end-to-end frame to obtain a mapping relation between the input data and an RNN unit hidden layer result in an Encoder module in the Encoder-Decoder end-to-end frame;
and 5, predicting future traffic flow.
The present invention is also characterized in that,
the step 2 is implemented according to the following steps:
step 2.1, determining that the real traffic flow x is x 1 ,...,x i ,...,x t Wherein, i ═ 1.. ang., t, x i Representing the real traffic flow when the time is i, and t represents the total time length;
step 2.2, defining hidden variables z, wherein the corresponding distribution of the hidden variables z is p (z), the distribution of the real traffic flow x is p (x), and obtaining the relation between the distribution p (z) of the hidden variables z and the distribution p (x) of the real traffic flow x through a conditional probability formula, wherein the relation is shown as a formula (1):
wherein, p (z | x) is the distribution of a hidden variable z under the condition of the real traffic flow x, and p (x | z) is the distribution of the real traffic flow x under the condition of the hidden variable z;
step 2.3, training the real traffic flow x through a neural network, wherein the network input is traffic flow data x, and the network output is the mean value mu and the variance sigma of the real traffic flow x 2 So that the real traffic flow x follows a normal distribution N (mu, sigma) 2 ) (ii) a Obtaining the distribution q (z | x) of a hidden variable z under the condition that the real traffic flow x obeys normal distribution by sampling the normal distribution;
step 2.4, calculating a distance KL (q (z | x) | p (z | x)) between the distribution p (z | x) of the hidden variable z under the condition that the real traffic flow x obeys normal distribution and the distribution q (z | x) of the hidden variable z under the condition that the real traffic flow x obeys normal distribution, as shown in formula (2):
by minimizing the formula (2), obtaining a minimum distance min (KL (q (z | x) | p (z | x))) between a distribution p (z | x) of a hidden variable z under the condition of the real traffic flow x and a distribution q (z | x) of the hidden variable z under the condition that the real traffic flow x obeys normal distribution, and taking the minimum distance min (KL (q (z | x) | p (z | x))) as a loss function in the VAE network, specifically as the formula (3):
wherein KL (q (z | x) | p (z)) corresponds to the encoding process in the VAE network, E z~q(z|x) [logp(x|z)]Corresponding to a decoding process in a VAE network, z-q (z | x) represents the distribution of a real traffic flow x generated under the condition that a hidden variable z obeys posterior distribution q (z | x), and p (x | z) represents the distribution of the real traffic flow x generated under the condition that the hidden variable z obeys posterior distribution q (z | x);
step 2.5, assuming that the hidden variable z obeys the standard normal distribution N (0,1), namely p (z) to N (0,1), the distribution q (z | x) of the hidden variable z obeys the normal distribution under the condition that the real traffic flow x obeys the normal distribution, namely q (z | x) to N (mu, sigma) according to the normal distribution 2 ) Through step 2.4, a distance KL (q (z | x) | p (z))) between the distribution of the calculated hidden variable z and the distribution q (z | x) of the hidden variable z under the condition that the real traffic flow x obeys normal distribution is obtained, and the following results are obtained:
wherein the mean μ and the variance σ 2 Training a real traffic flow x through a neural network to obtain the real traffic flow x; and (3) obtaining the distribution q (z | x) of the hidden variable z under the condition that the real traffic flow x obeys normal distribution by utilizing a minimization formula (4), and further obtaining the distribution p (z | x) of the hidden variable z under the condition of the real traffic flow x, namely encoding the real traffic flow x into the hidden variable z.
Step 3 is specifically implemented according to the following steps:
training the encoded hidden variable z by utilizing a neural network, wherein the input of the network is the encoded hidden variable z, and the output is the mean value of the encoded hidden variable zAnd varianceBy sampling the normal distribution, the distribution p '(x | z) of the reconstructed real traffic flow x' is obtained under the condition that the coded hidden variable z obeys the normal distribution, as shown in the formula (5):
in step 2.4, the distribution p (x | z) of the real traffic flow x generated under the condition that the hidden variable z obeys the posterior distribution q (z | x) in the formula (3) is equal to the condition that the hidden variable z obeys the normal distributionUnder the condition of (a), the distribution p '(x | z) of the real traffic flow x' is reconstructed, and thus, E in the formula (3) z~q(z|x) [logp(x|z)]As shown in equation (6):
the result which is closer to the real traffic flow x, namely the reconstructed traffic flow x ' can be obtained by calculating posterior distribution p ' (x | z), and the process of regenerating the traffic flow by the process can approximate training data by using a neural network, so that the formula (3) is optimized by combining the formula (4) and the formula (6) through a back propagation method in the network training process, namely, a loss function in a VAE network is optimized, and the finally obtained reconstructed traffic flow x ' is more similar to the real traffic flow x;
definition of reconstructed traffic flow x '═ { x' t+1 ,...,x' t+i ,....,x' 2t },i=1,...,t,x' t+i Representing the reconstructed traffic flow when the time is t + i, t representing the total time length of the real traffic flow x, the starting moment of the reconstructed traffic flow x' being t +1, and the total time length being t.
The step 4 is as follows:
the real traffic flow X and the reconstructed traffic flow X' together form input data X ═ X 1 ,...,X j ,...,X T 1, wherein X is j The method comprises the following steps of representing the size of corresponding input data at the moment j, representing the total duration of the input data by T, namely T being 2T, and transmitting X to an Encoder-Decoder end-to-end framework, wherein the framework comprises two modules: encoder module and Decoder moduleThe Encoder module and the Decoder module are both composed of a plurality of RNN units, and each RNN unit is composed of an input layer, a hidden layer and an output layer;
the RNN unit in the Encoder module receives the input data X and transmits the input data X to the hidden layer to obtain a hidden layer result h corresponding to the current moment j =f(h j-1 ,X j ) Wherein X is j Represents input data of RNN cell corresponding to current time j, h j-1 Is the RNN hidden layer result, h, corresponding to the previous time j-1 j The function f represents the hidden layer result at the previous moment and the mapping relation between the input data at the current moment and the hidden layer result at the current moment; the hidden layer results corresponding to different time are collected and compressed into a fixed length and transmitted to a vector C, wherein the vector C represents the input traffic flow data X T Hidden layer results h corresponding to different moments j The relationship between the two is specifically expressed as: q (h) 1 ,h 2 ,...,h T ) And q is a mapping relation between hidden layer results of a plurality of different RNN units and a vector C, the mapping relation is usually represented by a weighted sum of the hidden layer results, T represents the total duration of input data, and the vector C is obtained through an Encoder module so as to obtain the mapping relation between the input data X and the hidden layer results of the RNN units.
The step 5 is as follows:
transmitting the vector C obtained in the step 4 to an RNN unit in a Decoder module in an Encoder-Decoder framework, and obtaining a traffic flow predicted value through a hidden layer and an output layerWherein T is f The time length required to be predicted is represented, T represents the total time length of the input data X, and the specific relation is as follows:wherein the content of the first and second substances,indicates the current time T + T f Traffic flow ofThe amount of the sample to be measured is predicted,represents the last time T + T f -1 a traffic flow prediction value,indicates the last time T + T f -1 hidden layer result of corresponding RNN unit, function g representing mapping relation between current time traffic flow predicted value and last time traffic flow predicted value and Encoder module output, function g obtained by nonlinear multi-layer neural network training, final prediction result Y ═ Y T+1 ,...,Y T+Tf ]Where T represents the total duration of the input data X, T f Indicating the length of time to be predicted, and Y indicating the duration of time T f And if the corresponding traffic flow predicted value Y is larger, the situation that the road traffic is jammed at the moment in the future is shown.
The small sample traffic flow prediction method based on the variational automatic encoder has the advantages that the current road traffic flow data is obtained through the detection equipment, the small sample traffic flow data obtained by the detection equipment is reconstructed and expanded by the VAE generator, the original small sample traffic flow data is expanded, the data detection cost is reduced, and the traffic flow data prediction accuracy can be further improved. And then uniformly inputting the real data and the generated data into an Encoder-Decoder model framework, wherein an Encoder and a Decoder module adopt RNN to calculate the input data, the Encoder mainly reads an input traffic flow sequence and encodes the input traffic flow sequence into a vector C with a fixed length, and the Decoder reads the vector output of the Encoder and predicts and outputs the sequence. By using the small sample traffic flow prediction method based on the variational automatic encoder, the traffic flow prediction accuracy can be improved aiming at the disadvantage of small sample data in a neural network, the road safety level is further improved, and the traffic jam state is reduced.
Drawings
FIG. 1 is a general flow diagram of a small sample traffic flow prediction method based on a variational automatic encoder of the present invention;
FIG. 2 is a VAE generation process of a small sample traffic flow prediction method based on a variational automatic encoder according to the present invention;
fig. 3 is a traffic flow data prediction part (Encoder-Decoder end-to-end model framework) of a small sample traffic flow prediction method based on a variation automatic Encoder according to the present invention.
Detailed Description
The invention is described in detail below with reference to the drawings and the detailed description.
The invention discloses a small sample traffic flow prediction method based on a variational automatic encoder, which is implemented by the following steps as shown in a flow chart shown in figure 1:
step 2.1, determining that the real traffic flow x is x 1 ,...,x i ,...,x t Wherein, i is 1 i Representing the real traffic flow when the time is i, and t represents the total time length;
step 2.2, defining a hidden variable z, wherein the corresponding distribution of the hidden variable z is p (z), the distribution of the real traffic flow x is p (x), and obtaining the relation between the distribution p (z) of the hidden variable z and the distribution p (x) of the real traffic flow x by a conditional probability formula, such as the formula (1):
wherein, p (z | x) is the distribution of a hidden variable z under the condition of the real traffic flow x, and p (x | z) is the distribution of the real traffic flow x under the condition of the hidden variable z;
step 2.3, training the real traffic flow x through a neural network, wherein the network input is traffic flow data x, and the network output is the mean value mu and the variance sigma of the real traffic flow x 2 To make true hand overThe flux x follows a normal distribution N (mu, sigma) 2 ) (ii) a Obtaining the distribution q (z | x) of a hidden variable z under the condition that the real traffic flow x obeys normal distribution by sampling the normal distribution;
step 2.4, calculating a distance KL (q (z | x) | p (z | x)) between the distribution p (z | x) of the hidden variable z under the condition that the real traffic flow x obeys normal distribution and the distribution q (z | x) of the hidden variable z under the condition that the real traffic flow x obeys normal distribution, as shown in formula (2):
by minimizing the formula (2), obtaining a minimum distance min (KL (q (z | x) | p (z | x))) between a distribution p (z | x) of a hidden variable z under the condition of the real traffic flow x and a distribution q (z | x) of the hidden variable z under the condition that the real traffic flow x obeys normal distribution, and taking the minimum distance min (KL (q (z | x) | p (z | x))) as a loss function in the VAE network, specifically as the formula (3):
wherein KL (q (z | x) | p (z)) corresponds to the encoding process in the VAE network, E z~q(z|x) [logp(x|z)]Corresponding to a decoding process in a VAE network, z-q (z | x) represents the distribution of a real traffic flow x generated under the condition that a hidden variable z obeys posterior distribution q (z | x), and p (x | z) represents the distribution of the real traffic flow x generated under the condition that the hidden variable z obeys posterior distribution q (z | x);
step 2.5, assuming that the hidden variable z obeys the standard normal distribution N (0,1), namely p (z) to N (0,1), and the distribution q (z | x) of the hidden variable z obeys the normal distribution under the condition that the real traffic flow x obeys the normal distribution, namely q (z | x) to N (mu, sigma) of the hidden variable z 2 ) Through step 2.4, a distance KL (q (z | x) | p (z))) between the distribution of the calculated hidden variable z and the distribution q (z | x) of the hidden variable z under the condition that the real traffic flow x obeys normal distribution is obtained, and the following results are obtained:
wherein the mean μ and the variance σ 2 Training a real traffic flow x through a neural network to obtain the real traffic flow x; and (3) obtaining the distribution q (z | x) of the hidden variable z under the condition that the real traffic flow x obeys normal distribution by utilizing a minimization formula (4), and further obtaining the distribution p (z | x) of the hidden variable z under the condition of the real traffic flow x, namely encoding the real traffic flow x into the hidden variable z.
Step 3, as shown in fig. 2, decoding the hidden variable z into a reconstructed real traffic flow x' through the VAE network, specifically according to the following steps:
the distribution p (z | x) of the hidden variable z under the condition of the real traffic flow x is obtained through the step 2, namely, the real traffic flow x is coded into the hidden variable z. E z~q(z|x) [logp(x|z)]An expected value of the real traffic flow x generated under the condition that the hidden variable z obeys the posterior distribution q (z | x). Assuming that posterior distribution p (x | z) in formula (3) of step 2.4 obeys normal distribution, the distribution p (z | x) of hidden variable z under the condition of real traffic flow x is obtained through step 2.5, that is, hidden variable z is obtained by encoding real traffic flow x, and encoded hidden variable z is trained by using a neural network, wherein the input of the network is encoded hidden variable z, and the output is the mean value of encoded hidden variable zAnd varianceBy sampling the normal distribution, the distribution p '(x | z) of the reconstructed real traffic flow x' is obtained under the condition that the coded hidden variable z obeys the normal distribution, as shown in the formula (5):
since the reconstructed traffic flow x' is obtained by reconstructing the real traffic flow x through the VAE network, the distribution of the reconstructed traffic flow x is similar to the distribution of the real traffic flow x, and therefore, the hidden variable z in the formula (3) in the step 2.4 obeys the posterior distribution q (z)| x) is equivalent to a condition that a hidden variable z obeys normal distributionUnder the condition of (b), the distribution p '(x | z) of the true traffic flow x' is reconstructed, and therefore, E in the formula (3) z~q(z|x) [logp(x|z)]As shown in equation (6):
the result which is closer to the real traffic flow x, namely the reconstructed traffic flow x ' can be obtained by calculating posterior distribution p ' (x | z), and the process of regenerating the traffic flow by the process can approximate training data by using a neural network, so that the formula (3) is optimized by combining the formula (4) and the formula (6) through a back propagation method in the network training process, namely, a loss function in a VAE network is optimized, and the finally obtained reconstructed traffic flow x ' is more similar to the real traffic flow x;
since the traffic flow data is periodic, the total time duration of the real traffic flow x is t, and the reconstructed traffic flow x ' has the same time duration as and similar size to the real traffic flow x, the reconstructed traffic flow x ' is defined as { x ' t+1 ,...,x' t+i ,....,x' 2t },i=1,...,t,x' t+i Representing the reconstructed traffic flow when the time is t + i, wherein t represents the total time length of the real traffic flow x, the starting moment of the reconstructed traffic flow x' is t +1, and the total time length is t.
Step 4, inputting the real traffic flow x and the reconstructed real traffic flow x' into an Encoder-Decoder end-to-end frame to obtain a mapping relation between the input data and an RNN unit hidden layer result in an Encoder module in the Encoder-Decoder end-to-end frame; the step 4 is as follows:
the real traffic flow X and the reconstructed traffic flow X' jointly form input data X ═ { X ═ X 1 ,...,X j ,...,X T 1, wherein X is j Indicating the corresponding input data size at time j, and T the total input data duration, i.e.And T is 2T, and X is transmitted into an Encoder-Decoder end-to-end framework, wherein the framework comprises two modules: the device comprises an Encoder module and a Decoder module, wherein the Encoder module and the Decoder module are both composed of a plurality of RNN units, and each RNN unit is composed of an input layer, a hidden layer and an output layer; in the RNN unit, the result of the hidden layer at the current time is related to both the current time input and the previous time hidden layer result.
The RNN unit in the Encoder module receives the input data X and transmits the input data X to the hidden layer to obtain a hidden layer result h corresponding to the current moment j =f(h j-1 ,X j ) Wherein X is j Represents input data of RNN cell corresponding to current time j, h j-1 Is the RNN hidden layer result, h, corresponding to the previous time j-1 j The function f represents the hidden layer result at the previous moment and the mapping relation between the input data at the current moment and the hidden layer result at the current moment; as shown in fig. 3, the hidden layer results corresponding to different times are collected and compressed into a fixed length, and transmitted to the vector C, which represents the input traffic flow data X T Hidden layer results h corresponding to different moments j The relationship between the two is specifically expressed as: q (h) 1 ,h 2 ,...,h T ) And q is a mapping relation between hidden layer results of a plurality of different RNN units and a vector C, the mapping relation is usually represented by a weighted sum of the hidden layer results, T represents the total duration of input data, and the vector C is obtained through an Encoder module so as to obtain the mapping relation between the input data X and the hidden layer results of the RNN units.
Step 5, predicting future traffic flow, which is specifically as follows:
and transmitting the vector C obtained in the step 4 to an RNN unit in a Decoder module in an Encoder-Decoder framework, wherein the Decoder module is similar to the Encoder module and consists of a plurality of RNN units. Obtaining traffic flow predicted value through hidden layer and output layerWherein T is f Indicating the length of time that needs to be predicted, T the total of input data XThe time length is specifically related to:wherein the content of the first and second substances,represents the current time T + T f The predicted value of the traffic flow of (a),represents the last time T + T f -1 a traffic flow prediction value,indicates the last time T + T f -1 hidden layer result of corresponding RNN unit, function g representing mapping relation between current time traffic flow predicted value and last time traffic flow predicted value and Encoder module output, function g obtained by nonlinear multi-layer neural network training, final prediction result Y ═ Y T+1 ,...,Y T+Tf ]Where T represents the total duration of the input data X, T f Indicating the length of time to be predicted, and Y indicating the duration of time T f And if the corresponding traffic flow predicted value Y is larger, the situation that the road traffic is jammed at the moment in the future is shown.
Claims (1)
1. A small sample traffic flow prediction method based on a variational automatic encoder is characterized by comprising the following steps:
step 1, collecting real traffic flow x running in a road through a road section camera or a detector;
step 2, coding the real traffic flow x into a hidden variable z through a VAE network;
step 3, decoding the hidden variable z into a reconstructed real traffic flow x' through a VAE network;
step 4, inputting the real traffic flow x and the reconstructed real traffic flow x' into an Encoder-Decoder end-to-end frame to obtain a mapping relation between the input data and an RNN unit hidden layer result in an Encoder module in the Encoder-Decoder end-to-end frame;
step 5, predicting future traffic flow;
the step 2 is specifically implemented according to the following steps:
step 2.1, determining that the real traffic flow x is x 1 ,...,x i ,...,x t Wherein, i is 1 i Representing the real traffic flow when the time is i, and t represents the total time length;
step 2.2, defining hidden variables z, wherein the corresponding distribution of the hidden variables z is p (z), the distribution of the real traffic flow x is p (x), and obtaining the relation between the distribution p (z) of the hidden variables z and the distribution p (x) of the real traffic flow x through a conditional probability formula, wherein the relation is shown as a formula (1):
wherein, p (z | x) is the distribution of a hidden variable z under the condition of the real traffic flow x, and p (x | z) is the distribution of the real traffic flow x under the condition of the hidden variable z;
step 2.3, training the real traffic flow x through a neural network, wherein the network input is traffic flow data x, and the network output is the mean value mu and the variance sigma of the real traffic flow x 2 So that the real traffic flow x follows a normal distribution N (mu, sigma) 2 ) (ii) a Obtaining the distribution q (z | x) of a hidden variable z under the condition that the real traffic flow x obeys normal distribution by sampling the normal distribution;
step 2.4, calculating a distance KL (q (z | x) | p (z | x)) between the distribution p (z | x) of the hidden variable z under the condition that the real traffic flow x obeys normal distribution and the distribution q (z | x) of the hidden variable z under the condition that the real traffic flow x obeys normal distribution, as shown in formula (2):
by minimizing the formula (2), a minimum distance min (KL (q (z | x) | p (z | x))) between a distribution p (z | x) of a hidden variable z under the condition that the real traffic flow x is subject to normal distribution and a distribution q (z | x) of the hidden variable z under the condition that the real traffic flow x is subject to normal distribution is obtained, and the minimum distance min (KL (q (z | x) | p (z | x))) is taken as a loss function in the VAE network, specifically, the formula (3):
wherein KL (q (z | x) | p (z)) corresponds to the encoding process in the VAE network, E z~q(z|x) [logp(x|z)]Corresponding to a decoding process in a VAE network, z-q (z | x) represents the distribution of a real traffic flow x generated under the condition that a hidden variable z obeys posterior distribution q (z | x), and p (x | z) represents the distribution of the real traffic flow x generated under the condition that the hidden variable z obeys posterior distribution q (z | x);
step 2.5, assuming that the hidden variable z obeys the standard normal distribution N (0,1), namely p (z) to N (0,1), the distribution q (z | x) of the hidden variable z obeys the normal distribution under the condition that the real traffic flow x obeys the normal distribution, namely q (z | x) to N (mu, sigma) according to the normal distribution 2 ) Through step 2.4, a distance KL (q (z | x) | p (z))) between the distribution of the calculated hidden variable z and the distribution q (z | x) of the hidden variable z under the condition that the real traffic flow x obeys normal distribution is obtained, and the following results are obtained:
wherein the mean μ and the variance σ 2 Training a real traffic flow x through a neural network to obtain the real traffic flow x; obtaining the distribution q (z | x) of the hidden variable z under the condition that the real traffic flow x obeys normal distribution by utilizing a minimization formula (4), and further obtaining the distribution p (z | x) of the hidden variable z under the condition of the real traffic flow x, namely coding the real traffic flow x into the hidden variable z;
the step 3 is specifically implemented according to the following steps:
training the encoded hidden variable z by utilizing a neural network, wherein the input of the network is the encoded hidden variable z, and the output is the mean value of the encoded hidden variable zAnd varianceBy sampling the normal distribution, the distribution p '(x | z) of the reconstructed real traffic flow x' is obtained under the condition that the coded hidden variable z obeys the normal distribution, as shown in the formula (5):
in step 2.4, the distribution p (x | z) of the real traffic flow x generated under the condition that the hidden variable z obeys the posterior distribution q (z | x) in the formula (3) is equal to the condition that the hidden variable z obeys the normal distributionUnder the condition of (a), the distribution p '(x | z) of the real traffic flow x' is reconstructed, and thus, E in the formula (3) z~q(z|x) [logp(x|z)]As shown in equation (6):
the result which is closer to the real traffic flow x, namely the reconstructed traffic flow x ' can be obtained by calculating posterior distribution p ' (x | z), and the process of regenerating the traffic flow by the process can approximate training data by using a neural network, so that the formula (3) is optimized by combining the formula (4) and the formula (6) through a back propagation method in the network training process, namely, a loss function in a VAE network is optimized, and the finally obtained reconstructed traffic flow x ' is more similar to the real traffic flow x;
definition of reconstructed traffic flow x '═ { x' t+1 ,...,x' t+i ,....,x' 2t },i=1,...,t,x' t+i Representing the reconstructed traffic flow when the time is t + i, wherein t represents the total time length of the real traffic flow x, the starting moment of the reconstructed traffic flow x' is t +1, and the total time length is t;
the above-mentionedThe step 4 is as follows: the real traffic flow X and the reconstructed traffic flow X' jointly form input data X ═ { X ═ X 1 ,...,X j ,...,X T 1, wherein X is j The method comprises the following steps of representing the size of corresponding input data at the moment j, representing the total duration of the input data by T, namely T being 2T, and transmitting X to an Encoder-Decoder end-to-end framework, wherein the framework comprises two modules: the device comprises an Encoder module and a Decoder module, wherein the Encoder module and the Decoder module are both composed of a plurality of RNN units, and each RNN unit is composed of an input layer, a hidden layer and an output layer;
the RNN unit in the Encoder module receives the input data X and transmits the input data X to the hidden layer to obtain a hidden layer result h corresponding to the current moment j =f(h j-1 ,X j ) Wherein X is j Represents input data of RNN cell corresponding to current time j, h j-1 Is the RNN hidden layer result, h, corresponding to the previous time j-1 j The function f represents the hidden layer result at the previous moment and the mapping relation between the input data at the current moment and the hidden layer result at the current moment; the hidden layer results corresponding to different time are collected and compressed into a fixed length and transmitted to a vector C, wherein the vector C represents the input traffic flow data X T Hidden layer results h corresponding to different moments j The relationship between the two is specifically expressed as: q (h) 1 ,h 2 ,...,h T ) Q is a mapping relation between hidden layer results of a plurality of different RNN units and a vector C, the mapping relation is represented by a weighted sum of the hidden layer results, T represents the total duration of input data, and the vector C is obtained through an Encoder module so that the mapping relation between the input data X and the hidden layer results of the RNN units is obtained;
the step 5 is specifically as follows:
transmitting the vector C obtained in the step 4 to an RNN unit in a Decoder module in an Endecoder-Decoder framework, and obtaining a traffic flow predicted value through a hidden layer and an output layerWherein T is f Indicating a need for predictionThe time length, T, represents the total duration of the input data X, and the specific relationship is:wherein, the first and the second end of the pipe are connected with each other,indicates the current time T + T f The predicted value of the traffic flow of (a),represents the last time T + T f -1 a traffic flow prediction value,indicates the last time T + T f -1 hidden layer result of corresponding RNN unit, function g representing mapping relation between current time traffic flow predicted value and last time traffic flow predicted value and Encoder module output, function g obtained by nonlinear multi-layer neural network training, final prediction result Y ═ Y T+1 ,...,Y T+Tf ]Where T represents the total duration of the input data X, T f Indicating the length of time to be predicted, and Y indicating the duration of time T f And if the corresponding traffic flow predicted value Y is larger, the situation that the road traffic is jammed at the moment in the future is shown.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010529619.7A CN111915881B (en) | 2020-06-11 | 2020-06-11 | Small sample traffic flow prediction method based on variational automatic encoder |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010529619.7A CN111915881B (en) | 2020-06-11 | 2020-06-11 | Small sample traffic flow prediction method based on variational automatic encoder |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111915881A CN111915881A (en) | 2020-11-10 |
CN111915881B true CN111915881B (en) | 2022-09-02 |
Family
ID=73237651
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010529619.7A Active CN111915881B (en) | 2020-06-11 | 2020-06-11 | Small sample traffic flow prediction method based on variational automatic encoder |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111915881B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113642822B (en) * | 2020-12-04 | 2024-03-01 | 广东省建筑设计研究院有限公司 | VAE-based sample set directivity extension method for evaluating building group structure safety |
CN113282552B (en) * | 2021-06-04 | 2022-11-22 | 上海天旦网络科技发展有限公司 | Similarity direction quantization method and system for flow statistic log |
CN115017990B (en) * | 2022-06-01 | 2023-01-17 | 哈尔滨工业大学(深圳)(哈尔滨工业大学深圳科技创新研究院) | Traffic flow prediction method, device, equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101025854A (en) * | 2007-02-12 | 2007-08-29 | 西安理工大学 | Concrete internal temperature detecting device based on induction princinple |
CN106910337A (en) * | 2017-01-19 | 2017-06-30 | 长安大学 | A kind of traffic flow forecasting method based on glowworm swarm algorithm Yu RBF neural |
CN108921343A (en) * | 2018-06-26 | 2018-11-30 | 浙江工业大学 | Based on storehouse self-encoding encoder-support vector regression traffic flow forecasting method |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103366411B (en) * | 2012-03-30 | 2016-01-06 | 国际商业机器公司 | For the method and apparatus by wireless network transmissions vehicle position data residual error |
GB201415731D0 (en) * | 2014-09-05 | 2014-10-22 | Tom Tom Int Bv | Methods and systems for generating flow data |
US11189171B2 (en) * | 2018-03-13 | 2021-11-30 | Nec Corporation | Traffic prediction with reparameterized pushforward policy for autonomous vehicles |
WO2019228654A1 (en) * | 2018-06-01 | 2019-12-05 | Toyota Motor Europe | Method for training a prediction system and system for sequence prediction |
CN109117987B (en) * | 2018-07-18 | 2020-09-29 | 厦门大学 | Personalized traffic accident risk prediction recommendation method based on deep learning |
CN110245380A (en) * | 2019-05-10 | 2019-09-17 | 西安理工大学 | Soft instrument training and sample compensation process |
CN110599766B (en) * | 2019-08-22 | 2020-08-18 | 浙江工业大学 | Road traffic jam propagation prediction method based on SAE-LSTM-SAD |
-
2020
- 2020-06-11 CN CN202010529619.7A patent/CN111915881B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101025854A (en) * | 2007-02-12 | 2007-08-29 | 西安理工大学 | Concrete internal temperature detecting device based on induction princinple |
CN106910337A (en) * | 2017-01-19 | 2017-06-30 | 长安大学 | A kind of traffic flow forecasting method based on glowworm swarm algorithm Yu RBF neural |
CN108921343A (en) * | 2018-06-26 | 2018-11-30 | 浙江工业大学 | Based on storehouse self-encoding encoder-support vector regression traffic flow forecasting method |
Non-Patent Citations (3)
Title |
---|
A variational autoencoder solution for road traffic forecasting systems: Missing data imputation;Guillem Boquet.etc;《Transportation Research》;20200320;第2-7页 * |
基于二元决策图的故障树底事件排序;黑新宏等;《西安理工大学学报》;20160330;全文 * |
基于深度学习的交通预测技术及其在通信中的应用研究;张文刚;《中国优秀硕士学位论文全文数据库》;20181015;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN111915881A (en) | 2020-11-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111915881B (en) | Small sample traffic flow prediction method based on variational automatic encoder | |
CN104134349B (en) | A kind of public transport road conditions disposal system based on traffic multisource data fusion and method | |
CN111832814A (en) | Air pollutant concentration prediction method based on graph attention machine mechanism | |
CN114299723B (en) | Traffic flow prediction method | |
CN108133295B (en) | Motor vehicle exhaust concentration continuous time prediction method for target road section | |
CN110163449B (en) | Motor vehicle pollution discharge monitoring node deployment method based on active space-time diagram convolution | |
CN104408913A (en) | Traffic flow three parameter real time prediction method taking regard of space-time correlation | |
CN102496284A (en) | Method for acquiring and predicting road traffic flow | |
CN106772695B (en) | A kind of Along Railway wind speed forecasting method for merging many air measuring station measured datas | |
CN115022187B (en) | Situation awareness method and device for electric-gas comprehensive energy system | |
CN104408915A (en) | Traffic state parameter estimation method and system | |
CN110738355A (en) | urban waterlogging prediction method based on neural network | |
CN113762338B (en) | Traffic flow prediction method, equipment and medium based on multiple graph attention mechanism | |
CN112330951A (en) | Method for realizing road network traffic data restoration based on generation of countermeasure network | |
CN115237896B (en) | Data preprocessing method and system based on deep learning forecast air quality | |
CN110738855A (en) | Road traffic flow condition prediction method for data sparse time periods | |
CN113112819B (en) | Improved LSTM-based graph convolution traffic speed prediction method | |
CN116307152A (en) | Traffic prediction method for space-time interactive dynamic graph attention network | |
CN114692762A (en) | Vehicle track prediction method based on graph attention interaction mechanism | |
CN114202120A (en) | Urban traffic travel time prediction method aiming at multi-source heterogeneous data | |
CN114913689B (en) | Traffic flow prediction method based on priori knowledge time-varying graph convolution network | |
CN116151459A (en) | Power grid flood prevention risk probability prediction method and system based on improved Transformer | |
CN115293237A (en) | Vehicle track prediction method based on deep learning | |
CN117371571A (en) | Regional air quality prediction model based on multi-scale dynamic synchronous diagram mechanism | |
CN110837806B (en) | Indoor positioning method based on deep convolutional memory network |
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 | ||
TR01 | Transfer of patent right |
Effective date of registration: 20240220 Address after: 518000 1002, Building A, Zhiyun Industrial Park, No. 13, Huaxing Road, Henglang Community, Longhua District, Shenzhen, Guangdong Province Patentee after: Shenzhen Wanzhida Technology Co.,Ltd. Country or region after: China Address before: 710048 Shaanxi province Xi'an Beilin District Jinhua Road No. 5 Patentee before: XI'AN University OF TECHNOLOGY Country or region before: China |
|
TR01 | Transfer of patent right |