Sie sind auf Seite 1von 26

Stock Price Selection

System Using
NeuroFuzzy Modelling
Guided by:
Mr.N.Srinivasan

Presented by:
Ramya.T(3111312)
Preeti Singh(3111296)

BONAFIDE

DECLARATION

ABSTRACT
Neural networks have been used for forecasting purposes for some years
now. Often arises the problem of a black-box approach, i.e. after having trained
neural networks to a particular problem, it is almost impossible to analyse them for
how they work. Fuzzy Neuronal Networks allow adding rules to neural networks. This
avoids the black-box-problem. Additionally they are supposed to have a higher
prediction precision in unlike situations. Applying artificial neural network, genetic
algorithm and fuzzy logic for the stock market prediction has attracted much attention
recently, which has better correlated the non quantitative factors with the stock
market performance. However these approaches perform less satisfactorily due to
the memory less nature of the stock market performance. In this paper, we propose
a data compression-based portfolio prediction model hybridized with the fuzzy logic
and genetic algorithm. In the model, the quantifiable microeconomic stock data are
first optimized through the genetic algorithms to generate the most effective
microeconomic data in relation to the stock market performance.

TABLE OF CONTENTS
CHAPTER NO
1.

TITLE

PAGE NO

Introduction
1.1 Overview
1.2 Literature review
1.3 Existing system and its limitations
1.4 Motivation
1.5 Organization of the report

2. Aim and Scope


2.1 Scope of the project
2.2 Objectives
2.3 Existing methodology
2.4 Problem statement
2.5 Overview of proposed work
3. Method and algorithms used
3.1 Hardware requirements
3.2 Software requirements
3.3 System design that includes architecture diagram, flow chart UML and
sequence diagram with explanation of each
3.4 Proposed work
3.4.1 Modules
3.4.2 Module description
3.4.3 Algorithm with input and output specified
4. Result and discussion and performance analysis
4.1 Screenshots
4.2 Description of each screenshots
4.3 Analysis using graphs and tables
5. Summary and conclusion
6. References

CHAPTER 1

1.

Introduction:A number of studies have examined the differences between neural networks

and other approaches for modeling and forecasting time series. Especially the
question if no linear models like neural networks can beat linear models have been
an issue for several years. Nevertheless the solution seems still to be unclear when
taking into account the cost - i.e. the computational and methodological expenses. In
this paper two types of neural networks are examined. The first is the classical
neural network approach where a neural network is used to predict the future price of
an asset from the history of the time series itself. The second approach is a family of
quite new neural network models where fuzzy logic is combined with neural
technology to archive higher precision in forecasting and some additional issues.
Fuzzy neural networks provide the possibility to implement rules into neural
network topology; a methodic framework is described in practice fuzzy neural
networks compete with classical neural networks where no extra information is given
than the patterns created out of the time series. An introduction into applying neural
networks for casting financial time series is given. The application of rules allows to
model patterns which occur not very often and are therefore not very likely to be
modeled by a classical neural network. Rules or groups of rules can be modeled
which are specialized on specific situations and circumstances In this paper, a new
data compression-based portfolio prediction model hybridized with genetic algorithm
and fuzzy logic is developed. Traditionally, difference models are applied in the area
of portfolio prediction. Two classical views on the prediction are namely, technical
and quantitative.
The technical view of markets is that the prices are driven by investor
sentiment and that the underlying sequence of prices can be captured and
predicated well using charting techniques. This method studies the action of the
market as a dynamical entity, rather than studying the actual goods in which the

