Content uploaded by Zahid Iqbal

Author content

All content in this area was uploaded by Zahid Iqbal on Aug 12, 2014

Content may be subject to copyright.

Zahid Iqbal et al Int. Journal of Engineering Research and Applications www.ijera.com

ISSN : 2248-9622, Vol. 3, Issue 6, Nov-Dec 2013, pp.855-867

www.ijera.com 855 | P a g e

Efficient Machine Learning Techniques for Stock Market

Prediction

Zahid Iqbal, R. Ilyas, W. Shahzad, Z. Mahmood and J. Anjum, Member, IEEE

Abstract

Stock market prediction is forever important issue for investor. Computer science plays vital role to solve this

problem. From the evolution of machine learning, people from this area are busy to solve this problem

effectively. Many different techniques are used to build predicting system. This research describes different state

of the art techniques used for stock forecasting and compare them w.r.t. their pros and cons. We have classified

different techniques categorically; Time Series, Neural Network and its different variation (RNN, ESN, MLP,

LRNN etc.) and different hybrid techniques (combination of neural network with different machine learning

techniques) (ANFIS, GA/ATNN, GA/TDNN, ICA-BPN). By extensive study of different techniques, it was

analyzed that Neural Network is the best technique till time to predict stock prices especially when some de-

noising schemes are applied with neural network. We, also, have implemented and compared different neural

network techniques like Layered Recurrent Neural Network (LRNN), Wsmpca-NN and Feed forward Neural

Network (NN). By comparing said techniques, it was observed that LRNN performs better than feed forward NN

and Wsmpca-NN performs better than LRNN and NN. We have applied said techniques on PSO (Pakistan State

Oil), S&P500 data sets.

Index Terms— Feed Forward Neural Network, Recurrent Neural Network, Stock Market, Machine Learning

I. INTRODUCTION

Stock market prediction is one of challenging

issue, catches attention of many researchers and

investors. Investors all across the globe showed their

great interest in stock predicting systems. Investors

start relying on predictions systems to make their

important business decisions. A lot of research is made

in this domain but still no complete solution is found.

Is stock market prediction fully possible is still debate

of the hour. This is due to difficulty in predicting stock

market with full accuracy because there is a great

influence of external entities (social, political,

psychological, and economic) [1] [20]. Secondly, it

requires huge amount of historical data. Various

machine learning techniques are being used to predict

market states. This research covers many state of the

art techniques to find out some optimal solution to the

problem.

Several machine learning techniques are

being in use for stock market prediction. There is no

specification made by which we can choose the

optimal solution for stock market prediction. This

research will study different machine learning

techniques being in use for stock market prediction.

This research will follow a comparative approach to

find out optimal technique for stock market prediction.

Comparison will be made on the basis of their

performance. Every technique has some advantages

and disadvantages. This research will analyze

advantages and limitations of these techniques. And

find that which technique is comparatively better for

stock market prediction.

Fundamental and Technical analysis are two famous

methods being in use for risk analysis from very old

age. When there was no computational method to

analyze risk these methods were used.

To predict stock prices (by analyzing past data) there

are many conventional methods. Generally used two

methods are [1][20][10][18].

i. Fundamental and

ii. Technical

In Fundamental analysis, accurate and

reliable information of company’s financial report,

competitive strength and economic conditions are

required to find out the accurate value of product in

which they have interest. This value is used for making

decision for investment. It is based on this idea “If the

intrinsic is higher than the value it holds in the

market, invest, else it will be considered a bad

investment and avoid it”.

Fundamental analysts believe that 90 percent

logical factors and 10 percent physiological factors

define a market. Fundamental analysis is useful in

long-term predictions. The advantages of fundamental

analysis are its systematic approach and its ability to

predict changes before they show up on the charts. [1]

Technical analysis requires history of market. “The

idea behind technical analysis is that constantly

changing attributes of investors in response to

different forces/factors make trends/move of stock

prices”. Different technical factors like volume and

maximum and minimum prices per trading period are

used for analysis. Rules are extracted from data. On

the basis of these rules investor take decisions for

RESEARCH ARTICLE OPEN ACCESS

Zahid Iqbal et al Int. Journal of Engineering Research and Applications www.ijera.com

ISSN : 2248-9622, Vol. 3, Issue 6, Nov-Dec 2013, pp.855-867

www.ijera.com 856 | P a g e

future. According to some chartists, market trend is 90

percent psychological and only 10 percent logical. The

major disadvantage of technical analysis is that trading

rule extraction from charts study is very subjective so

different analysts might derive different rules from

same charts [1]. Technical analysis is used for both

long and short term analysis.

The basic purpose of this research is to find

the optimal among many state of the art techniques.

What is the optimal technique for stock prediction? By

combining multiple techniques can we get a better

system or we have already optimal solution? On which

basis one prediction system is preferred on other? For

this purpose we compare and analyze some current an

efficient techniques on the basis of their produced

results.

II. TECHNIQUES USED FOR STOCK MARKET

PREDICTION AND COMPARISON

Prediction is making decision on the basis of

past known data (knowledge). Predicting stock market

trends is challenging task. It is because of non-linear

behavior of stock data. Many other factors are also

present here, which create hurdles in the way to

predict stock (economic conditions, trader’s behavior,

investor psychology, politics etc.). To some extent,

artificial intelligence makes it possible to predict stock

trends. The main purpose of any model built for

prediction of stock is to reduce risk (minimize error).

