Professional Documents
Culture Documents
Inputlayer
hidden layer output layer
x
1
x
2
x
n
y
1
w
ij
v
j
1
r
175
utilizes not only first derivative information of objective
function, also second derivative. LM
Levenberg-Marquardt is one of them. The detailed
algorithm is as following.
( 1) ( ) ( ) ( )
( 1) ( ) ( ) ( )
( ) min ( ( ))
( )
k k k k
k k k k
f X f X S X
X X S X
+
+
= +
= +
In the formula,
( ) k
X
represents vector which is
composed by all of weight value and threshold of the
network.
( )
( )
k
S X
is the direction of search of vector
which is composed by component vector of X.
( ) k
is
the step length in the direction of
( )
( )
k
S X
which
makes
( 1)
( )
k
f X
+
minimum. Consequently, seeking
control of network can be carried in the following two
steps: firstly determine the best current direction of
searching; secondly, search the best iterative step length
based on step one.
Formula of weight value of calibration of LM:
1
( 1) ( ) ( )
T T
ij ij
w t w t J J I J e
+ = +
.
( 1)
ij
w t +
is the weight value of t+1 times iterative.
( )
ij
w t
is the weight value of t times iterative.
J
is the
Jacobian matrix of error on weight value differential
calculus.
is extremely small,
the formula becomes Gauss-Newton method. I is unit
matrix. And e is error vector.
Gradient decrease method descends greatly at the first
steps. When it approaches the best value, the gradient is
coming to zero, which can slow down the objective
function. Newton principle could generate an ideal
direction of searching when formula reaches the best
value. Levenberg-Marquart algorithm is actually a
combination of gradient decrease method and Newton
principle. Its advantage lies in the fast convergent speed
when the number of network weight value is relative
small.
E. Steps of BP algorithm BP
Based on the standard algorithm of BP, this method
uses LM algorithm to modify weight value and threshold
ranging from input layer to hidden layer and hidden layer
to output layer [See Fig.2].
III. SIMULATION EXPERIMENT
Use Matlab language in PC
Pentium4/CPU3.0GHz/RAM1.0G to program to realize
the BP algorithm mentioned in the previous section. In
order to guarantee the efficiency, we need to compare the
prediction of stock index with the practical stock index in
Shanghai Stock Exchange Center on the basis of BP
model.
Set up parameter: compose a BP network model of 10
`10`1. The input number of 10 input layer are the
closing price and volume stock A in Shanghai Stock
Exchange Center and monthly social retail goods, price
index, added value of industry at the same period of time
in the following: n-1, n week ( n=2, 2, , 188). The
output value is the closing price of Shanghai Stock
Exchange Center in the n+ 1 week.
Use the trained network to predict the weekly
closing price of stock index of Shanghai Stock
Exchange Center from 2nd November 2007 to
11th July 2008. Through 21 times of iterative
calculation, the error of network reaches 0.
0962624% which meets the requirement of
expected error 0.1% [See Fig.3].
Figures of BP network simulation prediction
curved line trend and the practical stock index of
Shanghai Stock Exchange Center trend are as the
following. We can see from the two figures the
result of our BP network simulation model is
identical to the practical data during the 20 weeks
from 2nd November 2007 to 14th March 2008.
Furthermore, our BP network simulation model
has achieved satisfactory result in the prediction
of turning point [See Fig.4].
The error remains in 10% ranging from 2nd
November 2007 to 1st February 2008. The error
remains in 20% ranging from 5th February to 14th
March 2008 as is shown in Fig.5. In the following
time, the error begins to widen. Therefore, we
highly suggest remaining the time span in 20
weeks for prediction.
Figure 3. BP model simulation convergence trend curved line
based on LM algorithm
2007/10/26 2007/11/30 2008/01/04 2008/02/05 2008/03/14 2008/04/18 2008/05/23 2008/07/04 2008/08/08
1000
1500
2000
2500
3000
3500
4000
4500
5000
5500
6000
BP
ANN-BP
176
Figure 4. The training result of BP network simulation model
based on LM algorithm
2007/10/26 2007/11/30 2008/01/04 2008/02/05 2008/03/14 2008/04/18 2008/05/23 2008/06/27 2008/08/01
-0.7
-0.6
-0.5
-0.4
-0.3
-0.2
-0.1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
BP
Figure 5. Trend of errors of BP network model for stock index of
Shanghai Stock Exchange Center based on LM algorithm
IV. CONCLUSION
This paper studies principles and general steps of
application of BP model to stock market prediction. In this
paper, we mainly discuss steps and methods of using BP
network to predict stock market, including sampling
principles, principles of determining the number of node
in hidden layers. This paper presents the setting up of
model, and actually predicts the closing index of Shanghai
Stock Exchange Center. This prediction has achieved the
expected result. With the aid of examples, this paper
proves that the BP network based on LM algorithm can fit
the stock data to predict after received studying and
training. Therefore, we can draw the conclusion that this
BP network model is appropriate for prediction for time
order.
REFERENCE
[1]Chengdong Wu and Changtao Wang, Application of artificial neural
cell BP network in stock prediction, Control Engineering, 2002(3).
[2]Jianli Yu, Zengqi Sun and Valeri.Kroumov, Modeling and decision
making in stock market based on BP neural network, Theory and
Practice of System Engineering ,2003(5).
[3]Hagan M T and Menhaj M B, Training feed forward net-works with
the marquardt algorithm, IEEE Transactions on Neural Netwoks, 1994,
5(6), pp.989-993.
[4]Dezhong Han, Study of prediction of stock market in China based
on neural cell network, Southern economy, 2006,(7).
[5]Jianli Yu, Zengqi Sun and Valeri.Kroumov, Modeling and
decision making in stock market based on BP neural network, Theory
and Practice of System Engineering, 2003(5).
177
Figure 2. LM flowing chart of BP algorithm
start
initialize weight value and threshold
study model is provided to BP network
calculate input and output node in hidden layer
calculate input and output node in output layer
calculate calibration error in hidden layer
modify weight value ranging from hidden layer
to input layer and threshold in input layer
modify weight value ranging from input layer
to hidden layer and threshold in hidden layer
update study input model
update study time
finish study
calculate calibration error in output layer
LM algorithm
yes
no
no
yes
finish all model training
error<o training times>N
178