market operator. This is a science of recording the historical market data, such as
prices of stocks and the volume traded, and attempting to predict the future from the
past performance of the function of the underlying security valuation, but also
governed by investor sentiment, health of the economy and many others.
Fuzzy logic has been applied very successfully in many areas where
conventional model based approaches are difficult or not cost-effective to implement.
However, as system complexity increases, reliable fuzzy rules and membership
functions used to describe the system behavior are difficult to determine.
Furthermore, due to the dynamicwhich occur not very often and are therefore not
very likely to be modeled by a classical neural network. Rules or groups of rules can
be modeled which are specialized on specific situations and circumstances In this
paper, a new data compression-based portfolio prediction model hybridized with
genetic algorithm and fuzzy logic is developed. Traditionally, difference models are
applied in the area of portfolio prediction. Two classical views on the prediction are
namely, technical and quantitative.
The technical view of markets is that the prices are driven by investor
sentiment and that the underlying sequence of prices can be captured and
predicated well using charting techniques. This method studies the action of the
market as a dynamical entity, rather than studying the actual goods in which the
market operator. This is a science of recording the historical market data, such as
prices of stocks and the volume traded, and attempting to predict the future from the
past performance of the function of the underlying security valuation, but also
governed by investor sentiment, health of the economy and many others.
Fuzzy logic has been applied very successfully in many areas where
conventional model based approaches are difficult or not cost-effective to implement.
However, as system complexity increases, reliable fuzzy rules and membership
functions used to describe the system behaviour are difficult to determine.
Furthermore, due to the dynamic nature of economic and financial applications.
Rules and membership functions must beadaptive to the changing environment in
order to continue useful. This article outlines a Stock Market Prediction System
(SMPS) system that extends the neural networks approach to handle fuzzy,
probabilistic and Boolean information. An SPS combines the various advantages of

expert systems, artificial neural systems and fuzzy reasoning. It is designed as


integrated networks architecture, based on a building block called neural gate.

Overview

1.1

Matlab, a Mathworks company in the United States first introduced a set of


numerical analysis and high-performance computing software in 1983. Expanding its
capabilities the version was continually upgraded. Now, the latest version is 2010b
version. It provides a professional level of symbolic computation, word processing,
visual modeling and simulation and real-time control functions. Matlab is a
characteristic of all language features and next generation software development
platform.
Matlab has become suitable for many disciplines and powerful large-scale software.
Most of colleges and universities in Europe and other countries use it. Matlab has
become linear algebra, automatic control theory, mathematical statistics, digital
signal processing, time series analysis, dynamic system simulation and other
advanced courses in the basic teaching tool. In designing the study units and
industrial development sector, Matlab is widely used in research and solve specific
problems. In China, Matlab has received increasing attention in a short time it will
flourish, because no matter which discipline or engineering can be found right from
the Matlab function.
Today's information society, the image is mankind's access to information is one of
the most important sources. With the rapid development of computer technology,
image technology and the continued integration of computer technology to produce
a series of image processing software. Matlab has become internationally
recognized as the best application of technology. With simple programming and data
visualization, it can be seen the operable features.

1.2 Literature review


SN
O

Name of
the Author

Year of
publication

Advantages

Disadvantages

1.

J.G Agrawal

4th April
2013

It attracts
large no of
investors and
economists.

Not for suitable for

To control and
montire the
entire stock
market price.

Back propagation

Dr.V.S
Chourasia

Accuracy.

Dr.A.K.Mittra
2.
G.Preethi
B.Santhi

th

15 dec
2012

network can be take


long time to train
the large amount of
data.

3.
Ebrahim
Abbasi
Amir Abouec

1.4 Motivation

28th oct
2008

it helps in
forecasting the
stock price.

Designing ANFIS is
exclusive for any
company.and
designed network is
not applicable for
other companies.

The Existing methods to predict stock price can have uncertainity due to non
linear data overtime. Stock price prediction accurancy can be improved with neuro
fuzzy modelling and by looking into real time entities such as news, management
strategies and government decisions. In order to improve the accurancy a new
approach based on Neuro fuzzy and by looking into real time entities can be
incorporated
In this paper, a new data compression-based portfolio prediction model
hybridized with genetic algorithm and fuzzy logic is developed. Traditionally,
difference models are applied in the area of portfolio prediction. Two classical views
on the predictionare namely, technical and quantitative.

The technical view of