Models built for prediction by using these (Neural

Networks, Genetic algorithms etc.) techniques showed

successful For many past years different techniques

are being used for predicting systems. Few of

techniques will be defined here are Time series,

Neural Networks, Hybrid techniques.

2.1 Time Series

Ordered lists of values of one parameter or

variable, which are provided in equal time intervals

called time series. The prediction is the continuous of

pattern over time like growth in sale, stock market

analysis or gross national product (Gosasang et al.

2010). The common time series methods are

i. ARMA (Auto Regression Moving Average)

ii. ARIMA.(Auto Regression Integrated Moving

Average)

ARMA is combination of AR (auto

regression) and MA (moving average) models. Used to

predict future values. ARIMA is variation of ARMA.

Any Time series is stationary if mean and variance is

constant. Otherwise, it’s non-stationary. Non

stationary time series are difficult to predict these are

full of noise. Stock prices are characterized as non-

stationary and for that purpose de-noising techniques

are used for removing noise from data. [4]

2.2 Artificial Neural Networks (ANN)

In 1943, W.S.Mcculoch and W. Pitts

established Neural Network (NN) and its mathematical

model. The established model was named MP model.

Than MP model was used to put forward the network

construction method and neuron’s formalization

mathematical description and proved that each single

neuron performs logic function, so a new time of

Neural Network research began. Neural network are

used in pattern recognition, prediction etc.

Network is a set of interconnected nodes. A node is a

computational unit which receives inputs and after

processing produces output. The flow of information

between nodes can be determined by the connections

between the nodes. [2] The detailed introduction to

ANNs is given by [12]. The basic structure of ANN

with one hidden layer is given in fig . 1.

Input layer

Hidden layer

Output layer

Fig . 1 Artificial Neural Network

The basic architecture of ANN is Multi- layer

feed forward used by [2]. In this architecture,

information flows in one direction only (from input to

output). It consists of one input , one or more hidden

and one output layer. Inputs are sent into units in input

layer than weighted output from these units is taken as

input in next hidden layer, weighted output of this

layer is sent as input in next hidden layer and so on.

Until output of last hidden layer is send to output

layer. Output layer gives the predicted output. Back

propagation algorithm is used for learning process in

NN. In this algorithm, network is trained by repeatedly

comparing the output and target output. And

minimizing error. log-sigmoid is used as an activation

function. To check the error, mean square error is

used. A very simple approach is given in [2]. The

author used very general and simple architecture of

ANN. Author performed pre-processing on data.

Author used Relevance Attribute Analysis method to

remove unwanted attributes and then applied min-max

normalization for normalizing data. That decrease risk

of error or producing in sufficient answer.

2.2.1 Multi-Layer perceptron with back

propagation learning algorithm

Artificial Neural networks are applied in

many different ways for stock prediction. Multi-layer

perceptron (MLP) is used with supervised learning

algorithm (back-propagation). It has ability to solve

non-linear problems; stock prices usually used are

non-linear. MLP works as it first initialize weights of

all network and train the training pattern then get

output then error is propagated by using back-

propagation. Basic model of MLP with back

propagation is used in [10] to analyze the importance

of Neural Networks for stock prediction. They used

five attributes as input previous close price, close

Zahid Iqbal et al Int. Journal of Engineering Research and Applications www.ijera.com

ISSN : 2248-9622, Vol. 3, Issue 6, Nov-Dec 2013, pp.855-867

www.ijera.com 857 | P a g e

price, open price, low price, and high price.

Correlation (R), Average Absolute Error (avg abs),

Max Absolute Error (max Abs), Root Mean Square

Error (RMS), Accuracy, Confidence internal are the

performance measures used to measure error. The

model was applied on Indian stock Market. TCS

company data was taken to test this model. This Model

gives 20% of Accuracy between target output and

calculated output. This model is made to predict in

short-term. This model can be used further for error

percentage reduction. [10].

In ANN, a large number of historical data

required. Accuracy and result network becomes

complex. Results statical relevance is required. Best

topology of network is unknown. NN requires a

careful data design and systematically analyzed. There

are many different models of Neural Networks made

to remove/cover these flaws. To overcome these flaws

advance/new approaches of NN are become in use.

2.2.2 Recurrent Neural Network with wavelet

transforms

Recurrent neural network (RNN) is type of

Neural Networks with back-loop in it. Recurrent

neural network has advantage over ANN that it saves

patterns with time.

RNN are applied for stock market prediction

by [4] with Wavelet transform as pre-processing

technique to remove noise from data. Recurrent neural

networks are available in two categories, Elman and

Hopfield [4].Hopfield networks are less used in

practice. There can be spurious stable points in

Hopfield network that may lead to incorrect results.

The Elman network commonly is a two-layer

network with feedback from the first-layer output to

the first layer input. This recurrent connection allows

the Elman network to both detect and generate time-

varying patterns. The Elman network has ‘tansig’

neurons in its hidden (recurrent) layer, and ‘purelin’

neurons in its output layer. Algorithms used for

training data .Least Mean Squared (LMS) algorithm

which involves Gradient descent with momentum and

batch learning rate back-propagation. Least Mean

Squared (LMS) algorithm which involves Gradient

descent without momentum and batch learning rate

back-propagation. It is also observed that Least Mean

Squared (LMS) algorithm which involves Gradient

descent with momentum and batch learning rate back-

propagation performs better. It is observed that RNN

gave different results when applied on different data.

From this one can say that performance of network

relay on data being used for it.

