You are on page 1of 4

Traffic Flow Prediction Based on Wavelet Analysis,

Genetic Algorithm and Artificial Neural Network



Lu Baichuan
Transport School, Chongqing Jiaotong University
No. 66, Xuefu Road, Chongqing 400074, China
Emails: baichlu@gmail.com


Huang Meiling
Transport School, Chongqing Jiaotong University
No. 66, Xuefu Road, Chongqing 400074, China
Emails: humeli317@163.com
AbstractBased on the analysis of the characteristics of
nonlinearity and strong interference of traffic flow due to the
complex and uncertainty of time variance in real traffic system, a
new approach has been proposed for traffic flow prediction. First,
wavelet transform is used to eliminate the noise of original traffic
data. Then it decomposes the traffic flow sequence into the low and
high frequencies in the multi- scale analysis and restores the trend
components. The artificial neural network is used in multi-scale
forecasting of these coefficients, in which gene algorithm is used to
optimize the artificial neural network. Finally, the real detected
traffic data are used to testify the precision of the model, and the
results show that the model can produce more accurate predictions
than that of traditional artificial neural network model.
Keywords: traffic flow prediction; wavelet analysis; denoise;
multi-scale analysis; artificial neural network; genetic algorithm
I. INTRODUCTION
Traffic flow prediction is to accurately estimate traffic flow
situations during the next period with a prediction algorithm by
analyzing the traffic flow data. It is important to prerequisite in
developing the right measures for traffic control and induced
traffic, also now widely carried out for intelligent transportation
systems. There have been many ways for short-term traffic flow
prediction, like Kalman filtering method, linear regression model,
time series method, non-parameter regression model, ANN
model etc. As every method has its advantage and also limitation,
it is impossible to use only one measure to predict the traffic due
to its complexity, randomness and uncertainty, therefore it needs
to develop new measures.
This paper presents a new method of traffic flow prediction-
traffic flow prediction based on wavelet analysis, genetic
algorithm and artificial neural network. Wavelet transform has
good time-frequency analysis capability. Wavelet theory of
multi-scale analysis can describe the characteristics of the
phenomenon or process properties in different scale and the
performance of the essential characteristic of these phenomena or
process; Neural network has a strong nonlinear mapping ability,
learning and self-adaptive characteristics. Genetic algorithms can
find the global optimal solution in a complex, multi-peak, non-
linear and non-differentiable space, which make up the neural
network easy to fall into a local minimum situation.
II. MULTI-SCALE ANALYSIS
The basic ideal of multi-scale analysis is to divide the chosen
signals into different scales. The part being divided into coarse
scale is called smoothing signals and the other part is called
detailed signal. The wavelet transform is a tie to connect signals
in different scale.
The three level wavelet decomposition of signal A0 is shown
as Fig. 1, in which A is low frequency, D is high frequency, and
serial number is the level of wavelet decomposition.
It is now known from Fig.1 that, in multi-scale analysis, low
frequency can be further decomposed, and the decomposition can
be represented as, A0=A3+D1+D2+D3. For the next step, it is
decomposed to A4 and D4.

Figure 1. Three level multi-scale analysis tree
III. ELIMINATION OF TRAFFIC FLOW NOISE WITH WAVELET
ANALYSIS
Normally, there are three steps in the process of de-noising
with wavelet threshold:
Step 1, wavelet decomposition of one dimension signal. To
choose a suitable wavelet and a level, then to decompose X(k)
978-1-4244-4994-1/09/$25.00 2009 IEEE
into j levels, finally to make wavelet decomposition and
reconstruction with Mallat algorithm. The signal can be
decomposed in following formula:
( ) ( 1)
0
( ) ( 1)
1
( 2 ) , 0,
( 2 ) , 0,
j j
k n
n
j j
k n
n
x h n k x j j Z
d h n k x j j Z
+
+
=

(1)
Where,
( ) j
k
d is discrete detail coefficients,
( ) j
k
x is discrete
approximation coefficients,
0
( ) k n is low-pass filter coefficients,
1
( ) k n is high-pass filter coefficients, with
1 0
( ) ( 1) ( )
n
k n h N n