markets is that the prices are driven by investor sentiment and that the underlying
sequence of prices can be captured and predicated well using charting techniques.
In this paper, we mainly discuss steps and methods of using neural network to
predict stock market, including sampling principles, principles of determining the
number of node in hidden layers. Then the previous stock market performance with
the effective stock data and the fuzzified microeconomic data are processed based
on the context-based modeling and vector quantization. Finally, the prediction of the
stock market performance with the stock data is defuzzified using the fuzzification
model to produce a portfolio performance prediction. The major concern of the study
is to develop a system that can predict future prices in the stock markets by taking
samples of past prices. The developed system seems to work acceptable.
Experiments show that obtained forecasts have about 70% accuracy; this result can
be seen as satisfying for such difficult task.

1.5 Organizationof the report

CHAPTER 2
2.Aim and scope
2.1 Scope of the project

After an extensive literature survey all the drawbacks of the existing system
have been noted and plans and methodologies to overcome those limitations. The
Scope of the project carries the aim and view of the project.

2.2 Objective

To predict the future stock price.


Implementing Fuzzy Rule and Neural Network Modeling for high accuracy.
Suggestions to the user about time dependent information about the stock.

2.3 Existing system and its limitations

No

Valid data
Data
collection

Selection of
parameters

Data
processing
Yes

Testing

Classifier

Test data

Feed forward
learning
algorithm

Best
variable

Training data

Yes

In this method stock prediction system is developed based on a fuzzy neural


network by using the past stock data to discover fuzzy rules and make future
predictions. stocks based on the past historical data using fuzzy neural network with
the Back-Propagation learning algorithm, it is conclusive that the average error for
simulations using lots of data is smaller than that using less amount of data. That is,
the more data for training the neural network, the better prediction it gives. If the

Yes
Yes

training error is low, predicted stock values are close to the real stock values. The
Existing methods to predict stock price can have uncertainity due to non linear data
overtime. Stock price prediction accurancy can be improved with neuro fuzzy
modelling and by looking into real time entities such as news, management
strategies and government decisions. In order to improve the accurancy a new
approach based on Neuro fuzzy and by looking into real time entities can be
incorported.

Disadvantages:

2.4

High future price


Accuracy is low

Problem Statement

Stock price predeiction


2.5

Overview of Proposed Methodology


Matlab, a Mathworks company in the United States first introduced a set of

numerical analysis and high-performance computing software in 1983. Expanding its


capabilities,the version was continually upgraded. Now, the latest version is 2010b
version. It provides a professional level of symbolic computation, word processing,
visual modeling and simulation and real-time control functions. Matlab is a
characteristic of all language features and next generation software development
platform.
Matlab has become suitable for many disciplines and powerful large-scale
software. Most of colleges and universities in Europe and other countries use it.
Matlab has become linear algebra, automatic control theory, mathematical statistics,
digital signal processing, time series analysis, dynamic system simulation and other
advanced courses in the basic teaching tool. In designing the study units and
industrial development sector, Matlab is widely used in research and solve specific
problems. In China, Matlab has received increasing attention in a short time it will
flourish, because no matter which discipline or engineering can be found right from
the Matlab function.

Today's information society, the image is mankind's access to information is


one of the most important sources. With the rapid development of computer
technology, image technology and the continued integration of computer technology
to produce a series of image processing software. Matlab has become internationally
recognized as the best application of technology. With simple programming and data
visualization, it can be seen the operable features.

Chapter 3

3.Methods and algorithm used

3.1 Hardware requirements


Processor Type

: Pentium -IV

Speed

: 2.4 GHZ

Ram

: 128 MB RAM

Hard disk

: 20 GB HD

3.2 Software requirements


Operating System

: Windows 7

Software Programming Package

: Matlab R2013a

3.3 System design that includes architecture diagram

3.4 Proposed work

In this paper, a new data compression-based portfolio prediction model