2.2.3 Layered Recurrent Neural Network

LRNN consist of two parts

i. Recurrent layers (for temporal patterns)

ii. Feed-forward part

In LRNN, input passes through the net more

than once so it helps to learn temporal patterns. It is

due to recurrent layers and new input and previous

temporal patterns are given to feed-forward part as

input. Basic structure of LRNN is given in fig. 2

Different variations of ANN are tested by

[16] for stock price prediction. Models compared by

author are Back-Propagation Neural Network (BPN),

Radial Basis Function Neural Network (RBFNN),

Generalized Regression Neural Networks (GRNN),

and Layered Recurrent Neural Networks (LRNN). It is

observed from results that LRNN outer-perform than

other three. And BPN performs better than other two.

LRNN is type of RNN. They have dynamic behavior.

Due to the dynamic behavior of stock market, RNN

has been found an attractive tool for performing

nonlinear time series prediction

Input Input

Hidden Layer

Output layer

Fig. 2 Layered Recurrent Neural Network

2.2.3 Echo State Network

Echo state networks, Subset of RNN. It can

be trained comfortably. This network is developed in

the emerging field known as reservoir computing. In

reservoir computing, the recurrent connections of the

network are viewed as a fixed reservoir used to map

inputs into a high dimensional, dynamical space–a

similar idea to the support vector machine. For RNN,

architecture and supervised learning is provided by

ESN. Finding random large, fixed RNN is the main

task of ESN.in ESN, input travels through the network

more than once. This improves the output results. Only

output weights are trained in echo state network. With

a sufficiently high dimensional space, a simple linear

decode can be used to approximate any function

varying with time. ESN are used for financial time

series forecasting by [13]. Author applied ESN for

forecasting and compared its performance with

Kalman filter (also used in forecasting process).

It is observed from [13] that ESN outer

perform than Kalman filter. The Kalman filter uses

linear dynamical model. That model estimates the

process state recursively by reducing error (Mean

square error). Quick changes in the stock price can be

captured by ESN. Whereas, Kalman filter is unable to

capture. Powerful black box method is used by ESN

for modeling time dependent phenomena. Black box

methods are appealing because they require no prior

assumptions or knowledge of the underlying dynamics

of the time series data. The Kalman filter does not

have enough features to predict prices and capture

rapid movement in the stock price.

This model is checked on S&P500 indexes. Input

features used in this model are current price, trading

volume, and the S&P500 price.

Zahid Iqbal et al Int. Journal of Engineering Research and Applications www.ijera.com

ISSN : 2248-9622, Vol. 3, Issue 6, Nov-Dec 2013, pp.855-867

www.ijera.com 858 | P a g e

Different models of ANNs are evaluated to

test the effectiveness of neural networks for stock price

prediction. MLP, Dynamic Artificial Neural Networks

(DAN2), and hybrid neural networks using

generalized auto regression conditional

heteroscedastticity(GARCH) were analyzed by[15]. It

is observed that MLP performs better than other two

techniques.

Gradient descent for stock prediction is

applied by [7] and compared with Recurrent Neural

Network for stock market prediction. Gradient descent

back-propagation learning algorithm is used for

supervised training of Neural Network. Learning rate

is required for gradient descent algorithm. To check

whether algorithm is working properly convergence

test is taken. If learning rate is too small then

convergence is slow, if learning rate is too large than

may not convergence. To make his model work

appropriately, [7] performed pre-processing using R/S

analysis method. As quality of input data effects

output. In output, model gives newer open price.

Sigmoid transfer function is used in it. Mean square

error is calculated to check the model. This Model is

applied on NASQAD stock. Two models (Multi-Layer

feed forward and Recurrent Neural Network (RNN))

are built by using Gradient descent back-propagation

Algorithm [7]. It is observed that RNN outer performs

than ANN.

2.3 Hybrid Techniques

From last few year researchers move their

attention to merge different techniques to get more

optimal results. Our next section covers some of

hybrid techniques used for stock prediction. Here we

analyze few hybrid techniques used for stock

prediction. Fuzzy logic and genetic programming are

widely used with integration of other techniques for

stock price prediction. Fuzzy logics are used to build

rules for prediction on the basis of past knowledge

available.

2.3.1 Using GA with different ANN techniques

Genetic Programming (GP) first introduced

by Koza (Koza 1992) by developing symbolic

regression. It is a computational optimization tool.

This tool is used to derive optimal model from time

series data. Reproduction, crossover, and mutation are

main operation of GP. Fitness Function is the main

factor on which final population based. The process of

switching nodes in a population is known as cross

over. For making new generation based on fitness

function GP reproduces. The task of mutation is to get

and substitute the information of one node with those

individuals. To evaluate new generation fitness

function used (Langdon & Poli 2002).

Genetic Algorithms (GA) are used with two

different types of NN to improve performance of

network. GA’s are used here to identify input variables

and weights for these variables [28][31]. Time delay

Neural Networks (TDNN) and Adaptive time delay

neural network (ATNN) are used here for their ability

for saving temporal patterns. GA-TDNN and GA-

ATNN are proposed by [28] for forecasting stock. It is

observed from result given by author that GA-TDNN

and GA-ATNN outer performs than individual TDNN,

ATNN and RNN.

2.3.2 Integration of genetic fuzzy systems and

artificial neural networks

Integration of genetic fuzzy systems and

artificial neural networks for stock price forecasting is

an example of such hybrid technique developed by

