You are on page 1of 6

Prediction Of Time Series Data Using GA-BPNN

based Hybrid ANN Model


Aishwarya D C C.Narendra Babu
Dept. of Computer Science and Engineering Dept. of Computer Science and Engineering
M S Ramaiah University of Applied Sciences M S Ramaiah University of Applied Sciences
Bangalore, India Bangalore, India
Email: aicu93@gmail.com Email: narendrababu.c@gmail.com

Abstract—Time series analysis has drawn the attention of many applications, the performance of the model and the prediction
researchers as the findings from analysis are of huge importance accuracy would not be as good as using a hybrid model.
and value. Although there exists many models for Time Series In this paper, ANN based hybrid GA-BPNN model for data
Prediction, there is still no single model which can accurately prediction is proposed and the model is evaluated and tested
predict data, this is because of the wide range of existing
on four data sets consisting of both time series and
applications. Artificial Neural Networks are widely used for
forecasting data because of its high capability to understand non multivariate data where ANN is trained with backpropagation
linear relationships among data. An appropriate combination of algorithm LM, which is optimized by GA. The same model is
neural algorithms can provide better prediction results for time used for testing the performance of the network with varying
series data. This paper aimed at hybridizing the traditional Back size of training set and varying prediction horizons.
Propagation Neural Network (BPNN) with Genetic The later part of the paper is organized as follows. Section II
Algorithm(GA) to achieve better prediction accuracy. Levenberg discusses the existing models in the literature. In Section III
Marquardt Algorithm(LMA) is chosen as the Back Propagation the existing Back Propagation Neural Networks and the
algorithm. The proposed model is tested on L&T stock market Genetic Algorithm is explained. Section IV discusses the
data, Air Quality data, Surface roughness and Concrete Strength proposed model and deals with its implementation. The four
data and the performance measures of both BPNN and GA- data sets mentioned in Section I are implemented and the
BPNN are evaluated using the standard error measures such as results are analyzed in Section V. The paper is concluded in
Mean Squared Error(MSE), Mean Absolute Error(MAE) and Section VI.
Root Mean Square Error(RMSE). The proposed model proves to
produce better prediction results than the existing BPNN II. RELATED WORK
networks for both univariate and multivariate data sets.
There are many Time Series Data Prediction methods. The
Keywords—ANN,Back Propagation Neural Network; Genetic literature addresses few of them. In [1], the traditional ARIMA
Algorithm; GA-BPNN; MSE; MAE; RMSE models were used for prediction of global temperature .The
prediction capability of the three linear models, Basic
I. INTRODUCTION ARIMA, Trend based ARIMA and wavelet based ARIMA
Time Series Forecasting has always been one of the major were compared and Trend based ARIMA proved to be more
research areas where new challenges arise and the scope of efficient. A hybrid of ARIMA model, ARIMA-GARCH was
improvements of techniques is high. Although there exists presented in [2].The model was tested for forecasting Indian
many models for time series prediction, there is no single Stock and the hybrid model’s performance was better than the
unique model which can predict accurately, this is due to the ARIMA model. In [3] the traditional ARIMA model was
diversity in the application. Instead of relying on a single compared with neural networks for commodity price
model, hybrid of one or more models would provide forecasting and it was proved that neural networks perform
satisfactory results [2]. However, developing a simple yet better. A hybrid ARIMA model based on ANN for forecasting
efficient hybrid algorithm for this purpose is a challenge. different time series data is presented in [4]. The different
One efficient nonlinear technique for time series forecasting is architectures of ANN, the feed forward network and the
ANN. Due to the facts that they do not assume linearity and cascade network were considered in [5] for predicting the
their capability to fit any non linear function makes them the number of guests in a month. The feed forward networks
widely used algorithm Also due to the adaptive nature of outperformed cascade networks with high accuracy prediction.
ANN, ANN models have become more popular in forecasting A new approach called Multiplicative Neuron Model was used
[4]. For various applications, the nature of data would be in [6] for non linear time series forecasting. For training this
different. The prediction capability of the model changes with model Particle Swarm Optimization (PSO) was made use of.
the prediction horizon. If a single model is considered for such In [7] ,Genetic Algorithm based ANN model was used for
voltage stability monitoring. ANN was used for classification transfer function. The transfer function can be linear, sigmoid
of transformer’s no load losses.ANN proves to perform better or tangential based on the application. The output is a linear
even in classification problems with 78% to 96% efficient in function. The ANN model can be trained using different
the cases considered in [8]. Neural Network Time Series algorithms. One of the simplest algorithm is the LM
Models were used to analyze the performance of Indian Stock algorithm.
markets. The ANN model used could fit any stock market data
[9]. The concepts of Genetic Algorithm, when and where to
use genetic algorithms are clearly described in [10]. The
optimization efficiency of Genetic Algorithms is explained in
[11]. It discusses the factors affecting the performance of
Genetic Algorithms and the suitable values for population,
crossover and mutation rates. A hybrid ANFIS model was
used for prediction of stock prices in [12]. The proposed
model was compared with various other existing models and
the proposed hybrid model proved to be more efficient.
Forecasting speed of wind was discussed in [13] where
wavelet based ANN was used and the model used criss cross
optimization algorithm for training. In [11] stock forecasting
was done using fuzzy time series model combined with
genetic algorithm. The model was tested on TAIEX closing
prices over the period from 1990 to 1999.The proposed hybrid
model could provide better prediction results. The BPNN
algorithms like LM, gradient descent, Bayesian regularization Figure 1. Architecture of ANN [23]
was compared for surface roughness prediction in [13]. The LM Algorithm:
results were also compared against Radial Basis function. In
[14] Minimum Miscibility Pressure was predicted using a LMA are used to solve non linear least squares problems. The
hybrid Genetic Algorithm based Back Propagation Neural LMA finds a local minimum for a given problem. It blends the
Networks. For the prediction of kWh output from a grid- GN algorithm and the GD algorithm. Because of the use of
connected photovoltaic system, ANN based PSO was used second derivatives of the cost function, LM algorithm is
[19]. Ambient Temperature, solar irradiance, and temperature robust than the GN algorithm which can converge faster and
of the module were taken as the inputs and kWh energy from results in good solutions. The converging speed of LM
the photovoltaic system was considered as the output. The algorithm is slower than Gauss Newton but faster than the
study also aimed at investigating the learning capability of steepest descent method. If the problem is quite small, this
PSO algorithm and the effect of population size. Traffic flow algorithm can be made use of.
was analyzed using different hybrid ANN models [20] like The algorithm is described using the following equations:
ARIMA model hybridized with ANN, hybrid ANN based 𝑒 = 𝑥 − 𝐹(∅. 𝑦) (1)
fuzzy model, Genetic Algorithm based ANN model, Chaos 1
ANN model, model based on wavelet analysis, Principal 𝐽= 𝑒2 (2)
2
Component Analysis ANN model and PSO based ANN
∆∅ = −(∇2 𝐽(∅))−1 ∇𝐽(∅) (3)
model. The same application in [19] was attempted using Bat
Eq. (1) represents the error of the obtained output, x is the
algorithm based ANN model [21]. A hybrid genetic algorithm
expected output, y is the system output, F is the fuzzy system
was used for parameter extraction in MOSFET’s. In order to function
obtain a minimal solution, Genetic Algorithm was made use of n, Ø is the general parameter of fuzzy system. Eq. (2)
[22].
represents the cost function. By calculating the value of Eq.
III. ARTIFICIAL NEURAL NETWORK AND GENETIC ALGORITHM (3), the cost function is minimized. [14]
Genetic Algorithm:
Artificial Neural Network:
Genetic algorithms are inspired by biological computations.
ANN is a non linear model which can be used for a wide range They are search algorithms inspired by genetics and selection.
of applications. The functional aspects of ANN are very
It can also be defined as the algorithm which works on
similar to the neurons in the human brain. The architecture
resembles the human brain with interconnected neurons that Darwin’s principle of “Survival of the fittest”. They consist of
process information. From Figure.1, it can be seen that the binary bit strings called population. Population is nothing but
general architecture of ANN comprises of a hidden layer along the number of input data. Population should not be confused
with input and output layers. The number of input nad hidden with the number of parameters in the data. The relationship
layers vary with the application. Raw data which can be non between the binary strings consisting of zeros and ones is
linear is fed as input to the network, the hidden layer computes found using an evaluation function which returns a fitness
the weights of the input using an activation function or the value for that particular string. The three main operations
performed are Selection, Crossover and Mutation.
Selection is a process of selecting chromosomes with good number of neurons in each hidden layer and the appropriate
fitness value and forming a new population. Higher the fitness activation function is chosen. Initially, the values for weights
value, higher the probability of getting selected for the next and biases are taken at random. The network is fed with the
generation. There are various strategies for selecting, these training set and its corresponding outputs. GA calculates the
include roulette wheel selection, tournament selection, fitness of each input. In the process of selection, the inputs
selection based on ranking etc. with high fitness values are selected and they are used in
Once the better chromosomes are selected, the population will further generations to get the best fit results. In the Crossover
be rich with good population. A crossover operator is used to phase, the input bits are recombined resulting in a new
population. During the mutation phase, the position of the bits
create a new string by recombining the bits of the
are randomly changed. The fitness is calculated after each of
chromosomes. The main difference between selection and
these process and iterated until the best fitness value is
crossover is that new strings are not created in selection obtained. The best fit value are the new values of the weights
process whereas crossover operation creates new strings. A and biases. The important parameters that has to be considered
crossover probability is given which usually varies in the while using Genetic Algorithm are, Population Size, Number
range of 0.3 to 0.9 of Generations, Crossover rate and Mutation rate. In the
Mutation randomly changes the value at one or more positions model, Population Size of 40 is considered with 100
of the selected chromosomes. The mutation rates vary between generations. The crossover and mutation rates are varied
0.1 to 0.09. After mutation, one generation is complete and the between 0.3 to 0.7.
same procedure begins again by evaluating the fitness function
of the population. As discussed in Section III, in order to back propagate the
network values, LM algorithm is made use of. While training
IV. PROPOSED MODEL through BPNN network, the number of nodes, number of
hidden layers, the activation function in the hidden layers,
learning rate, number of epochs, momentum term etc need to
Create the required neural network and initialize with random
be considered. The BPNN network is designed with 2 hidden
weights and bias values layers and the first hidden layer consists of 6 neurons where as
the second hidden layer consists of a single neuron. Both the
hidden layers use Tangential Sigmoid activation function. The
maximum number of epochs is limited to 15000, the
Provide inputs and outputs of the training set to the network momentum term is kept at 0.005 with a step increment of 10.
and calculate fitness of each input The learning rate has been chosen as 0.15.
With the new values of weights and biases, the network is
trained using LM. The training goes on until the minimum
Selection, Crossover and Mutation
value of MSE is reached or when any of the other parameter
conditions are met, say for example if the value of momentum
maximum is reached, the training stops resulting in the best
no
Best Fitness possible solution.
Obtained?
V. RESULTS AND DISCUSSION
Four Data Sets were used for testing the performance of both
Train the network with new values using BPNN BPNN and hybrid model. Two time series data and two
multivariate data sets are considered.Table.2 tabulates the
performance results of all the data sets.Table 1 tabulates the
no
results when the size of the training sets and the size of the
MSE<=
MSE min prediction horizons were changed in the time series data sets,
L&T Stock market data and humidity data.
Data Set 1.[ L&T Stock Market Data] :
Obtain the best solution The data is taken from [18] where the turnover rates for L&T
Stock for each day was observed for a period of 240 days. The
Figure 2. Flow chart of Proposed Hybrid Model
data is divided into training set and testing set where 200
instances are chosen for training and 40 instances are chosen
As discussed in Section I, the proposed model combines GA for testing. The hybrid model performs better which is
and BPNN models. Genetic Algorithm is used to optimize the observed in Table.2 .Also the effect of the size of the training
parameters before the network is trained using BPNN. The set and the effect of change in the prediction horizons were
optimized values of weights and biases are used by the BPNN observed and is tabulated in Table.1.
to train the network and simulate results.
Figure 2 represents the flow chart of hybrid model. A neural
network with required number of hidden layers, required
3 Actual Data Prediction Results Using BPNN and GA-BPNN
x10 45 90
Actual Data Actual data
40 80 BPNN output
GA-BPNN output