hybridized with genetic algorithm and fuzzy logic is developed. Traditionally,
difference models are applied in the area of portfolio prediction. Two classical views
on the prediction are namely, technical and quantitative. The technical view of
markets is that the prices are driven by investor sentiment and that the underlying
sequence of prices can be captured and predicated well using charting techniques. In
this paper, we mainly discuss steps and methods of using neural network to predict
stock market, including sampling principles, principles of determining the number of
node in hidden layers. Then the previous stock market performance with the effective
stock data and the fuzzified microeconomic data are processed based on the contextbased modeling and vector quantization. Finally, the prediction of the stock market
performance with the stock data is defuzzified using the fuzzification model to
produce a portfolio performance prediction. The major concern of the study is to
develop a system that can predict future prices in the stock markets by taking samples
of past prices. The developed system seems to work acceptable. Experiments show
that obtained forecasts have about 70% accuracy; this result can be seen as satisfying
for such difficult task.

3.4.1 Modules
Construct the classifier
KNN classifier
Cross validation classifier
Draw a circle around the 10 nearest neighbours
Data clustering
Training Data

3.4.2 Modules description

3.4.3 Algorithm with input


and output specified
An n-input-1-output fuzzy neural network has m fuzzy IF-THEN rules which are
described by

IF

x1

is

where

values

A1k

xi

and and

xn

is

Ank

THEN y is

Bk

and y are input and output fuzzy linguistic variables, respectively. Fuzzy linguistic
Aik

and

Bk

are

defined

by

fuzzy

membership

functions

xi a ik 2
Ai ( xi ) exp[ (
) ]
k
ik

B k ( y ) exp[ (

as

follows,

(1)

y bk 2
) ]
k

(2)

the n-input-1-output fuzzy neural network with simple fuzzy reasoning is defined below:

f ( x1 ,..., xn )

k
mk1 b [in1 A k ( xi )]
i

mk1[in1 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). The energy function for p is
defined by
1
E p [ f ( x1p ,..., x np ) y p ]2
2

(4)

For simplicity, let E and

denote

Ep

centers of output membership functions (

E P
k

and

E P
b k

f ( x1p ,..., x np )

), the widths of output membership functions(

), the centers of input membership functions(

membership functions(

b k (t 1) b k (t )

E P
k

E P
b k

, respectively. After training the

E P
a k

) and the centers of input

), then we obtain the training algorithm [5 -7]:

E P
k

E P
(t 1) (t )
k

k (t 1) k (t )
t

(5)

(6)

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

(7)

(8)
Where, is the learning rate and t=0,1,2,
The main steps using the learning algorithm as follows:
Step 1: Present an input data sample, compute the corresponding output;
Step 2: Compute the error between the output(s) and the actual target(s);
Step 3: The connection weights and membership functions are adjusted;
Step 4: At a fixed number of epochs, delete useless rule and membership function nodes, and
add in new ones;
Step 5: IF Error > Tolerance THEN go to Step 1 ELSE stop.

When the error level drops to below the user-specified tolerance, the final
interconnection weights reflect 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, the 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.

CHAPTER 4
4.Result and discussion and
performance analysis
The Hybrid Time Lagged Network (HTLN) has been tested with stock series of various
companies listed on the main board of the Kuala Lumpur Stock Exchange to analyse their
behaviours with respect to the varying degree of chaos in the input series [21]. In addition,
the performance of HTLN is compared with two standard networks for stock predictions.
They are the supervised Multilayer Perceptron network known as

Time Lagged Feed-forward Network (TLFN) and unsupervised Kohonen network known as
Highly Granular Unsupervised Time Lagged Network (HGUTLN) [21]. As the algorithms
intend to be used by traders for stock trading, the performance analysis is carried out for the
three neural network algorithms based on the stock trading performance.
best performance and the error factor increases geometrically with m, the degree of prediction
attempted.
The Hybrid Time Lagged Network (HTLN) has been tested with stock series of various
companies listed on the main board of the Kuala Lumpur Stock Exchange to analyse
behaviours with respect to the varying degree of chaos in the input series [21]. In addition,
the performance of HTLN is compared with two standard networks for stock predictions.
They are the supervised Multilayer Perceptron network known as