combining Neural Network, fuzzy logic and genetic

programing. In this model three techniques are used to

build better prediction system. There are three main

stages of this model. Variable selection is first phase

of this model. Stepwise regression analysis (SRA) is

applied for key variable selection. Second phase is to

divide data, self-organization map (SOM) neural

network is used for this purpose. SOM reduce

complexity of data by dividing it into useful sub part.

Last phase is to build GFS for stock price prediction,

data clusters are sent to GFS for forecasting purpose

[24]. Stepwise regression analysis (SRA) finds out

the set of independent factors. SRA is recursive

function. On every step, a variable enters or remove

from model. SOM clustering is being used to combine

related data. From previous literature made on

clustering methods it is observed that SOM clustering

performs better than other techniques of clustering

(hierarchical). Next phase of this model is to build, a

genetic-fuzzy system. Mamdani-type fuzzy rule based

system to deal with stock price forecasting problems.

There are two general steps of this evolutionary

process used to make knowledge based (KB) of fuzzy

rule based system. First step is to evolve rules (through

genetic algorithms). And second step is to tune

database of fuzzy system.

Fig. 3 illustrates main steps of this model.

Data

collecti

on

Stepwise regression

Data Clustering

Construct GFS

Generate Forecast

Fig. 3. Integration of GF systems and ANN

Zahid Iqbal et al Int. Journal of Engineering Research and Applications www.ijera.com

ISSN : 2248-9622, Vol. 3, Issue 6, Nov-Dec 2013, pp.855-867

www.ijera.com 859 | P a g e

2.3.3 Rough Set-Neural Network

Another technique used for making stock

market decisions is a hybrid Artificial Neural Network

and Rough Set model. Used to find best sell and buy in

Dhaka Exchange. In this model, Neural Networks are

used for its ability to predict (learn from knowledge)

and Rough set is used for its ability of Powerful Rule

Extraction.

In Rough Set (RS), Decision Table is used to

organize data. This table contains attributes and data

elements. Where attributes are placed in columns and

data elements are placed in rows. Analysis of limit

Discernibility is Main theme of Rough set Model.

Three regions are defined by RST. These regions base

on equalent classes induces by attribute values. These

regions are lower approximation, upper

approximation, and boundary. Rough set is here to

reduct data and extract rules from data for prediction.

Johnson’s reducer algorithm is used by [20] to find all

reducts and Levenberg-Marquardt Back-Propagation

algorithm is selected to train ANN. Confusion matrix

is used to analyze performance of this model.

This technique is applied on Dhaka Stock Exchange.

And its Performance is compared with individual RS

and ANN. It is observed that Hybrid RS-ANN is better

than alone ANN and RS.

2.3.4 Independent component analysis (ICA) with

Back Propagation Neural Network (BPN)

As noticed in above mentioned techniques

that data is full of noise. Noise in data could lead over-

fitting and under-fitting problems. Another method to

remove noise from data with combination of Neural

Networks is Independent component analysis with

Neural network (ICA-BPN). There are two basic steps

of this technique. One is to get independent

components from data and second is to input these

data elements to neural network architecture as input.

Author compared this technique with wavelet-BPN

and single –BPN and observed that ICA-BPN outer

performs than other two. From all above mentioned

methods it is concluded that using ANNs alone have

flaws in it.

2.3.5 Adaptive Neuro-Fuzzy Inference system

(ANFIS) for Stock Prediction

Another technique being in use is ANFIS. A

neuro-fuzzy system is created by using this method.

These systems are built by using Adaptive neuro-fuzzy

based system controller. This controller is further used

to control the stock market process. In Basic

architecture of the model, Input is mapped to input

membership function. Then that Input membership

functions are mapped to rules. These rules are then

further used to set output. And then like input, this

output is mapped to output membership functions.

ANFIS are applied for stock market short

trends by [24]. Gaussian-2 shaped membership

functions are chosen over bell shaped Gaussian and

triangular ones to fuzzily the system inputs due to the

lowest RMSE [24]

The ANFIS model is a Sugeno first order

model with two inputs and one output. Five Gaussian-

2 membership functions correspond to each input, very

small, small, medium, big and very big. The

combination of two inputs and five membership

functions creates twenty five rules (5)2

The PR-ANFIS model is a Sugeno first order

model with three inputs and one output. Three

Gaussian-2 membership functions small, medium, and

big correspond to each input, for a total of twenty

seven (3)3 rules [24].

2.3.6 ANFIS with indirect Approach TKS-fuzzy

based

ANFIS is used for stock prediction, by

applying all this method on a rule based. To analyze

stock market a complex system is built. Neuro-Fuzzy

Inference System followed by a Takagi–Sugeno–Kang

(TSK) type Fuzzy Rule Based System is developed for

stock price prediction. Technical indexes are used as

input and output of this model is linear combination of

these indexes. To identify number of rules Fuzzy C-

Mean (FCM) Clustering is used. Gaussian function is

used in premise section. FCM algorithm is used to

define number of rules. Membership degree is

assigned to the output of last step. At last step, neuro-

fuzzy inference system is used to tune parameters of

system. The forecasting capability of the system is

greatly improved by applying this technique [25]. This

model is applied on Tehran stock exchange indexes.

After all above literature it is observed that

(Feed-Forward Neural Network) NN are used mostly

for prediction. Different models are built using Neural

Networks. NN are preferred for stock prediction

because they can learn from past data. And they map

the input to output. From a survey in 2012 it is

