You are on page 1of 4

2012 Second International Conference on Advanced Computing & Communication Technologies

Stock Prediction by Fuzzy Neural Networks


Manoj B Karathiya
.
Assistant Professor,
M.C.A. Department,
R.K. College of Eng. & Tech,
(Affiliated to G.T.U. Ahmadabad)
India, Gujarat, Rajkot 362001.
Mail: manoj.karathiya@rku.ac.in

Diler Singh Sakshi


Assistant Professor,
B.C.A. Department,
G.K. & C.K. Bosamia College,
(Affiliated to Saurashtra University)
India, Gujarat, Rajkot 360005.
Mail:sakshidiler@gmail.com

and vend. There is more than one method for stock


prediction, such as Feed forward neural network, Time Series
and recurrent neural network etc [1]. Fuzzy neural network is
very effective method compared to these methods. Here
learning algorithm is used to prepare the network, before
learning establishes tolerances are defined for the output
units. During learning, the weights are updated if output
errors surpass the tolerances. The learning data which has
output errors do not surpass the tolerances are removed from
the training data sets. The input data to each network are
moving averages of the weekly averaged data which are
achieved directly by the java / .Net Program from the web
and output simulation data are also common prices of the
weekly / monthly stock data.

Abstract--Stock prediction by neural network is developed based


on fuzzy neural network technology using past stock data to
determine fuzzy set of laws and construct potential predictions.
Learning Algorithm is put into operation. Input data to every
network are average of weekly stock data that acquired from
any stock related URL such as http://www.moneycontrol.com.
Out put recreated data are also average values of weekly stock
data. After the data collected from web using any web search
engine for the exact term, the system is qualified and then
capable to formulate future predictions.

I.

INTRODUCTION

Financial market dissimilar compare with physical systems


such as we know the weather is that financial market is a type
of complex feedback mechanism. People expect values to be
affect the values they observe and they are going to structure
their prospects about what values will be in the next period.
Market is fundamentally tentative living thing or tentative
institution, its an institute where people can trade risk, swap
risk and that is why there. If it were achievable to predict it
there would be no danger, we think cannot any advertise to
predict a financial market. Neural networks have been
established useful in stock value prediction [1, 2]. Both
networks method feed forward and recurrent neural have
been examined and fine results have been acquired. So we
can say that prediction system very useful to help everyone
accomplishment final conclusion. In this research, we assume
that it is potential to predict markets, this system is grown
using fuzzy neural networks using learning algorithm to
predict prospect stock values. System consist difference
modules, which all are used to learn the connection between
several technical and economical indices and judgment to
purchase or vend stocks. Inputs of the system are technical
and economic indices and output is conclusion to purchase
978-0-7695-4640-7/12 $26.00 2012 IEEE
DOI 10.1109/ACCT.2012.108

Ravinder Singh Sakshi


H.O.D. (Computer/IT)
BCA, BScIT, MScIT Departments,
Uttranchal College of Science & Tech.,
(Affiliated to H.N.B. Garhwal University)
India, Uttarakhand, Srinagar 246174.
Mail: ravindermca04@gmail.com

II. MODEL STUDY


Time series forecasting examines past data and projects
estimates of future data values. Fundamentally this technique
challenges to model a nonlinear function by a recurrence
relation resulting from past values. Recurrence relation can
be used to forecast new values in the time series, which
optimistically will be excellent approximations of the real
values. Basically two types of time series forecasting:
Univariate and Multivariate, univariate models like Box and
Gwilym Jenkins (Box Jenkins) hold only single variable in
the recurrence equation. Equations used in the model hold
past values of averages and prices. Box Jenkins approaches
to forecasting provide some of the most accurate short term
forecasts however requires more data and it is a complicated
process to find out suitable model equations and parameters.
Multivariate models are stretched out from univariate models
to determine careless factors which involve in the behavior of
the data [3]. These models enclose more than one variable in
their equations. Regression analysis is a multivariate model
79

According to the method of fuzzy logic system, fuzzy


neural network generally has five practical layers: (a) L1,
input layer (b) L2, fuzzification layer (c) L3, fuzzy reasoning
layer (d) L4, defuzzification layer (e) L5 output layer.
Architecture of a fuzzy neural network is illustrated in figure,
generally fuzzy neural network maps crusty enters Xi (i=1, 2,
3..n) and output Yj (j=1, 2, 3..m). A fuzzy neural
network is constricted layer by layer according to linguistic
variables, if then laws, fuzzy interpretation method and
defuzzification scheme of a fuzzy interpretation method and
defuzzification scheme of a fuzzy logic control system.

that has been regularly evaluated with neural networks.