Time Lagged Feed-forward Network (TLFN) and unsupervised Kohonen network known as
Highly Granular Unsupervised Time Lagged Network (HGUTLN) [21]. As the algorithms
intend to be used by traders for stock trading, the performance analysis is carried out for the
three neural network algorithms based on the stock trading performance.
In this section, the trading performance of Diversif (Diversified Resources Berhad) and
Carlsberg (Carlsberg Brewery Malaysia Berhad) is used as examples to illustrate the
performance of the three neural networks. The reasons for showing these two stocks over the
others is the interesting nature of its stock price series including a few steep turns and lots of
different turning points in the price series.

4.1 Screenshots

4.2 Descrption for each screen


shots
4.3 Analsis using graphs and
tables
The performance of the TLFN, HGUTLN and HTLN networks based on the trading of
Diversif and Carlsberg stocks with initial starting value of 10,000 RM. In the figures, two
types of curves are shown. Liquid Cash indicates the cash values and Portfolio Value
indicates the cash and stock values. As shown in Fig. 7 and Fig. 8, it can be seen that the
hybrid HTLN network performs the best in terms of both the prediction quality and the
amount of profits generated. It gives a very stable performance and is not disturbed by the
chaotic nature of data. The supervised TLFN network performs with reasonable amount of
accuracy in terms of prediction. However, it can be thrown off balance if the input series is
very chaotic in nature. The unsupervised HGUTLN network performs the worst of the three
in terms of prediction quality. It has a lagging behaviour with respect to the input temporal
series.
The financial market different from a lot of physical systems like we know the weather is that
the financial market is a sort of complex feedback mechanism. What people expect prices to
be affects the prices they observe and then the prices they observe then affects how they are
going to form their expectations about what the prices will be in the next period. The market
is basically an uncertain beast or an uncertain institution, its an institution where people trade
risk, swap risk, and thats why its there. And so if it were possible to predict it there would be
no risk. In individuals, I think there cannot be any publicly available system to predict a
financial market. On the other hand, neural networks have been found useful in stock price
prediction [1-2]. Both feedforward and recurrent neural networks have been investigated and
good results have been obtained. That means the prediction software would be very useful to
assist individuals in reaching a final decision. In this paper, assuming that it is possible to

predict markets, a prediction system is developed using fuzzy neural networks with a learning
algorithm to predict the future stock values. The system consists of several neural networks
modules. These models are all used to learn the relationships between different technical and
economical indices and the decision to buy or sell stocks. The inputs to the networks are
technical and economic indices. The output of the system is the decision to buy and sell.
There are several neural network methods for stock prediction, such as Time Series method,
Recurrent neural network and Feed-forward neural network method, etc. [2]. When compared
to these techniques, Fuzzy neural network is a very useful and effective method to process,
which is explained in the later sections.
The learning algorithm is used to train the networks. Before learning starts, tolerances are
defined for the output units. During learning, the weights are updated only when the output
errors exceed the tolerances. The learning data for which the output errors do not exceed the
tolerances are eliminated from the training data sets. The input data to each network are the
moving averages of the weekly averaged data which are obtained directly by using a Java
program from the website. The output simulation data is also the average values of the
weekly stock data.
Time series forecasting analyzes past data and projects estimates of future data values.
Basically, this method attempts to model a nonlinear function by a recurrence relation derived
from past values. The recurrence relation can then be used to predict new values in the time
series, which hopefully will be good approximations of the actual values. There are two basic
types of time series forecasting: univariate and multivariate. Univariate models, like BoxJenkins, contain only one variable in the recurrence equation. The equations used in the
model contain past values of moving averages and prices. Box-Jenkins is good for short-term
forecasting but requires a lot of data, and it is a complicated process to determine the
appropriate model equations and parameters. Multivariate models are univariate models
expanded to "discover casual factors that affect the behavior of the data." [3-4]. As the name
suggests, these models contain more than one variable in their equations. Regression analysis
is a multivariate model, which has been frequently compared with neural networks. Overall,
time series forecasting provides reasonable accuracy over short periods of time, but the
accuracy of time series forecasting diminishes sharply as the length of prediction increases.
Many other computer-based techniques have been employed to forecast the stock market.
They range from charting programs to sophisticated expert systems. Fuzzy logic has also
been used. Expert systems process knowledge sequentially and formulate it into rules. They