concluded that Neural Networks are used 80% for

prediction system. It is analyzed from above literature

that every hybrid technique used Neural Network. It is

concluded from previous study that for prediction

recurrent type of Neural Networks are preferred.

Comparisons and results of different models shows

that Recurrent Neural Network (RNN) is

comparatively better then (Feed-Forward Neural

Network) NN. But RNN are less used because it has

complex structure and it takes more memory. Major

point analyzed from the study is importance of data

pre-processing. Different models used different data

preprocessing methods to normalize their data. After

above literature, we took three models (Feed-Forward

Neural Network (NN), Layered Recurrent Neural

Network (LRNN), wmspca-feed forward neural

networks and apply them. Firstly, we apply simple

feed-forward neural network and then we apply a de-

noising method (wmspca) on simple feed-forward

neural network and compare their performance.

Zahid Iqbal et al Int. Journal of Engineering Research and Applications www.ijera.com

ISSN : 2248-9622, Vol. 3, Issue 6, Nov-Dec 2013, pp.855-867

www.ijera.com 860 | P a g e

III. METHODOLOGY

This research compares different models of

Neural Networks being in use for stock price

prediction. Here we will apply few methods and

compare their results. Neural Networks are chosen for

this purpose. Neural Networks are selected to

implement on the basis of previous literature. From

year 2000-2012 Neural Networks are used 80% for

stock prediction In above literature it is also observed

that performance of Recurrent Neural Network (RNN)

in better for prediction when compared with Feed-

Forward Neural Network. From above literature, it is

observed that data pre-processing (de-noising) has

better impact on output. So, we will use de-noising

technique with feed-forward neural network. All this

working is performed by using tool MATLAB, Neural

Network toolbox is used for simulation. Predefined

methods/functions are used for this purpose.

1. Data collection

2. Built different models (Feed-Forward Neural

Network (NN) , wmspca- feed-forward neural

network , Layered Recurrent Neural Network

(LRNN))

3. Check on different data sets

4. Compare their output performance on the basis

of their performance measure and time

consumed.

Fig. 4 shows flow chart of main steps of this

methodology.

At first, data sets are collected for

experiment. Data is collected from yahoo.finance.com

and google.finance.com, PSO (Pakistan State Oil)

and S&P500 data is collected for these experiments.

After collecting data, we applied three models using

MATLAB. For checking performance of these

techniques, we took one month data of PSO as input to

check models. After that we increase the amount of

data with 6 month data and again test models.

After getting results, techniques will be

compared on the basis of performance measure used

and time taken by a technique to give output.

3.1 Implementation

As, basic aim of applying these models is to

compare their performance. So some features will

remain same for all models. These elements and their

values are defined in tab.1

From research, it is observed that levenberg-

Marquad. It is better training function when compared

with other training function (gradient, resilient back-

propagation). Whenever we use any model for

prediction, our aim is to minimize error.

Performance measure used for checking

output is normalized mean squared error with

regularization performance function.

Applied models are feed-forward neural

network, layered recurrent neural network and

wmspca- feed-forward neural network.

3.1.1 Feed-Forward Neural Network

Firstly, feed-forward net is created. This

function built a feed forward net. Then we set input

and target data. and train network. Training method

takes input data and network used. Here data is

divided into three parts (train, test, validate). We use

60% data to train the network, 20 % for testing and

20% for validation. Fig. 5 shows flow chart of feed-

forward neural network.

Fig. 4 Methodology

3.1.2 Layered Recurrent Neural Network

After applying feed-forward Neural Network,

Layered Recurrent Neural Network (LRNN) is

implemented. LRNN function creates a layered

recurrent net by taking input data, target data, no. of

neurons to create the net. (NOTE: we can also set

TABLE 1

RESULTS OF DIFFERENT TECHNIQUES ON S&P500 DATASET

Factors

Values

Input data

PSO/S&P500

Training Function

Levenberg-Marquardlt

Performance measure

Training data

Validating data

Testing data

Msereg

60%

20%

20%

Table 1 holds factors and their values that are same for all applied

techniques. Input data is sub divided into 3 categories. same data sets in

different techniques.

Zahid Iqbal et al Int. Journal of Engineering Research and Applications www.ijera.com

ISSN : 2248-9622, Vol. 3, Issue 6, Nov-Dec 2013, pp.855-867

www.ijera.com 861 | P a g e

other values of the network at the time of creating this

net). After creating network we use same methodology

used in feed-forward neural network to train network.

Fig. 6 shows flow chart of layered recurrent neural

network.

3.1.3 Wmspca-Feed-Forward Neural Network

We used a wsmpca (multiscale principal

component analysis) to pre -process data. This method

is use for pre-processing data. Now input this pre-

processed data into Feed-Forward Neural Network.

Fig7 shows flow chart of feed-forward neural network.

This method takes input matrix, levels of

wavelet decomposition name of wavelet and principle

components. And returns a simplified version of input

matrix X obtained from the wavelet-based multi-scale

Principal Component Analysis (PCA). This wavelet

decomposition is performed using the decomposition

level ‘LEVEL’ and the wavelet ‘WNAME’. Now input

this simplified data into Feed-Forward Neural

Networks.

Start

Input financial

data

Create Network Set parameters of

Network

Train Network

Output

End

Fig. 5 Feed-Forward Neural Network

Start

Input financial

data

Create Network Set parameters of

Network

Train Network

Output

End

Fig. 6 Layered Recurrent Neural Network

Start

Input financial

data

Create Network Set parameters of Network

Train Network

Output

End

Wmspca De-noising

Fig. 7 wmspca-Feed-Forward Neural Network

Zahid Iqbal et al Int. Journal of Engineering Research and Applications www.ijera.com

ISSN : 2248-9622, Vol. 3, Issue 6, Nov-Dec 2013, pp.855-867

www.ijera.com 862 | P a g e

IV. EXPERIMENTS AND RESULTS:

After creating models, we get their results in

form of graphs and values. Results are sub-divided

according to the data sets used to check above

mentioned models.

Our result holds different parameters while

training. Here is short introduction of these

parameters. Parameters used are epoch, time, gradient,

performance.

Epoch: is number of iterations taken by a network to

train data. Training method perform training, testing

and validation of data in single method

Time: shows time interval taken by a network while

training data.

Performance: shows performance measure.

Performance measure shows the error value given by

any network. If the value of this performance is small

it shows that network works properly. If value of this

performance measure is large then more training is

required.

Gradient: is learning rate. It is speed of learning. If

learning rate is small than training will be slow. If

learning rate is large than learning will be fast but may

not give better results.

4.1 Results on PSO (PAKISTAN STATE OIL)

dataset:

Fig. 8 and 10 holds results of Feed-Forward Neural

Network,

Fig. 11 holds results of Layered Recurrent Neural

Network,

Fig. 14 and 15 holds results of wmspca-Feed-Forward

Neural Network when applied on PSO data.

Fig. 8. Show performance measure at y- axis and

number of epochs on x-axis. This figure shows that 49

epochs are required to train network without over

training.

Fig.9 plots the data fitting, on 4 different stages of

data,

i. When data is training

ii. When testing data

iii. When validating data

iv. When catching target

v.

Fig. 9 This plot show values of ‘R’ (regression). Basically,

regression shows relation between target and selected input

data. From provides most probable target value. This shows

the state of data fitting while training, testing and validating.

Value of ‘R’ near to ‘1’ shows that data fitting is better

performed

Fig. 10. Performance measure at y- axis and number

of epochs on x-axis. This figure shows that how many

epochs are required to train network without over

training

Zahid Iqbal et al Int. Journal of Engineering Research and Applications www.ijera.com

ISSN : 2248-9622, Vol. 3, Issue 6, Nov-Dec 2013, pp.855-867

www.ijera.com 863 | P a g e

Fig. 11. Show performance measure at y- axis and

number of epochs on x-axis. This figure shows that

how many epochs are required to train network

without over training

Fig. 12. This plot show values of ‘R’ (regression).

Basically, regression shows relation between target and

selected input data. From provides most probable target

value. This shows the state of data fitting while training,

testing and validating. Value of ‘R’ near to ‘1’ shows that

data fitting is better performed

Fig. 13 Show performance measure at y- axis and

number of epochs on x-axis. This figure shows that

how many epochs are required to train network

without over training

Fig. 14. Show performance measure at y- axis and

number of epochs on x-axis. This figure shows that

how many epochs are required to train network

without over training

Fig. 15 Show performance measure at y- axis and

number of epochs on x-axis. This figure shows that

how many epochs are required to train network

without over training

Zahid Iqbal et al Int. Journal of Engineering Research and Applications www.ijera.com

ISSN : 2248-9622, Vol. 3, Issue 6, Nov-Dec 2013, pp.855-867

www.ijera.com 864 | P a g e

Fig. 16 This plot show values of ‘R’ (regression).

Basically, regression shows relation between target and

selected input data. From provides most probable target

value. This shows the state of data fitting while training,

testing and validating. Value of ‘R’ near to ‘1’ shows

that data fitting is better performed.

4.2 Comparison

TABLE2 contain results of Feed-Forward Neural

Network. In this experiment we took one month data

of PSO and 6 month data of S&P500, we observed

that when amount of data increased , number of

iteration and time of execution also increases.

TABLE 3

LAYERED RECURRENT NEURAL NETWORK (LRNN)

Dataset

Epochs

Time

MSEREG

(performance

Measure)

ggg

PSO

36

00:06:22

0.05

S&P500

263

01:09:57

151

TABLE 3 holds results of LRNN own both data

sets. It is observed that LRNN takes more time but

less number of iterations.

TABLE 4

WMSPCA-FEED-FORWARD NEURAL NETWORK

Dataset

Epochs

Time

MSEREG

(performance

Measure)

ggg

PSO

11

00:00:07

0.02

S&P500

19

00:00:35

9.64

TABLE 4 holds results of wmspca-NN results. Visible

changes can be observed in time, epochs and error in

comparison with TABLE 2 and 3.

TABLE 5

RESULTS OF DIFFERENT TECHNIQUES ON S&P500 DATASET

Techniques

Epochs

Time

MSEREG

(performance

Measure)

ggg

Feed-Forward

Neural Network

1000

00:31:53

21.9

Layered

Recurrent

Neural Network

263

01:09:57

151

Wmspca- feed

forward Neural

Network

19

00:00:35

19

TABLE5 holds different techniques results on S&P500 data.

It shows time, performance and epochs used by different

techniques on same data set. It is observed from results that

data pre-processing methods enhance performance of NN

and give better results.

TABLE 6

RESULTS OF DIFFERENT TECHNIQUES ON PSO DATASET

Techniques

Epochs

Time

MSEREG

(performance

Measure)

ggg

Feed-Forward

Neural Network

48

00:00:19

0.15

Layered

Recurrent

Neural Network

36

00:06:22

0.05

Wmspca- feed

forward Meural

Network

11

00:00:07

0.02

TABLE6 holds results on PSO data set. This table holds

values of time , msereg and epochs to make the comparison

easy. From this table one can easly conclude that wmspca

outer performs than other two methods.

Zahid Iqbal et al Int. Journal of Engineering Research and Applications www.ijera.com

ISSN : 2248-9622, Vol. 3, Issue 6, Nov-Dec 2013, pp.855-867

www.ijera.com 865 | P a g e

Fig. 17. Error measure by three mentioned techniques

on both data sets. It is observed that wmspca-feed-

forward neural network provides smallest error for

both data sets.

It is observed that wmspca-feed-forward

neural network use Fewer epochs for both data sets.

From all above results, it is observed that wmspca-

feed-forward neural networks outer perform than other

two techniques. Wmspca-feed-forward neural network

used less iteration, less time and small error measure.

It is analyzed from results that using appropriate de-

noising scheme gives better results.

V. CONCLUSION

Different machine learning techniques are

available and being used for stock market prediction.

It was observed from the comprehensive literature

survey and results of applied techniques that, although,

many state of the art techniques are available but data

pre-processing and post-processing have great effect

on results. It is also observed that Recurrent Neural

Network (RNN) performs better than Artificial Neural

Network (ANN) for prediction and Layered Recurrent

Neural Network (LRNN) performs better than Feed-

Forward Neural Network (NN). Layered Recurrent

Neural Network (LRNN) takes less iteration, but more

time. Time consumption factor of LRNN makes it odd

to use. Wsmpca was applied as pre-processing on

Feed-Forward NN and it was observed that pre-

processing methods enhance results of Feed-Forward

Neural Network (NN).

Applying Independent Component Analysis

or Rough Set on Recurrent Neural Network (RNN)

may improve the performance of RNN.

Similarly, Kalman filter may also be used with Echo

State Network (ESN) to improve its performance.

REFERENCES

[1] R.K. Dase, D. D. Pawar and D.S.

Daspute(2011) Methodologies for Prediction

of Stock Market: An Artificial Neural

TABLE 7

COMPARISON OF PERFORMANCE MEASURE (MSEREG)

Dataset

Msereg

in feed-

forward

NN

Msereg in LRNN

Msereg in

Wmspca-feed-

forward neural

network

ggg

PSO

0.15

0.05

0.02

S&P500

21.9

151

9.64

TABLE7 holds performance measure values on both

data sets when applied on above mentioned models. It is

clear that wmspca-feed-forward give small value of

performance measure.

TABLE 8

COMPARISON OF TIME CONSUMED

Dataset

Time

in feed-

forward

NN

Time

in LRNN

Time in

Wmspca-feed-

forward neural

network

ggg

PSO

00:00:19

00:06:22

00:00:07

S&P500

00:31:53

01:09:57

00:00:35

TABLE8 shows time consumption on both data sets in

three applied techniques.

TABLE 9

COMPARISON OF NO. OF EPOCHS

Dataset

epochs

in feed-

forword

NN

epochs

in LRNN

epochs in

Wmspca-feed-

forward neural

network

ggg

PSO

48

36

11

S&P500

1000

263

19

TABLE9 holds number of epochs required for training

data sets in three applied techniques.

Zahid Iqbal et al Int. Journal of Engineering Research and Applications www.ijera.com

ISSN : 2248-9622, Vol. 3, Issue 6, Nov-Dec 2013, pp.855-867

www.ijera.com 866 | P a g e

Network. International Journal of Statistika

and Mathematika, volume (1)

[2] Parkash Ramani , Dr. P.D.Murarka (2013)

Stock Market Prediction Using Artificial

Neural Network. International Journal of

Advanced Research in Computer Science and

Software Engineering, Volume(3)

[3] Dase R.K. and Pawar D.D (2010)

Application of artificial Neural Network for

stock market predictions: A literature review.

International Journal of Machine Intelligence.

Volume (2), issue(2)

[4] Asim Maqbool, Umer Malik, Mohsin Fazal,

MutteAhmed(2005), Stock Market

Prediction Software using Recurrent Neural

Networks.

[5] Hykine S(1994) Neural networks: A

comprehensive foundation, Macmillan

college Publication, New york.

[6] Clarence N.W.Tan and Gerhard

E.Witting(1993), A study of parameters of

Back-Propagation for Stock Price Prediction

Modelin proc, first New ZealandInt. Two

Stream conf. Ann and Expert systems.

[7] Arka Ghosh()Comparative study of Financial

Time Series Prediction By Artificial Neural

Network with Gradient Descent Learning

[8] Kim, K-J & Han.I (2000), genetic algorithm

approach to feacture discretization inANN for

the prediction of Price index, Expert System

with Applications

[9] Dynamic financial forcasting, with

automatically induced fuzzy associations, In

Proceeding of the 9th International conference

on Fuzzy Systems.

[10] K.K.Suresh Kumar, Dr.N.M.Elango, kongu

Art and Science College (2012) performance

analysis of stock prediction using ANN,

Global journal of Computer Science and

Technology, Volume(12), issue 1

[11] Leonardo Noriega, school of computing,

staffordshire University,(2005), Multi-layer

perceptron Tutorial

[12] Andrej Krenker, Janez Bešter and Andrej

Kos Consalta d.o.o.Faculty of Electrical

Engineering, University of Ljubljana

Slovenia, introduction to Artifical Neural

Networks www.intechopen.com

[13] Armando bernal, Sam Fok, Rohit

Pidaparthi(2012) financial time series

prediction with Recurrent Neural Netwoks

[14] Chi-Jei-Lu(2010) integrating independent

component analysis based de-noising scheme

with Neural Network for Stock Price

Prediction, Expert System with Applications

[15] Erkam Guresen, Gilgun Kayakutlu, Turgrul

U.Daim(2011) , using Artificial Neural

Network Models in stock market index

prediction, Expert Systems with Applications

[16] Mrs. Simta Agrawal, Dr.P.D.Murarka(2013),

Stock price Prediction: Comparison of Short

Tem and Long Term Stock Price Forcasting

using Various Techniques of Artifical Neural

Networks,International journal of Advanced

Research in Computer Science and Software

Engineering volume(3), issue 6(june 2013)

[17] Emad W. Saad, Donald.C.Wunsch(1998),

Comparative Study of Stock Trend Prediction

Using Time Delay, Reccurent and

Probablistic Neural Nertworks, IEEE

transaction on Neural Networks, volume(9)

issue 6

[18] J. G. Agrawal1, Dr. V. S. Chourasia2,Dr. A.

K. Mittra (2013)State-of-the-Art in Stock

Prediction Techniques, International Journal

of Advanced Research in Electrical,

Electronics and Instrumentation Engineering

[19] Kryzysztof Pawlas, Davood Zall(2012),

Analysis of ForeCasting Methods and

Applications of Sysytem Dynamics and

Genetic Progrsmming: Case Studies on

Country Throughput,School of Computing at

Blekinge Institute Of Technology, sweden

[20] A.F.M.Khodadad Khan, Mohammad Anwer,

Shirpa Banik(2013), Market timing Decisions

by Hybird Machine Learning Technique: A

case Study For Dhaka Stock Market, Journal

of Computations & Modelling Volume(3)

no.2

[21] http://www.mathwork.com

[22] Paolo tenti (1996) , forcasting foreign

exchange rates using recurrent neural

networks, Applied Artificial intelligence

[23] Rough Sets : A Tutorial

[24] Esmaeil Hadavandi, Hassan Shavandi, Arash

Ghanbari (2010)Integration of genetic fuzzy

systems and artificial neural networks for

stockprice forecasting, Knowledge Based

Systems

[25] Akbar Esfahanipour, Werya Aghamiri(2010),

Adapted Neuro-Fuzzy Inference System on

Indirect approach TSK Fuzzy Rule Base for

Stock Market Analysis , volume(37)

[26] George S. Atsalakis, Kimon P.

Valavanis(2009)Forecasting stock market

short-term trends using a neuro-fuzzy based

methodology, Expert System With

Applications

[27] A.P.Papli´nski(2005), Neuro-Fuzzy

Computing.

[28] Hyun-jung Kim , Kyung-shik Shin(2007),

“Applied Soft Computing”, “A hybrid

approach based on neural networks and

genetic algorithms for detecting temporal

patterns in stock markets”, 7 (2007) 569–576

[29] Mohammad Ali Farid, Faiza Ather, Omer

Sheikh, Umair Siddiqui(2003), Modelling

and Forecasting Financial Time series,

Zahid Iqbal et al Int. Journal of Engineering Research and Applications www.ijera.com

ISSN : 2248-9622, Vol. 3, Issue 6, Nov-Dec 2013, pp.855-867

www.ijera.com 867 | P a g e

Comparison of Forecasting ability of Neueral

Networks, Genetic Programming and

Econometric Methods

[30] Howard Demuth, Mark Beale, Neural

Network Toolbox for use with MATLAB

(2002) by The MathWorks

[31] Safdar Ali, Farrukh Aslam. Khan and

Waseem Shahzad, "Intrusion detection using

bi-classifier-based genetic algorithm," ICIC

Express Letters, Vol. 7, No. 6(A), pp. 2147-

2153, December 2010. 1881-803x.

Zahid iqbal received the B.S.

degree in Computer Science from

University of Punjab and M.S.

degree in Computer Science from

NUCES, FAST University, Pakistan

in 2010 and 2012 respectively.

He was a lecturer with Department

of IT, University of Punjab, PK. Since 2012, he is a

Lecturer with the Faculty of Computing and IT,

University of Gujrat, Punjab, PK. His research

interests include evolutionary algorithms, swarm

intelligence, artificial neural networks, computational

intelligence in dynamic and uncertain environments

and real-world applications.

Waseem Shahzad received the M.S.

and Ph.D. degrees in computer

science from the National University

of Computer and Emerging Sciences,

Islamabad, Pakistan, in 2007 and

2010, respectively. Since 2010, he

has been an Assistant Professor with the National

University of Computer and Emerging Sciences. His

current research interests include data mining,

computational intelligence, machine learning, theory

of computation, and soft computing.

He has several publications to his credit.

Javed Anjum received the Phd

degree in Computer Science from

Middlesex University U.K. His

research interests include HCI and

wireless network. He has many

research publications.

Zafar Mahmood received the MSc degree in

Computer Science from Kohat University of Science

and Technology in 2007. Now he is doing MS in

computer science from University of Gujrat. He is

doing research in computational intelligence and

wireless network.

Rafia Ilyas received the MSc degree in Computer

Science from University of Gujrat in 2013. She is

doing research in the field of Neural Network.