humidity values
35 70
turnover rates

30 60

25 50

20 40

15 30

10 20
0 5 10 15 20 25 30 35 40 0 20 40 60 80 100
time time
Figure 3. Actual Data representing turnover rates for 40 days. Figure 6. Predicted data using BPNN and GA-BPNN

Prediction Results Using BPNN and GA-BPNN


The results along with its performance measures are tabulated
3
x10 45 in Table.2
Actual data
40 BPNN output
GA-BPNN output Multivariate Data Set 1.[Surface Roughness Data] :
35
turnover rates

Actual Data
4.5
30
Actual Data

25 4
surface roughness
20
3.5
15
3
10
0 5 10 15 20 25 30 35 40
time 2.5
Figure 4. Predicted data using BPNN and GA-BPNN
2
Figure.3 and 4 represents the raw data and the predicted 0 2 4 6 8 10
sample number
results using BPNN and GA-BPNN models respectively.
From Table.2 it can be seen that the proposed model predicts Figure 7. Actual data for surface roughness of 10 samples
better than the existing BPNN model.
Prediction Results Using BPNN and GA-BPNN
Data Set 2.[ Air Quality Data] : 4.5
Actual data
Actual Data
BPNN output
90 4
surface roughness

GA-BPNN output
Actual Data
80
3.5
70
humidity values