can be used to formulate trading rules based on technical indicators. In this capacity, expert
systems can be used in conjunction with neural networks to predict the market. In such a
combined system, the neural network can perform its prediction, while the expert system
could validate the prediction based on its well-known trading rules. The advantage of expert
systems is that they can explain how they derive their results. With neural networks, it is
difficult to analyze the importance of input data and how the network derived its results.
However, neural networks are faster because they execute in parallel and are more fault
tolerant.
The major problem with applying expert systems to the stock market is the difficultly
in formulating knowledge of the markets because we ourselves do not completely understand
them. Neural fuzzy networks have an advantage over expert systems because they can extract
rules without having them explicitly formalized. In a highly chaotic and only partially
understood environment, such as the stock market, this is an important factor. It is hard to
extract information from experts and formalize it in a way usable by expert systems. Expert
systems are only good within their domain of knowledge and do not work well when there is
missing or incomplete information. Neural networks handle dynamic data better and can
generalize and make "educated guesses." Thus, neural networks are more suited to the stock
market environment than expert systems. In the wide variety of different models presented so
far, each model has its own benefits and shortcomings. The best way is that these methods
work best when employed together. The major benefit of using a fuzzy neural network then is
for the network to learn how to use these methods in combination effectively, and hopefully
learn how the market behaves as a factor of our collective consciousness.

CHAPTER 5
5 Summary and conclusion

In this paper, we mainly discuss steps and methods of using neural network to predict stock
market, including sampling principles, principles of determining the number of node in
hidden layers. Then the previous stock market performance with the effective stock data and
the fuzzified microeconomic data are processed based on the context-based modeling and
vector quantization. Finally, the prediction of the stock market performance with the stock
data is defuzzified using the fuzzification model to produce a portfolio performance
prediction. The major concern of the study is to develop a system that can predict future
prices in the stock markets by taking samples of past prices. The developed system seems to
work acceptable. Experiments show that obtained forecasts have about 70% accuracy; this
result can be seen as satisfying for such difficult task.

REFERENCES
[1][Hie941] Y. Hiemstra. Linear Regression versus Backpropagation to PredictQuarterly
Excess Returns In: Pmceedings of the Neuml Networks in the Capital Markets 1994,
Pasadena, CA, 1994.
[2][JK95] J. Ledermann, R. A. Klein. Virtual %ding. Probus Publishing, 1995.
[3][Ras97] M. Rut. Application of Fuzzy Neural Networks on Financial Problems In:
Proceedings of the NAFIpS97, Syracuse, NY, 1997.
[4]B.Vanstone and G. Finnie, "An Empirical Methodology for Developing Stockmarket
Trading Systems using Artificial Neural Networks,"Expert Systems with Applications,
vol. In Press, 2008.
[5]C.M. Huang, Q. Bi, G.S. Stiles, and R. W. Harris. Fast full search equivalent
encoding algorithms for image compression using quantization. IEEE Transactions
[6]Pamela C.Cosman, Eve A. Riskin, Rbert M. Gray, Combining Vector Quantization
and Histogram Equalization, BULB Journals, Information Processing & Management.
Vol. 28 Number 6, 1992 pp. 68 1-686

[7]G. S. Atsalakis and K. P.Valavanis, "Surveying stock market forecasting techniques part ii: Soft computing methods," Expert Systems with Applications, vol. In Press,
Corrected Proof, 2008.
[8] A. P. N. Refenes, A. N. Burgess, and Y. Bentz, "Neural networks in financial
engineering: A study in methodology," IEEE Transactions on Neural Networks, vol. 8(6),
pp. 1222 - 1267, 1997.

Das könnte Ihnen auch gefallen