Mahdiani 2017
Mahdiani 2017
A Modified Neural Network Model for Predicting the Crude Oil Price
PII: S1822-8011(16)30012-1
DOI: 10.1016/j.intele.2017.02.001
Reference: INTELE 23
Please cite this article as: Mohammad Reza Mahdiani , A Modified Neural Network Model for Predicting
the Crude Oil Price, Intellectual Economics (2017), doi: 10.1016/j.intele.2017.02.001
This is a PDF file of an unedited manuscript that has been accepted for publication. As a service
to our customers we are providing this early version of the manuscript. The manuscript will undergo
copyediting, typesetting, and review of the resulting proof before it is published in its final form. Please
note that during the production process errors may be discovered which could affect the content, and
all legal disclaimers that apply to the journal pertain.
ACCEPTED MANUSCRIPT
A Modified Neural Network Model for Predicting the Crude Oil Price
1
Faculty of Petroleum Engineering, Amirkabir University of Technology (Tehran Polytechnic), Hafez Avenue, Tehran, Iran
T
Abstract
IP
Predicting the crude oil price is very interesting and prominent for all governments and different
CR
companies. Here a neutral network model has been modified, in a way that a genetic algorithm
optimizes its parameters during its run. This model is able to predict the future price of crude oil
US
very accurately. Comparing the model of this study with the pure neural network in predicting
both daily and monthly crude oil prices confirmed its greater performance, especially in situation
AN
of small number of input data for training or the great changes of variables.
M
1. Introduction
Predicting the crude oil price is very important in different economic, political and industrial
PT
areas, both for crude oil importer and exporter countries. Oil prices can shock the market and
Finding a model for predicting different economic and engineering parameters is a very common
AC
method and this is not an exception in oil price prediction 3, 4, 5. There are various works that have
attempted to predict the oil price. The most important of them will be reviewed here. In 2007,
Chen3 compared the oil price with oil exchange rates to find a relationship between them for
*
Corresponding Author: [email protected]
ACCEPTED MANUSCRIPT
forecasting oil prices. In 2008, Fan4 created a generalized pattern matching, based on the genetic
algorithm model. His model predicted the crude oil price based on the historical similarities of
points. In 2009, Ghaffari5 used some soft computing methods to predict the western Texas oil
price. He considered daily base data points in his study. In 2012, Jammazi6 used the wavelet
principal hybrid with neural network to predict the oil price. In 2013, Shin7 used a machine
T
learning method called semi-supervised learning (SSL) to predict the monthly oil price changes.
IP
His data belonged to the points up to 2008. In addition, in this year, Xiong8 used a multistep
CR
ahead forecasting in price prediction and claimed that his method’s computational load is low. In
2014, Yu9 combined compressed sensing based denoising (CSD) and artificial intelligence
US
methods to forecast oil prices. He claimed that his method was robust and effective. In this year,
AN
Godarzi10 used regression in the neural network to analyze the pattern of oil price changes.
As reviewed, there are different models for predicting oil prices. In most of them, the future price
M
is estimated using previous points (but how many points?). Here an artificial neural network
(ANN) is combined with the genetic algorithm (GA) to predict the future oil price. The details of
ED
2. Methods
AC
First of all a strong data bank is needed for building the model. These data were gained from the
WIT database. The data included the 219 points of daily oil prices from the beginning of 2014
11
until now (end of October of 2014). 95 points of monthly price begin from 2007 till now.
These data are shown in Figs. 1 and 2. As these figures show, the oil price change on a monthly
basis is much higher than a daily basis (it is natural); hence the model will have more problems
ACCEPTED MANUSCRIPT
in monthly forecasting. Here, our goal is to use the data of these figures to forecast the oil price
in the next time series. The artificial neural network is a powerful tool for predicting the future
oil price based on past prices. Here, in ANN the output is the oil price and the input is some data
points preceding the output point. But how many points should be considered? If the number of
points is very small the model cannot predict it well because of not having sufficient data and if
T
the number of points is very large maybe some prices caused by some previous phenomena
IP
(which are no longer available) affected the prediction. Thus, here ANN is coupled with GA and
CR
thus GA optimizes the number of backward points and hidden layers. The properties of ANN and
GA are listed in Table I and Table II, respectively. In Table 1, ‘Levenberg-Marquart’ is the name
US
of a method; for more information see12. In Table II, the different listed properties are not
AN
complicated and there is no need to know them for this study. The interested reader can refer to
13
. GA optimizes the number of backwards points and hidden layers and ANN predicts the future
M
prices; whereas GA tries to reduce the error of its prediction. In this study, GA is changed, not to
just save the inputs but also to save the created network. Training is an important part in creating
ED
the model. For this purpose, the data are divided into two parts. One part is used for training the
model and another one for testing it. For daily prediction 22 points and for monthly prediction 10
PT
points are put aside for testing and the remaining are used for training. After running the model,
CE
GA concluded that 3 backward points and 14 hidden layers are suitable for accurate prediction.
The GA of this study was changed in a way to prefer the lowest hidden layer when the accuracy
AC
is similar. It is concluded that for the hidden layer of more than 14, there is no accuracy
improvement and thus 14 hidden layers are selected. Table 3 shows the statistical properties of
the model. This table shows that both daily and monthly prediction were well. Just the maximum
error of monthly oil prediction was slightly higher which was due to the small number of inputs,
ACCEPTED MANUSCRIPT
but even in this case the amount of median relative error was small. The higher amount of mean
relative error was because of having a point with high error. The convergence of the genetic
algorithm is shown in Fig. 3. As this figure shows in both cases of daily and monthly prediction,
the number of iterations is small and thus the method is fast. From now on we call the new
method ANN-GA.
T
IP
AFTER CREATING THE MODEL IT WAS TESTED BY SOME DATA POINTS WHICH WERE NOT USED IN
CR
BUILDING THE MODEL. FIG. 4 SHOWS THE CROSS PLOT OF ESTIMATED PRICE VERSUS REAL ONE FOR
TEST AND TRAIN DATA POINTS IN BOTH MONTHLY AND DAILY PREDICTION. THIS FIGURE SHOWS
US
THAT THE DATA POINTS ARE WELL FITTED AND MEAN SQUARE ERROR IN BOTH DAILY AND
3. Results
M
Here, to see the performance of the GA-ANN model, it is compared with the pure ANN model.
ED
In ANN, 10 hidden layers are proposed and two backward points will participate in forecasting
14
the new point. These values are considered as default in many references . After running the
PT
ANN, the following results are gained (Table 4). In next section the applicability of this method
4. Discussion
AC
Now, ANN will be compared with ANN-GA. Based on Table IV, maximum relative error of
ANN in daily prediction is slightly higher than ANN-GA, but in monthly prediction it is much
higher. This means that ANN cannot predict well when the data base is small or variables change
aggressively, but ANN-GA predicts much better. Also, the mean (average) relative error and
ACCEPTED MANUSCRIPT
median relative error in monthly prediction by ANN is much greater than ANN-GA prediction.
The regression plot of ANN is shown in Fig. 5. Comparing this figure with Fig. 4 shows that the
points of ANN-GA have fitted much better than ANN. The test data in ANN had an r smaller
than 0.9 which has not occurred in any cases of ANN-GA. Another point of this figure is that in
training, the points have fitted well but their prediction was poor thus having a good ANN model
T
but available data does not ensure the good prediction in other points. This is while ANN-GA
IP
does not suffer from this problem.
CR
Now is the time to compare the method of this paper with the pure neural network. Fig. 6
US
compares these two with the actual price of crude oil. In this figure, the oil price is predicted
from the seventh of October until the end of this month using previous data points. As this figure
AN
shows, ANN-GA is much stronger than ANN in predicting the crude oil price. Fig. 7 compares
these for monthly prediction. This figure shows that similar to Fig. 6, ANN forecasting is poor in
M
1. Optimizing the neural network (ANN) with the genetic algorithm (GA) greatly
2. When the changes in variables are small ANN works well, but as the changes
increase or the number of data points for training the model decrease, the efficiency
AC
3. For predicting the oil price considering that the three previous points are sufficient,
the created model will forecast well.
ACCEPTED MANUSCRIPT
T
References
IP
1. D.C. Filis and G. Broadstock, Oil price shocks and stock market returns: New evidence from
CR
the United States and China. Journal of International Financial Markets, Institutions and
US
2. W. Hamma, A. J. A. G., Effect of Oil Price Volatility on Tunisian Stock Market at Sector-
AN
level and Effectiveness of Hedging Strategy. Procedia Economics and Finance 13, 109–127
(2014).
M
3. Mahdiani, M. R. & Kooti, G., The Most Accurate Heuristic-Based Algorithms for Estimating
ED
4. Mahdiani, M. R. & Khamehchi, E., A New Method for Building Proxy Models Using
PT
5. Mahdiani, M. R., Khamehchi, E., Soltan Mohammadi, R. & Azkayi, B., A New Proxy Model,
Based On Meta heuristic Algorithms For Estimating Gas Compressor Torque, presented at
AC
6. S. Chen and H. Chen, Oil prices and real exchange rates. Energy Economics, 390–404
(2007).
ACCEPTED MANUSCRIPT
7. Y. Fan, Q. Liang and Wei, A generalized pattern matching approach for multi-step prediction
8. Ghaffari, A. Z. a. S., A novel algorithm for prediction of crude oil price variation based on
T
9. R. Aloui and C. Jammazi, Crude oil price forecasting: Experimental evidence from wavelet
IP
decomposition and neural network modeling. Energy Economics 34, 828–841 (2012).
CR
10. H. Shin, T. Hou, K. Park, C. Park, S. Choi, Prediction of movement direction in crude oil
US
prices based on semi-supervised learning. Decision Support Systems 55, 348–358.
AN
11. Y. Tao Xiong, Y. Boa,Z. Hu, Beyond one-step-ahead forecasting: Evaluation of alternative
multi-step-ahead forecasting models for crude oil prices. Energy Economics 40, 405–415
M
(2013).
ED
12. L. Yu, Y. Zhao, L. Tang, A compressed sensing based AI learning paradigm for crude oil
oil.aspx?timeframe=7d (2014).
15. A. Abd-El-Hafiz and Adly, Utilizing neural networks in magnetic media modeling and field
Book, 1998).
T
3414–3428 (2014).
IP
CR
US
AN
M
ED
PT
CE
Table 1. The artificial neural network parameters of the model of this study
AC
Parameter Value
Training Levenberg-Marquart
T
IP
CR
US
AN
M
ED
PT
CE
AC
ACCEPTED MANUSCRIPT
Population Size 20
T
Fitness Scaling Rank
IP
Selection Function Stochastic uniform
CR
Elite Count 4
Crossover Function
Crossover Fraction
US Scattered
0.8
AN
Mutation function Uniform
M
Migration Forward
ED
Table 3. The statistic properties of the model of this paper (max, mean and median are relative errors (%)
T
Daily Test 22 4.61 0.81 0.69 0.98
IP
Train 85 17.15 3.25 1.32 0.97
CR
Monthly Test 10 4.86 1.84 1.55 0.99
US
AN
M
ED
PT
CE
AC
ACCEPTED MANUSCRIPT
Table 4 The statistic properties of ANN (relative errors (%) and mean square error)
T
Train 85 22.65 5.39 5.05 9.7
IP
Monthly Test 10 13.84 6.8 6.58 0.86
CR
US
AN
M
ED
PT
CE
AC
AC
Crude Oil Price (US$/bbl)
CE
20
40
60
80
0
100
120
20
40
60
80
0
100
120
140
160
CE
Dec 01, 2006
Apr 01, 2007
Aug 01, 2007
Dec 01, 2007
PT
Apr 01, 2008
Aug 01, 2008
Dec 01, 2008
ED
Apr 01, 2009
Aug 01, 2009
M Dec 01, 2009
Apr 01, 2010
Aug 01, 2010
Dec 01, 2010
Apr 01, 2011
Aug 01, 2011
AN
Dec 01, 2011
Apr 01, 2012
Aug 01, 2012
Dec 01, 2012
ACCEPTED MANUSCRIPT
IP
T
ACCEPTED MANUSCRIPT
6 Daily 7 Monthly
Oil Price (US$/bbl)
T
1 1
IP
0
0
1 3 5 7 9 11 13 15 17
1 3 5 7 9 11 13 15 17 19 21 23
Iteration
Iteration
CR
(a)
US (b)
Figure 3 Convergence of the genetic algorithm for tuninng the neural network; a:for daily b: for monthly
AN
M
ED
PT
CE
AC
ACCEPTED MANUSCRIPT
Estimated
96
Estimated
95 95
T
90 94
93
85
IP
92
85 90 95 100 105 92 94 96 98
CR
Exact Exact
(a) (b)
140
Monthly Train: R=0.96868
US Monthly test: R=0.99039
AN
90
120
Estimated
Estimated
100 80
M
80
70
60
ED
60
60 80 100 120 140 60 70 80 90
Exact Exact
PT
(c) (d)
Estimated
100 80
75
80
70
60 65
T
60
60 80 100 120 140
60 70 80 90
IP
Exact Exact
(a) (b)
CR
Daily Train: R=0.96648 Daily Test: R=0.85699
98
105
100
US 97
96
Estimated
Estimated
95
95
AN
90
94
85
93
80
92
M
80 90 100 92 94 96 98
Exact Exact
ED
(c) (d)
100
T
20
10
IP
0
CR
Exact ANN-GA ANN
US
Figure 6 Daily prediction of different methods
AN
M
ED
PT
CE
AC
ACCEPTED MANUSCRIPT
120
100
Oil Price (US$/bbl)
80
60
40
T
20
IP
0
CR
Exact ANN-GA ANN
US
Figure 7 Monthly prediction of different methods
AN
M
ED
PT
CE
AC
19