Generally time series forecasting provide sensible precision
over short periods of time but correctness of time series
forecasting reduces sharply as the length of prediction
increases. Lots of other computer oriented techniques have
been engaged to forecast stock market. They range from
graphical system to complicated expert systems. Using fuzzy
logic expert systems process information successively and
put together it into rules. They can be used to prepare
trading rules based on technical indicators. In this capability,
expert system can be used in conjunction with neural
networks to predict the market. Such a combined system,
neural network can perform its prediction while expert
system could validate the prediction based on trading rules.
By expert system they can know how derived their results.
By neural networks, it is complicated to analyze the
importance of input data and how network derived its results.
On the other hand neural networks are faster because they
execute in parallel and are more error to understanding.

Every neuron in the fuzzification layer characterizes an


input relationship function of the antecedent of a fuzzy law.
Single universal method to apply this layer is to communicate
relationship functions as discrete points. Therefore a fuzzy
law if x1 is A1 and x2 is A2 . Then y =B, As differentiate
the possibility distribution of the antecedent clause x=A. each
of the hidden nodes is defined as a fuzzy reference point in
the input space and defuzzification layer is for the law
estimation. If every neuron in this layer characterizes a
resulting proposition then y=B and its relationship function
can be implemented by combining one or two sigmoid
functions and linear functions.

The main difficulty for applying expert systems to the


stock market is the complexity in formulating knowledge of
the markets because we ourselves do not totally understand
them. Fuzzy neural networks have a benefit over expert
system because they can extract rules without having any
explicitly formalized. In a extremely hectic and partially
silent surroundings, such as a stock market which is a
significant factor. It is inflexible to extract information from
experts and formalize it in a way usable by expert systems.
Expert systems are only good within their domain of
comprehension and do not work well when there is absent or
unfinished information. Artificial neural networks touch
energetic data better and can generalize and make
knowledgeable speculation . Therefore, artificial neural
networks are more suitable to the stock market atmosphere
than expert systems. In the broad range of different models
presented so far each model has its own benefits and
shortcomings. Best way to use this method when employed
together. Key benefit of using a fuzzy neural network for the
network is to study how to use these techniques in
combination successfully and optimistically learn how the
market behaves as a factor of our combined awareness.

Algorithm:
N Input, L output fuzzy network has M fuzzy if then
which are explained as
k

k
k
A
If X1 is A1 and Xn is n then Y is B ,

Where Xi and Y are input and output fuzzy linguistic


variables, correspondingly. Fuzzy linguistic values

Aik and

B k are defined by fuzzy membership functions as follows:

A ( xi ) = exp[(
i
k

B ( y ) = exp[(
k

xi aik

ik

y bk

)2 ]

(1)

)2 ]

(2)

N Input, L output fuzzy neural network with effortless


III. FUZZY NEURAL NETWORK (FUNN)

fuzzy reasoning is defined as under:

f ( x1 ,..., x n ) =

k
mk=1 b [in=1 A k ( xi )]
i

mk=1[in=1 Ak
i

( xi )]

(3)

Given N dimensional input data vectors xp (i.e. xp = (x1p,


x2p,..,xnp)) and one dimensional output data vector yp for
p=1,2,.,N,(i.e. N training data sets). Energy function for p
is defined by
Fig. A. Architecture of Fuzzy Neural Network

80

1
E p = [ f ( x1p ,..., x np ) y p ] 2
2

forward using historical data, data for neural networks is


possibly most significant aspect for training. Without user
intervention a particular stock data is acquired from the web
frankly as users condition, in this process, user can decide
stock and price information he wants to get. Preprocessing
operation is required as preparatory step for next stage.
Example of preprocessing, daily price of downloadable data,
it is to be grouped by week and average of each week also
calculated for the next step. A HTML parser that coded in
java is used to retrieve data. Using that program parses the
whole file read line by line to collect used information and
insert into database. All training data are arranged for 2
input

1
output
system
as
such
format(d1,d2,,d3),(d2,d3,,d4),(d3,d4,...,d5), where first
vector d1,d2 are inputs and d3 is an output, in the second and
third vector d2,d3 and d3,d4 are inputs while d4 and d5 is an
output.

(4)

For simplicity, let E and fp denote Ep and f(x1p, ..,xnp),


respectively. After training centers of output membership
functions

functions(

E P
) the widths of put membership
b k

E P
), the centers of input membership functions
k

E P
)and the centers of input membership functions
a k

E P
), then we obtain the training algorithm [4-6]:
k

b k (t + 1) = b k (t )

E P
b k

There are some parameters that we have to utilize during the


training period. There also errors, threshold and tolerance etc,
accurate results depend on these parameters.

(5)
t

There are some parameters, which we have to use during


the training period. They are error, threshold, tolerance, etc.
The accurate results depend on these parameters. To achieve
our target rapidly, some parameters are preprocessed. For
example, in the fuzzy member function 1 and 2, there are two
important parameters: center and width of the fuzzy set. Their
initial values have critical impact on the performance of
system. The random value generated by machine is not
optimal. In this system, we propose a simple way to optimize
the initial value: sort all of data obtained from internet, and
then divide data into five groups, get the average value of
each group, these values are used in member function as the
initial value of fuzzy set center.