60 3

50
2.5
40
2
30 0 2 4 6 8 10
sample number
20
0 20 40 60 80 100
Figure 8. Predicted data using BPNN and GA-BPNN
time
Figure 5. Actual Data representing humidity in air for 100 days. The data is obtained from [14]. Figure.7 and 8 represents the
The data is taken from the UCI repository [17]. Humidity for actual data and predicted data for surface roughness using
each day was observed for a period of 300 days. Samples of BPNN and the hybrid model. The data set consists of 31
200 days were taken for training and the humidity for the samples where 21 samples are trained and 10 samples are
remaining 100 days were predicted. Figure.5 and 6 represents predicted. Each input consists of four parameters and surface
the prediction horizon and the prediction results using BPNN roughness is predicted. As observed in the previous cases, the
and GA-BPNN models. Although GA-BPNN model does not proposed model predicts better even for multivariate data.
fit exactly, it still proves to predict better than BPNN even Results are tabulated in Table.2
when the variance is quite large.
Multivariate Data Set 2.[Concrete Strength Data] : Table 2 Comparison of Performance Measures

Strength of Concrete was predicted using BPNN and GA-


BPNN models. The input consists of 13 parameters [16]. 15 Dataset Model MSE MAE RMSE
samples were considered out of which 12 were used for
training and 3 were used for testing. As observed in the
previous cases, the proposed GA-BPNN model could fit better BPNN
L&T Stock 13.806 3.1932 3.7157
than the BPNN model. The model can also be tested on a large Market Data
GA-BPNN
data set. Figure. 9 and 10 represents the actual data and the 6.2454 2.2554 2.4992
predicted results. The results are tabulated in Table 2 from BPNN
where it can be observed that the proposed model performs 69.7278 7.2597 8.3503
Humidity Data
better. GA-BPNN
63.1461 6.9426 7.9465
Actual Data Surface BPNN
40 0.0785 0.2055 2.8023
Roughness
Actual Data Data GA-BPNN
38 0.0417 0.1928 2.0427
36 BPNN
Concrete strength

