CISIM2010 HBHashemi
CISIM2010 HBHashemi
CISIM2010 HBHashemi
+
=
(1)
B. Evaluation criteria
In prediction problems general criteria like mean absolute
deviation, mean absolute percentage error, mean squared
error, and root mean squared error are calculated based on (2,
3, 4, 5). These criteria are preferred to be smaller since they
indicate the prediction error of the system.
In addition to the above criteria three other measures are
used to compare stock value prediction methods. The correct
forecast trend measure shows the percentage of correct
ssssss
_
=
nSet Validatio ys for all da
today
real
tomorrow
forecast
price price T
Set Validation
nd recast Tre Correct Fo ) , (
1
_
=
nSet Validatio ys for all da
tomorrow
real
tomorrow
forecast
price price
Set Validation
MAD
1
(2)
_
=
nSet Validatio ys for all da
tomorrow
real
tomorrow
real
tomorrow
forecast
price
price price
Set Validation
MAPE
1 (3)
( )
2 1
_
=
nSet Validatio ys for all da
tomorrow
real
tomorrow
forecast
price price
Set Validation
MSE
) 4 (
( )
2 1
_
=
nSet Validatio ys for all da
tomorrow
real
tomorrow
forecast
price price
Set Validation
RMSE
) 5 (
prediction of the changes in n+1
th
day relative to n
th
day (6).
When the prediction is completely random this number
would be around 0.5. As a result, in order to have a reliable
prediction method this feature should be at least above 0.5.
Although knowing the direction of the changes is an
important factor for decision making, we also need to know
the amount of the changes. There will be two other criteria to
determine the ratio of correct forecast trend to the real trend
of stock changes (7) and the ratio of incorrect forecast trend
to the real trend of stock changes (8). In the Ideal case, the
predicted ratio of correct forecast trend to the real stock
changes in (7) should be equal to one. In addition, if the
quantity of this ratio is smaller (or greater) than one, it will
indicate that the direction of the changes is predicted
correctly while the amount of changes has been predicted
less (or more). In the other hand, when the direction of stock
changes is predicted incorrectly, the quantity of the (8) is
desired to be closer to one as much as possible which shows
the prediction error is minimum in this case.
IV. SIMULATION RESULTS
In this section the prediction results of the two suggested
methods using multi layer Perceptron neural networks and
Elman recurrent network are compared to linear regression
method results.
The training algorithm in multi layer neural network is
Levenberg-Marquardt back propagation which can train any
neural networking using differentiable activity functions. In
this kind of error back propagation algorithm we use both the
gradient and the Jacobean of the performance measure (error
function)of the training set respect to the connection weights,
to justify the network weights [9, 11].
(6)
(7)
(8)
=
0
0 ) ).( ( 1
) , (
otherwise
price price price price if
price price T
today
real
tomorrow
real
today
real
tomorrow
forecast
today
real
tomorrow
forecast
_
=
nSet Validatio ys for all da
today
real
tomorrow
real
today
real
tomorrow
forecast
price price
price price
Set Validation al Trend
nd recast Tre Correct Fo 1
Re
_
(
(
+ =
nSet Validatio ys for all da
today
real
tomorrow
real
today
real
tomorrow
forecast
price price
price price
Set Validation al Trend
rend Forecast T Incorrect
1
1
Re
134 2010 International Conference on Computer Information Systems and Industrial Management Applications (CISIM)
Figure 2. comparing minimum abstract deviation (MAD) in Elman and
MLP.
Figure 3. comparing mean absolute percentage error (MAPE) in Elman
and MLP
On the other hand, to train Elman network, the error back
propagation with momentum and adaptive learning rate is
used. This algorithm like Levenberg-Marquardt has the
capability to train any network using differentiable activity
functions. The weights of the network in this algorithm are
adjusted according to Gradient decent (with momentum)
based on the (9) in which mc is the momentum, d
Xprev
is the
previous change in the network weights and lr is the learning
rate.
X
pref
Xprev X
d
d
mc lr d mc d . . + = (9)
In each epoch if the performance measure (Mean squared
error) is moving toward its goal value, the learning rate will
Figure 4. comparing mean squared error (MSE) in Elman and MLP.
increase (in this simulation lr_inc=1.05). On the other hand
if the performance measure increases more than a threshold
(max_perf_inc=1.04), leaning rate will decrease with the rate
of lr_dec (in this simulation lr_dec=0.7) and the related
change which has increased the performance measure, will
not be applied to the network weights.
When one of the below happens the algorithm will stop.
The training epochs reach its maximum (in this
simulation 1000 epochs).
The performance measure reaches its goal.
(MSE=10to-6)
The gradient of the performance measure gets under
a threshold. (10to-6)
In the following the results of these two methods are
going to be compared to the result of the linear regression
method. In figure 3, 4, and 5 its clearly shown that the MLP
Neural Network has less MSE, MAPE, and MSE comparing
to Elman and linear regression though this method cannot
predict the direction of the changes as well as Elman and
regression (figure 6). However the linear regression method
predicts the direction of the changes well (figure 6), the error
in the prediction of the value is much more than multilayer
Perceptron and Elman (figure 7). The Elman network can
predict the direction of the changes better than multilayer
Perceptron (figure 6) but suffers from greater error in
prediction (figure 7) .
V. CONCLUSIONS
In this paper we used neural networks model to predict
the value of stock share in the next day using the previous
data about stock market value. For this purpose two different
well known types of neural networks were applied to the
problem. The obtained results show that for predicting the
direction of changes of the values in the next day none of
these methods are better than simple linear regression model.
But the error of the prediction of the amount of value
changes using MLP neural network is less than both Elman
network and linear regression method. In addition to this,
when the feed forward MLP neural network predicts the
direction of the changes correctly, the amount of change is
Mean squared error
0
10,00
20,00
30,00
40,00
50,00
60,00
1 2 3 4 5 6 7 8 9 10
Past days (as NN input)
M
e
a
n
s
q
u
a
r
e
d
e
r
r
o
r
Mean absolute percentage
0.00
0.00
0.01
0.01
0.02
0.02
1 2 3 4 5 6 7 8 9 10
Past days (as NN input)
M
e
a
n
a
b
s
o
l
u
t
e
p
e
r
c
e
n
t
a
g
e
e
r
r
o
r
Mean abstract deviation
50
55
60
65
70
75
80
85
90
95
1 2 3 4 5 6 7 8 9 10
Past days (as NN input)
M
e
a
n
a
b
s
t
r
a
c
t
d
e
v
i
a
t
i
o
n
MLP (1 hidden layer)
Elman (1 hidden layer)
Linear regression
2010 International Conference on Computer Information Systems and Industrial Management Applications (CISIM) 135
Figure 5. Maximum number of correct change direction forecast in Elman
and MLP.
Figure 6. Ratio of correct forecast of direction change to real direction
change in Elman and MLP.
completely close to the real one in comparison to the other
two mentioned methods. In future works of this study we
are going to apply other recently proposed regression
methods such as Support Vector Regression models which is
newer in the field of machine learning researches and
claimed to have good generalization ability due to
application of large margin concept.
REFERENCES
[1] Chen An-Sing, Leung Mark, Daouk Hazem, Application of Neural
Networks to an Emerging Financial Market: Forecasting and Trading
the Taiwan Stock Index, Computers & Operations Research, vol. 30,
2003, pp. 901923.
[2] G. Armano, M. Marchesi, and A. Murru, A Hybrid Genetic-Neural
Architecture for Stock Indexes Forecasting, Information Sciences,
vol. 170, 2005, pp 3-33.
Figure 7. Ratio of incorrect forecast of direction change to real direction
change in Elman and MLP.
[3] Qing Cao, Leggio Karyl, Marc Schniederjans, A Comparison
Between Fama and Frenchs Model and Artificial Neural Networks in
Predicting the Chinese Stock Market, Computers & Operations
Research, vol. 32, 2005, pp. 2499-2512.
[4] Olson Dennis, Mossman Charles,Neural Network Forecasts of
Canadian Stock Returns Using Accounting Ratios, International
Journal of Forecasting, vol.19, 2003, pp. 453-465.
[5] C.W.J. Granger and A.P. Anderson, An Introduction to Bilinear
Time Series Models, Vandenhoeck and Ruprecht, Gottingen, 1978.
[6] G. Grudnitzky and L. Osburn, Forecasting S&P and Gold Futures
Prices: An Application of Neural Networks, Journal of Futures
Markets, vol. 13, No. 6, pp. 631-643, September 1993.
[7] Zhang Guoqiang, Patuwo Eddy, Hu Michael, Forecasting with
Artificial Neural Networks: The State of the Art, International
Journal of Forecasting, vol. 14, 1998, pp 35-62.
[8] M.J.C. Hu, Application of the Adaline System to Weather
Forecasting, Master Thesis, Technical Report 6775-1, Stanford
Electronic Laboratories, Stanford, CA, June 1964.
[9] Levenberg K., A Method for the Solution of Certain Problems in
Least Squares, Quart. Appl. Math. , no. 2, 1944, pp. 164-168.
[10] T. Kimoto, K. Asakawa, M. Yoda, and M. Takeoka, "Stock market
prediction system with modular neural network," Proceedings of the
International Joint Conference on Neural Networks, 1990, pp. 1-6.
[11] D. Marquardt, An Algorithm for Least Squares Estimation of
Nonlinear Parameters, SIAM Journal of Applied Mathematics, no.
11, 1963, pp. 431-441.
[12] H. Mizuno, M. Kosaka, H. Yajima, and N. Komoda, Application of
Neural Network to Technical Analysis of Stock Market Prediction,
Studies in Informatic and Control, vol.7, no.3, 1998, pp.111-120.
[13] H. Tong and K.S. Lim, Threshold Autoregressive, Limit Cycles and
Cyclical Data, Journal of the Royal Statistical Society Series, vol. B-
42, no. 3, 1980, pp. 245292.
[14] A.S. Weigend and N.A. Gershenfeld, Time Series Prediction:
Forecasting the Future and Understanding the Past, Addison-
Wesley, Reading, MA, 1993.
[15] P.J. Werbos, Generalization of back propagation with application to
a recurrent gas market model, Neural Networks, vol. 1, pp. 339-356,
1988.
[16] Md. Rafiul Hassan and Baikunth Nath, Stock Market Forecasting
Using Hidden Markov Model: A New Approach, 5th International
Conference on Intelligent Systems Design and Applications, 2005.
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
1 2 3 4 5 6 7 8 9 10
Past days (as NN input)
d
i
r
e
c
t
i
o
n
c
h
a
n
g
e
R
a
t
i
o
o
f
i
n
c
o
r
r
e
c
t
f
r
o
e
c
a
s
t
d
i
r
e
c
t
i
o
n
c
h
a
n
g
e
t
o
r
e
a
l
Ratio of correct forecast direction change to real direction change
0.1
1.0
10.0
100.0
1 2 3 4 5 6 7 8 9 10
Past days (as NN input)
d
i
r
e
c
t
i
o
n
c
h
a
n
g
e
R
a
t
i
o
o
f
c
o
r
r
e
c
t
f
o
r
e
c
a
s
t
d
i
r
e
c
t
i
o
n
c
h
a
n
g
e
t
o
r
e
a
l
Correct direction change
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1.0
1 2 3 4 5 6 7 8 9 10
Past days (as NN input)
C
o
r
r
e
c
t
d
i
r
e
c
t
i
o
n
c
h
a
n
g
e
f
o
r
e
c
a
s
t
Ratio of incorrect forecast direction change to real direction change
136 2010 International Conference on Computer Information Systems and Industrial Management Applications (CISIM)