k (t + 1) = k (t )

E
k

(6)
t

E P
a (t + 1) = a (t )
a k

E P
k

k (t + 1) = k (t )

(7)

(8)

Where, n is learning rate and t=0, 1, 2, 3, 4

Prediction algorithm takes all these parameters as an input,


this algorithm is called when we click predict future from the
system after entering the stock symbol. This algorithm makes
the neural network learn. Algorithm returns future values as
output which are eventually stored in result table for each
stock. We will keep track of these results until we click on
the average error for all simulations for this particular stock.
Java program display all the results of predictions for any
particular stock at a time on the web page and clears the
contents of the table.

Major steps using learning algorithm as under:


Step1: present input data sample, calculate equivalent output.
Step2: calculate error between output and actual target.
Step3: connection weights and membership functions are
adjusted.
Step4: at the fixed number of epochs, delete useless rule and
membership function nodes, and add in new ones.
Step5: if error > tolerance then go to step 1 else terminate.
When the error point falls to below the user specified
tolerance, the last interconnection weights reproduce the
changes in the initial fuzzy rules and membership functions.
If the resulting weight of a rule is close to zero, the rule can
be safely removed from the rule base, since it is insignificant
compared to others. Also, shape and position of the
membership functions in the fuzzification and defuzzification
layers can be fine tuned by adjusting the parameters of the
neurons in these layers, during the training process.

2) Implementation
System implementation described as under:
Download historical data from the web.
System is written through which user can get the data
requirement, arrange all data into format that used
for next step and stored into database.
Algorithm, which trains neural networks using the
Mean Square (MS) error as stop criterion for
learning, while never exceeding the maximum
number of cycles which can take testing data from
the initial date to the user entered date and predicts
future stock closing values

IV. IMPLEMENTATION OF SYSTEM


1) Data Input and Software Parameters
System can predict future values for any stock or index. For
example to predict Infosys stock values for next days

81

System compares predicted values with real values.


One of the most important factors to construct a neural
network depends on what the network will learn. A neural
network must be trained on some input data. The two major
problems in implementing the training are: defining the set
of input to be used (learning environment) and deciding on
an algorithm
3) Mock-up
System to predict future stock values using fuzzy neural
networks and we can perform some analysis to identify the
performance of the Back Propagation Algorithm.

Fig. C Mock up Prices and Real prices of the stock of CSC

V. TERMINATION
After finishing several mock ups for predicting several
stocks based on the past historical data using fuzzy neural
network through the Back Propagation learning algorithm,
it is sure that standard error for mock ups using large data is
less and then using small data is more. If training error is
slow then predicted values are very close to the real values.

Using past data, we can predict stock values for future some
weeks by Back Propagation algorithm we able to calculate
predicted stock values by means of the real values. Table A
and Figure B prove the predicted and current values of the
weekly average of the stock I2 Technologies, When the past
data is from Table B and Figure C represent the predicted and
real values of the weekly average of the stock of Cypress
Semiconductor Corporation.

VI. ORIENTATION

[1]

While we changed the number of the input historical data,


if more input data so we have superior guidance and got more
close result, Means that, if you having more data for
predicting financial markets then you have good chances for
accurate forecast.

[2]

[3]

Mock ups are done on several more stocks such as


Microsoft, Wipro and MRF etc. by the mock up result it is
sure that, average error for mock up using more data is less
compared to the average error using less data is more.

[4]

[5]
TABLE A
AVERAGE PRICES OF STOCKS OF I2 TECHNOLOGY

[6]

TABLE B
AVERAGE PRICES OF STOCKS OF CYPRESS SEMICONDUCTOR CORPORATION

Fig. B. Mock up prices and real values of the stock of I2 Tech.

82

D.T. Pham and X. Liu, Neural Networks for Identification, Prediction


& Control , Springer, 1999.
C.H. Lee & K.C. Park, prediction of monthly transition of the
composition stock price index using
recurrent back propagation
Int.. Conf. On Artificial Neural Networks, Brighton,UK, pp.1629-1632,
1992.
J. Robert & Van The Application of neural networks in the forecasting
of share prices Finance and Technology Publishing, 1996.
R.A Gagliano & A. Kandel, Granular neural networks for numerical
linguistic data fusion and
knowledge discovery Special Issues on
Neural Networks for Data Mining and Knowlede Discovery, IEEE
Transactions on Neural Networks, Vol. 11, No. 3, pp.658-667, May,
2000.
Y.-Q. Zhang and A. Kandel, Compensatory Genetic Fuzzy Neural
Networks and Their Applications, Series in Machine Perception
Artificial Intelligence, Volume 30, World Scientific, 1998.
Witold Pedrycz, Abraham Kandel and Yan-Qing Zhang, Neurofuzzy
Systems, In Fuzzy Systems: Modeling and Control, pages 312363,
Kluwer Academic Publishers, 1999.

You might also like