= (2)
In which N is the length of filter.
Step 2, Coefficients processing after the signal
decomposition. It uses the soft threshold function for quantitative
disposal at each level of wavelet coefficients.
The soft threshold function is chosen with,
sgn( )(| | ),| |
( , )
0 | |
h
t t
x T t
t


= =

<

(3)
Where 2log( ) t N = , x

is the wavelet coefficients after


threshold; is noise variance; N is the length of the noise
pollution of signal sequence.
Step 3, Reconstruction of one-dimensional wavelet.
Signal reconstruction algorithms is,
( 1) ( ) ( )
0 1
( 2 ) ( 2 )
j j j
n k k
n k
x h n k x h n k d
+
= +

(4)
Through the wavelet decomposition, quantitative disposal and
reconstruction can be achieved the traffic flow of eliminate noise
interference.
IV. NEURAL NETWORK BASED ON GENETIC ALGORITHMS
Genetic Algorithms (GA) is an overall probability search
algorithm imitating Darwin's natural selection of genetic
selection and the process of biological evolution. It has strong
global search capability with good adaptability, global
optimization and implicit parallelism. The brief flow chart of
neural network based on GA is shown as following six steps.
(a).To code a weight (threshold) with one type of coding
method, then to randomly produce a group of distribution, which
will be corresponding to a group of weight (threshold)of neural
network;
(b).To input training samples and calculate their error
function value to evaluate weight (threshold);
(c).To choose the individual with bigger fitness and evaluate
to the next generation;
(d).To produce the population of next generation with
crossover and mutation to the current generation;
(e).To repeats step (b) to (d), until training target being
satisfied;
(f).To gain best value through neural network training, based
on suboptimum value by Genetic Algorithms.
V. TRAFFIC FLOW PREDICTION BASED ON MULTI-SCALE
ANALYSIS AND NEURAL NETWORK OPTIMIZED BY GENETIC
ALGORITHM
After choosing a wavelet and determining the level of
decomposition (j level), it has decomposed the detection traffic
flow sequence into discrete detailed signals d1~dj and discrete
smoothing signals aj under the decomposition level j; The
wavelet de-noising mentioned above is applied to eliminate the
noise from detailed signals d1~dj, Then reconstruction of the
wavelet coefficients, high-frequency sequence D1~Dj and low-
frequency sequence Aj is obtained. Here it has constructed the
corresponding artificial neural network optimized by genetic
algorithm to estimate the sequence Aj and D1~Dj; finally, the
forecasting result is gained with the sequence of synthetic. The
traffic flow prediction model based on wavelet analysis, genetic
algorithm and artificial neural network is shown as Fig. 2.
Here it uses the on-line training neural network. The existing
data are first used for network learning, and to predict the vehicle
number in the next 10 intervals, then 10 new data are used to
train network again, and predict the vehicles in another 10
intervals. The process is repeated until all intervals are predicted.
j
a
1
d
j
d
j
A
j
D
1
D

Figure 2. Traffic flow prediction model based on multi-scale analysis and neural network optimized by genetic algorithm
VI. SIMULATION RESULTS
Here about 570 traffic flow data are used, which were
detected every 2 minutes from 5:00 to 24:00 on a road in
Chongqing. The errors and fitting are chosen with,
Mean absolute error
( ) ( )
1
| |
( )
pred real
t
real
Y t Y t
maerr
N Y t

=

(5)
Max absolute errors
( ) ( )
max | |
( )
pred real
real
Y t Y t
mxaerr
Y t

= (6)
Root-mean-square error
2
( ( ) ( ))
pred real
t
Y t Y t
rmserr
N

(7)
Fitting degree
2
2 2
( ( ) ( ))
1
( ) ( )
pred real
t
pred real
t t
Y t Y t
EC
Y t Y t