Concrete 12.1604 3.2685 3.4872


34 Strength Data
GA-BPNN
8.4934 2.6664 2.9006
32

30
From Table 2 it can be observed that the proposed hybrid
model has better prediction results compared to BPNN
28 networks. One of the factor which affects prediction is the
26 prediction horizon observed in Table 1. Higher the prediction
1 1.5 2 2.5 3 horizon, lesser is the performance. Prediction accuracy also
sample number
depends on the size of the training set which is also evident
Figure 9. Actual data for Concrete Strength of 3 samples form Table 1. It is always recommended to have a large
Prediction Results Using BPNN and GA-BPNN training set when data is available.
40
actual data
38 BPNN output VI. CONCLUSION
Concrete strength

GA-BPNN output
36
Genetic Algorithm is very efficient in optimizing parameters,
34 ANN is a widely accepted model for Time Series Prediction.
Combination of these two models helps in gaining the
32
advantages of both the models. As in paper [9], the use of
30 Genetic Algorithm with neural networks results in identifying
28
and selecting the learning rule and parameters that controls
neural network learning, selecting features or transforming the
26 feature space used by a neural net classifier.
1 1.5 2 2.5 3
sample number This paper proposed a hybrid GA-BPNN model for prediction
of four data sets namely L&T stock market data, Air Quality
data, Surface Roughness data and Concrete Strength data. In
Figure 10. Predicted data using BPNN and GA-BPNN all of the four cases, irrespective of univariate and multivariate
data, the proposed model performed better. The factors such as
prediction horizon and the size of training set data were varied
Table 1 Performance measures with varying training and and the results were measured using MSE, MAPE and RMSE.
testing samples There is a significant improvement in the performance of the
hybrid model. Given the above four cases, the proposed model
fits better than the BPNN model.
MSE for MSE for Although the proposed model has better performance, the time
No of Training
Dataset 50 100
Samples taken for convergence varies with the population size and the
samples samples
number of generations. The random selection process that
L&T Stock occurs during mutation is still not clear. In this paper the
100 71.9082 88.2153 performance of GA with neural networks is measured. There
Market Data
is scope for further combinations. Instead of neural networks,
34.2352 44.8170 Support Vector Machines can be made use of, the
Humidity Data 200
optimization algorithm can also vary say for example PSO can
be used as the optimization algorithm.
Computer Application and System Modeling (ICCASM 2010). Vol. 1.
References IEEE, 2010.
[21] Ramawan, Mohd Kamil, et al. "A hybrid bat Algorithm Artificial Neural
Network for grid-connected photovoltaic system output
[1] Babu, C. Narendra, and B. Eswara Reddy. "Predictive data mining on prediction." Power Engineering and Optimization Conference
average global temperature using variants of ARIMA (PEOCO), 2014 IEEE 8th International. IEEE, 2014.
models." Advances in Engineering, Science and Management [22] Antoun, G., et al. "A hybrid genetic algorithm for MOSFET parameter
(ICAESM), 2012 International Conference on. IEEE, 2012. extraction." Electrical and Computer Engineering, 2003. IEEE CCECE
[2] Babu, C. Narendra, and B. Eswara Reddy. "Selected Indian stock 2003. Canadian Conference on. Vol. 2. IEEE, 2003.
predictions using a hybrid ARIMA-GARCH model."dvances in [23] "Images Of Artificial Neural Network - Google Search". Google.co.in.
Electronics, Computers and Communications (ICAECC), 2014 N.p., 2016. Web. 29 July 2016.
International Conference on. IEEE, 2014.
[3] Kohzadi, Nowrouz, et al. "A comparison of artificial neural network and
time series models for forecasting commodity
prices." Neurocomputing 10.2 (1996): 169-181.R. Nicole, “Title of
paper with only first word capitalized,” J. Name Stand. Abbrev., in
press.
[4] Babu, C. Narendra, and B. Eswara Reddy. "A moving-average filter
based hybrid ARIMA–ANN model for forecasting time series
data." Applied Soft Computing 23 (2014): 27-38.
[5] Teixeira, João Paulo, and Paula Odete Fernandes. "Tourism time series
forecast-different ANN architectures with time index input." Procedia
Technology 5 (2012): 445-454.
[6] Egrioglu, Erol, et al. "Recurrent multiplicative neuron model artificial
neural network for non-linear time series forecasting." Neural
Processing Letters41.2 (2015): 249-258.
[7] Sajan, K. S., Barjeev Tyagi, and Vishal Kumar. "Genetic algorithm
based artificial neural network model for voltage stability
monitoring." Power Systems Conference (NPSC), 2014 Eighteenth
National. IEEE, 2014.
[8] Kumar, D. Ashok, and S. Murugan. "Performance analysis of Indian
stock market index using neural network time series model." Pattern
Recognition, Informatics and Mobile Engineering (PRIME), 2013
International Conference on. IEEE, 2013.
[9] Man, Kim-Fung, Kit-Sang Tang, and Sam Kwong. "Genetic algorithms:
concepts and applications." IEEE transactions on Industrial
Electronics 43.5 (1996): 519-534.
[10] Liu, Sheng, et al. "Research on optimization efficiency of Genetic
Algorithms." Systems and Control in Aerospace and Astronautics, 2008.
ISSCAA 2008. 2nd International Symposium on. IEEE, 2008.
[11] Wei, Liang-Ying. "A hybrid ANFIS model based on empirical mode
decomposition for stock time series forecasting." Applied Soft
Computing 42 (2016): 368-376.
[12] Meng, Anbo, et al. "Wind speed forecasting based on wavelet packet
decomposition and artificial neural networks trained by crisscross
optimization algorithm." Energy Conversion and Management 114
(2016): 75-88.
[13] Cai, QiSen, et al. "A novel stock forecasting model based on fuzzy time
series and genetic algorithm." Procedia Computer Science 18 (2013):
1155-1162.
[14] Markopoulos, Angelos P., Sotirios Georgiopoulos, and Dimitrios E.
Manolakos. "On the use of back propagation and radial basis function
neural networks in surface roughness prediction." Journal of Industrial
Engineering International (2016): 1-12.
[15] M. Young, The Technical Writer’s Handbook. Mill Valley, CA:
University Science, 1989
[16] Juncai, Xu, Ren Qingwen, and Shen Zhenzhong. "Prediction of the
strength of concrete radiation shielding based on LS-SVM." Annals of
Nuclear Energy85 (2015): 296-300.
[17] "UCI Machine Learning Repository: Air Quality Data Set".
Archive.ics.uci.edu. N.p., 2016. Web. 21 Apr. 2016.
[18] "NSE - National Stock Exchange Of India Ltd.". Nseindia.com. N.p.,
2016. Web. 21 May 2016.
[19] Hussain, Thaqifah Nafisah, et al. "A hybrid artificial neural network for
grid-connected photovoltaic system output prediction." Computers &
Informatics (ISCI), 2013 IEEE Symposium on. IEEE, 2013.
[20] Zhang, L. D., Lei Jia, and W. X. Zhu. "Overview of traffic flow hybrid
ANN forecasting algorithm study." 2010 International Conference on

You might also like