(8)
In which
real
Y is the real traffic flow data, and
pred
Y is their
prediction.
Here DB3 is chosen as wavelet, in which there are three
levels and four series. At the first decomposition, high frequency
component D1 is obtained; then at the second and third
decomposition, to get D2, D3, and A3 for the denoise and
reconstruction.
The prediction of every component is with BP Neural
Network in three levels. At input level, there are 8 vectors,
corresponding to 8 detected traffic data. At the hide layer, there
are 15 nodes, mapping to the hyperbolic tangent function tansig.
At output level, there is only one node in purelin mapping, which
is the traffic flow within one time interval. Target error of A (3)
is set as 1e-6, with maximum training number of 2000. Target
error of D (1) ~D (3) is set as 1e-5, with maximum training
number of 1000. In the parameters of Genetic Algorithm,
population size with 60crossover rate with 0.2mutation rate
with 0.05evolving algebra with 500.
300 existing data are first used for the network learning, and
to predict the vehicle number in the next 10 Intervals. Then the
existing data and 10 new data are used to train network again,
and to predict the vehicles in another 10 intervals. The process is
repeated until all 270 intervals are predicted. The predictions and
error are shown in Fig. 3.
With similar neural network structure and input, the obtained
predicting results with single neural network are shown in Fig. 4;
the predicting results with multi-scale neural networks are shown
in Fig. 5.
The comparisons of errors with three neural network
predictions are shown in table 1.
Through evaluating the three effects of the three methods
with different evaluation targets, it is known that the result with
multi-scale and neural network optimized by genetic algorithm
model is better. It can evidently decrease prediction error and
improve the forecasting veracity compared with typical neural
network.






F
l
o
w
(
v
e
h
/
2
m
i
n
)
Figure 3. Traffic flow prediction based on multi-scale analysis and neural network optimized by genetic algorithm
F
l
o
w
(
v
e
h
/
2
m
i
n
)

Figure 4. Traffic flow prediction with single neural network
F
l
o
w
(
v
e
h
/
2
m
i
n
)

Figure 5. Traffic flow prediction with multi-scale analysis and neural networks
TABLE I. THE COMPARISON OF ERRORS WITH THREE NEURAL NETWORK PREDICTIONS
measures
Mean absolute
errors (%)
Max absolute
errors (%)
Root-mean-square
error
fitting
degree
single neural network 4.6041 52.5129 6.6701 0.9737
multi-scale analysis and neural networks 0.8461 6.2835 0.8625 0.9943
multi-scale analysis and neural network
optimized by genetic algorithm
0.3986 3.1219 0.5807 0.9975
VII. CONCLUSIONS
This paper has briefly introduced a new approach for the
traffic flow prediction. The real detected traffic data are used to
test the accuracy of the model. The results show that the model of
multi-scale and neural network optimized by genetic algorithm
has advantages over the traditional neural network in
qualification-rate of prediction, and good adaptability to the
dynamic traffic flow environment. It could be an efficient method
to the prediction of the real-time dynamic traffic flow
VIII. ACKNOWLEDGEMENTS
The authors wish to acknowledge the financial support of the
Foundation of Ministry of communications of China (2008-319-
814-060) and 2008 Research Projects for Returned Experts of
Ministry of Human Resources and Social Security of China.
IX. REFERENCES
[1] Stephane G. Mallat. A Theory for Multiresolution Signal
Decomposition:The Wavelet Representation[J], IEEE Transactions on
Pattern Analysis and Machine intelligence, 1989.11(7):674~693.
[2] Maniezzo V. Genetic evolution of the topology and weigh t distribution of
neural networks [J]. IEEE Trans On Neural Networks, 1994, 5 (1) : 39253.
[3] TAN Manchun ,LI Yingjun,XU Jianmin. A Hybrid ARIMA and SVM
Model for Traffic Flow Prediction Based on Wavelet Denoising
[J],Computer Engineering and Applications,2009,26(7):127-131. (in
Chinese)
[4] MA Jun,Li Xiaodong,MENG Ying. Research of Urban Traffic Flow
Forecasting Based on Neural Network [J],Acta Electronica
Sinica,2009,37(5):1092-1093. (in Chinese)
[5] Skander Soltani ,On the use of the wavelet decomposition for time series
prediction[J] , Neurocomputing , 2002 :267277.
[6] CHANG Jianxia, YU Xingjie, HUANG Qiang.Water demand for ecasting
based on multi-scales analysis and neural network[J],Computer Engineer
ing and Applications, 2008, 44( 17) : 219- 221. (in Chinese)

You might also like