neural network approach for stock prediction using ... vital idea to successful stock market...

8

Click here to load reader

Upload: vokhue

Post on 03-Apr-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Neural Network Approach for Stock Prediction using ... vital idea to successful stock market prediction is ... used Hidden Markov ... both the neural network based system and the nave

International Journal of Engineering Technology, Management and Applied Sciences

www.ijetmas.com July 2017, Volume 5, Issue 7, ISSN 2349-4476

636 Yuvraj Wadghule, Prof. I.R. Shaikh

Neural Network Approach for Stock Prediction usingHistorical Data

Yuvraj WadghuleSND COE & RC,Yeola

Prof. I.R. ShaikhSND COE & RC,Yeola

ABSTRACTIn today’s era the count of investor is increasing dayby day. For identifying the market risk and for the growth of profitthe market stock prediction is important factor. Peoples are using traditional theorems for predicting market behavior.But due to high risk in market and the world is advancing, accurate result matter for the profit. Different methods areused for predicting the market share price such as support vector machine, Regression, Sentiments from different socialwebsites like Twitter and Facebook which have some limitation. In this paper we are specifying the artificial neuralnetwork with back propagation and statistical regression .In this the historical data is used to train the neurons. Thenormalized value obtained to feed to neuron for training them is quite efficient. By using this method it will help theinvestor, trader to invest in market and exit from the market by using the historical data of the stock. This method willhave good accuracy for prediction of sharemarket.

Keywords: Stock Prediction, ANN, Regression, Support vector machine, Back Propagation.

INTRODUCTIONIndustry permits businesses to be traded publicly by selling shares of ownership of the company in a

public market. Stock market can affect the social mood to a great extent. An economy where the stock marketis on the hike is considered to be an upcoming economy. Rising prices of shares is generally linked withincreased business investment and vice versa. The prediction helps in decision making process whether to buyor sell a share. The vital idea to successful stock market prediction is to achieve best results and minimize theinaccurate forecast the stock price. It is veryimportant to predict the stock as it may lead to high profit or hugeloses that the buyer/seller has to bear. Forecasting stock indices is very difficult because of the marketvolatility that needs accurate forecast model. The stock market indices are highly fluctuating that’s fall thestock price or raising the stock price. Fluctuations are affecting the investor’s belief. Determining moreeffective ways of stock market index prediction is important for stock market investor in order to make moreinformed and accurate investment decisions.

Prediction of stock market is not a simple task, because of the variation in the behavior of the stockprice in short time period. Number of techniques are being used for stock market prediction. In last twentyyears artificial neural networks (NNs) have become one of these techniques. As the behaviorof stock pricevariation is highly complex, so it is not possibleto model a pure mathematical function for it. Forecastingstock indices is very difficult because of the market volatility that needs accurate forecast model. The stockmarket indices are highly fluctuating that fall the stock price or raising thestock price. Fluctuations areaffecting the investor’s belief.Determining more effective ways of stock market index prediction is importantfor stock market investor in order to make more informed and accurate investment decisions. Huge amount ofdata set is required for explaining a specific stock value. As stock market domain is unique and unpredictabledomain, there are different methods like statistical analysis, fundamental analysis and technical analysis witheach having different results. This methods cannot provide the accurate result in efficient manner. In this

Page 2: Neural Network Approach for Stock Prediction using ... vital idea to successful stock market prediction is ... used Hidden Markov ... both the neural network based system and the nave

International Journal of Engineering Technology, Management and Applied Sciences

www.ijetmas.com July 2017, Volume 5, Issue 7, ISSN 2349-4476

637 Yuvraj Wadghule, Prof. I.R. Shaikh

paper we are combining two techniques first one is regression for predicting values of any entity and secondone is back propagation using neural network.

REVIEW OF LITERATURER.K. and Pawar D.D. in [1] discussed the stock prediction methods to find out which is more effective

and accurate method so that a buy or sell signal can be generated for given stocks. Predicting stock index withtraditional time series analysis has proven to be difficult but artificial neural network may be suitable. Neuralnetwork has the ability to extract useful information from large set of data. The paper also discusses aliterature review on application of artificial neural network in stock market Index prediction. Halbert white in[2] reported some results of an on-going project using neural network modeling and learning techniques tosearch for and decode nonlinear regularities in asset price movements. Author, focus on case of IBM commonstock daily returns.

Tiffany Hui-Kuang and Kun-Huang Huarng in [3] used neural network for handling nonlinearrelationship and given a new fuzzy time series model to improve forecasting. The fuzzy relationship is used toforecast the Taiwan stock index. In the neural network fuzzy time series model is used for forecasting. Thedrawback of taking all the degree of membership for training and forecasting may affect the performance ofthe neural network.

B. Chauhan, U. Bidave, A. Gangathade, and S. Kale in [4] discussed the machine learning approachfor data mining to evaluate the predictive relationship of numerous financial and economic variables. A cross-validation technique was used to improve the generalization ability of several models. The author decides todeploy the forecast the stock dividends, transaction costs and individual-tax brackets to replicate the realisticinvestment practices. Sam Mahfoud and Ganesh Mani [5] propose financial forecasting using geneticalgorithms a new system that utilizes genetic algorithms (GAs) to predict the future performances ofindividual stocks. More generally, the system extends GAs from their traditional domain of optimization toinductive machine learning or classification. The overall learning system incorporates a GA, a niching methodand several other components.

For stock market prediction K. Senthamarai Kannan, P. Sailapathi Sekar, M.Mohamed Sathik and P.Arumugam [6] used diffrent data mining techniques. In the data mining the main thing is historic data thatholds the essential memory for predicting the future direction. From the historic stock market data investorsdiscovers the hidden pattern of the data that have predictive capability in the investment decisions. Using datamining technology. In financial time series prediction the prediction of stock market is regarded aschallenging task. We can estimate future stock price increase or decrease by the data analysis. Data analysis isalso one way of prediction. Five methods of analyzing stocks were combined to predict. Typical Price (TP),Relative Strength Index (RSI), Bollinger Bands, Moving Average (MA) and CMI are the proposed fivemethods. Combing these methods would be useful for predicting day’s closing price would increase ordecrease. Aditya Gupta and Bhuvan Dhingra[7] used Hidden Markov Model(HMMs) for the predicting thestock market. By using historical stock prices they present he Maximum a Posteriori HMM approach forforecasting stock values for the next day. For training the continuous HMM they consider the intraday highand low values of the stock and fractional change in stock values. Over all the possible stock values for thenext day this HMM is used to make a maximum posteriori decisions. By using some of the existing methodslike HMMs and Artificial Neural Networks using Mean Absolute Percentage error (MAPE). They test theirapproach on several stocks, and compare the performance. Finally they present an HMM based Maximum aPosteriori (MAP) estimator for stock predictions. The model uses a latency of days to predict the stock valuefor the (d + 1)st day. Using a previously trained continuous HMM MAP decision is made over all the possiblevalues of stock.

Nair, Mohandas and Sakthivel [8] proposes a decision tree rough set hybrid system for stock marketprediction presents the design and performance evaluation of a hybrid decision tree- rough set based systemfor predicting the next day’s trend in the Bombay Stock Exchange (BSESENSEX). This system outperformsboth the neural network based system and the nave bayes based trend prediction system.

Page 3: Neural Network Approach for Stock Prediction using ... vital idea to successful stock market prediction is ... used Hidden Markov ... both the neural network based system and the nave

International Journal of Engineering Technology, Management and Applied Sciences

www.ijetmas.com July 2017, Volume 5, Issue 7, ISSN 2349-4476

638 Yuvraj Wadghule, Prof. I.R. Shaikh

D. V. Setty, T. M. Rangaswamy, and K. N. Subramanya in [9] used the moving average (MA) method touncover the patterns, relationship and to extract values of variables from the database to predict the futurevalues of other variables through the use of time series data. The advantage of the MA method is a device forreducing fluctuations and obtaining trends with a fair degree of accuracy.

M. Suresh Babu, N. Geethanjali and B. Sathyanarayana in [10] used the data mining techniques used touncover the hidden pattern, predict future trends. Apart from segment size the ant to sub-time-series sizeaffects the system performance. Y.L. Hsieh, Don-Lin Yang and Jungpin Wu in [11] used data mining methodsfor association rule and sequential pattern mining. Association rule can be used to analyze the customerconsumption behaviors and find the patterns of buying habits

in the retailer business. The sequential pattern was used to help web viewers match their needs quickly. Theauthor said that the usage of the association rule and sequential pattern mining methods are extend of causalrelationship chain and improved the accuracy level.

PROBLEM STATEMENTAlthough there are various techniques implemented for the prediction of stock market. On the basis of

existing technique used for the future prediction of stock market a new technique for the prediction isproposed which provides close prediction of stock market. In this paper I have proposed the two methodswhich are combine and used for stock market prediction. As the study shows that only neural network whichlearn from historical data will provide better result but by applying regression method will provide good andmore accurate result.

SYSTEM ARCHITECTURETo provide the user the best result for predicting the stock prices and gaining the profit I have

proposed the working model that will be useful for prediction using historical data. The linear regressionmethod and Back propagation Neural network are applied are final result can be prediction as shown in belowfigure:

Fig. 1. Architecture of Proposed System

Page 4: Neural Network Approach for Stock Prediction using ... vital idea to successful stock market prediction is ... used Hidden Markov ... both the neural network based system and the nave

International Journal of Engineering Technology, Management and Applied Sciences

www.ijetmas.com July 2017, Volume 5, Issue 7, ISSN 2349-4476

639 Yuvraj Wadghule, Prof. I.R. Shaikh

Architecture of Proposed System consist of four basic modules and the working of each module is explainedin detail as below:

A. DATA COLLECTION AND PRE-PROCESSING

In data collection we are collecting the input data. The input data may be a csv file that may consist ofstock market record of recent few year which is our historical data .After data collection we are pre-processingthat input data file. Preprocessing is done on input csv file to eliminate following attribute.

Handle null and empty record by assigning new valuescomputed through linear regression. Invalid data records are replaced by valid and approximatedata records. The data records of non-interest are removed from thecsv file.

After preprocessing the Normalization on data is done. Normalization is statistical method tosmoothen the range of values in the numeric data records. Normalization with standard deviationtransformsvariable data range into -3 to 3.Normalization helps in machine learning where a small drift into input datasetaffects the results.

B. LINEAR REGRESSION

Regression predicts a numerical value. Regression performs operations on a dataset where the target valueshave been defined already. And the result can be extended by adding new information. The relations whichregression establishes between predictor and target values can make a pattern. Thispattern can be used onother datasets which their target values are not known. Therefore the data needed for regression are 2 part,first section for defining model and the other for testing model. In this section we choose linear regression forour analysis.

First, we divide the data into two parts of training and testing. Then we use the training section forstarting analysis and defining the model. Scatter plot of 80% out of data has been shown in (figure 1) withtaking this into consideration that the (Average) parameter is the mean of the prices of Open, Low, High andclose. Scatter plot has been shown with just the Average parameter in order to be simpler.

Fig. 2. LINEAR REGRESSION LINE

C. ANN NETWORK USING BACK PROPAGATION

Artificial Neural Networks (ANN) actually has the potential to tell apart unknown and hidden patterns ininformation which may be terribly effective for share market prediction. BP network is that the back-propagation network. It’s a multilayer forward network, learning by minimum mean sq. error. It may beemployed in the sphere of language integration, identification and adaptation management, etc. BP network is

Page 5: Neural Network Approach for Stock Prediction using ... vital idea to successful stock market prediction is ... used Hidden Markov ... both the neural network based system and the nave

International Journal of Engineering Technology, Management and Applied Sciences

www.ijetmas.com July 2017, Volume 5, Issue 7, ISSN 2349-4476

640 Yuvraj Wadghule, Prof. I.R. Shaikh

semi supervised learning. Initial of all, artificial neural network has to learn an exact learning criteria, so itwill work. If the result yielded by network is wrong, then the network ought to scale back the chance ofcreating identical mistake next time through learning. This paper uses data processingtechnique to checkhistorical information concerning share market in order that it will predict the desired values a lot ofaccurately.

D. PREDICTION

This module refers to extract outcomes from both (hybrid) approaches of linear regression and ANNand finally predict the most accurate value. The accuracy is measured in training phase and then used tocontrol the threshold of prediction for every sample in testing phase.

ALGORITHM USED FOR IMPLEMENTATION

Neural network using Back Propagation Accept input sample Perform its weighted summation. Apply it to input layer neurons. Process all inputs at each neuron by transfer function to get individual. Hidden layer and repeat 1,2,3,4 steps pass it as an input to all neurons of for hidden layer neurons. Pass

output of hidden layer neurons to all output layers and repeat 1,2,3,4 steps to get final output.

Display the final output.

MATHEMATICAL MODELError calculation: Calculating Root Mean Square, Let RMS is denoted as Root Mean Square,E is denoted as Error of difference between actual value and predicted value GE means Global ErrorUpdating, error value,

Where, delta=expected value-actual value.

Activation function:SigmoidResult=1/Tan hyperbolic

RESULT & DISCUSSIONExpected result of stock analysis using regression method is shown below fig 3. The result by this method isnot so accurate. Then by applying ANN by back propagation the result is improved in fig 4 .But by combiningboth methods we will get the accurate prediction shown in fig. 5.

Table 1. RESULT USING REGRESSION ALGORITHMDate Open Price Close Price Difference26/12/15 8078.04 8116.03 37.93

27/12/15 0.87355 0.88082 72.7

28/2/15 8175.93 8375.45 199.52

29/12/15 8373.06 8149.01 224.05

1/1/16 8149.01 8000.86 148.15

Page 6: Neural Network Approach for Stock Prediction using ... vital idea to successful stock market prediction is ... used Hidden Markov ... both the neural network based system and the nave

International Journal of Engineering Technology, Management and Applied Sciences

www.ijetmas.com July 2017, Volume 5, Issue 7, ISSN 2349-4476

641 Yuvraj Wadghule, Prof. I.R. Shaikh

Fig:3

TABLE II: RESULT USING REGRESSION ALGORITHM

Date Open Price Close Price Difference Dec. Shifting26/12/15 0.87159 0.87522 0.00363 36.327/12/15 0.87355 0.88082 0.00727 72.728/2/15 0.88094 0.90000 0.01906 190.629/12/15 0.89977 0.87837 0.02140 240.001/1/16 0.87937 0.86422 0.01415 141.5

The proposed system will give us the following result.

Result of stock market analysis by linear regression.

Result by using Artificial Neural Network.

Accurate result after using both ANN and linear regression.

Fig 4

Page 7: Neural Network Approach for Stock Prediction using ... vital idea to successful stock market prediction is ... used Hidden Markov ... both the neural network based system and the nave

International Journal of Engineering Technology, Management and Applied Sciences

www.ijetmas.com July 2017, Volume 5, Issue 7, ISSN 2349-4476

642 Yuvraj Wadghule, Prof. I.R. Shaikh

TABLE IV:RESULT USING THE NEW PROPOSED APPROACH THAT IS REGRESSION

Date Open Price Close Price Difference Dec. Shifting26/12/15 0.89087 0.89391 0.00304 30.4

27/12/15 0.89472 0.90034 0.00562 56.2

28/2/15 0.90045 0.91999 4 0.01954 195.4

29/12/15 0.91975 0.89782 0.02193 219.3

1/1/16 0.89780 0.88331 0.01499 149.9

Fig 5

CONCLUSIONIn this paper, we tried to sum up the application of Artificial Neural Networks (ANN) for predicting

stock market with linear regression method Using both method provides a good and accurate result. Backpropagation algorithm is the best algorithm to be used in Feed forward neural network because it reduces anerror between the actual output and desired output in a gradient descent manner.

It will help private investors and stakeholders to invest in stock market. Calculation throughRegrogation gave us optimized normalized value. This approach is easy to understand and bears lesscomplexity. The future scope includes integration of Regrogation with cloud.

REFERENCES[1] Dase R.K. and Pawar D.D., Application of Artificial Neural Network for stock market predictions: A

review of literatureInternational Journal of Machine Intelligence, ISSN: 09752927, Volume 2, Issue 2,2010, pp-14- 17

[2] albert White, Economic prediction using neural networks: the case of IBM daily stock returns Departmentof Economics University of California, San Diego.

[3] Tiffany Hui-Kuang yu and Kun-Huang Huarng, A Neural network-based fuzzy time series model toimprove forecasting, Elsevier, 2010, pp: 3366- 3372.

[4] B. Chauhan, U. Bidave, A. Gangathade, and S. Kale, Stock Market Prediction Using Artificial NeuralNetworks, International Journal of Computer Science and Information Technologies, 2014, pp.204207.

[5] Sam Mahfoud and Ganesh Mani, Financial Forecasting using Genetic Algorithms, Applied ArtificialIntelligence, 10: pp. 543- 565, 1996

Page 8: Neural Network Approach for Stock Prediction using ... vital idea to successful stock market prediction is ... used Hidden Markov ... both the neural network based system and the nave

International Journal of Engineering Technology, Management and Applied Sciences

www.ijetmas.com July 2017, Volume 5, Issue 7, ISSN 2349-4476

643 Yuvraj Wadghule, Prof. I.R. Shaikh

[6] K. Senthamarai Kannan, P. Sailapathi Sekar, M. Mohamed Sathik and P. Arumugam ,Financial StockMarket Forecast using Data Mining Techniques, Proceedings of the International Multi Conference ofEngineer and Computer Scientists 2010 Vol 1, March 17-19,2010,Hong Kong

[7] Aditya Gupta, Non Student Member, IEEE and Bhuwan Dhingra, Non Student Member, IEEE, StockMarket Predictions Using Hidden Markov Models”

[8] Nair, Binoy B., V. P. Mohandas, and N. R. Sakthivel. ”A decision treerough set hybrid system for stockmarket trend prediction.” International Journal of Computer Applications 6.9 (2010): 16.

[9] D. V. Setty, T. M. Rangaswamy, and K. N. Subramanya, A review on Data Mining Applications to thePerformance of Stock Marketing, International Journal of Computer Applications, vol. 1, no. 3,pp. 33-43,Feb. 2010 [10] M. Suresh babu, N.Geethanjali and B. Sathyanarayana, Forecasting of Indian StockMarket Index Using Data Mining & Artificial Neural Nework, International journal of advanceengineering & application, 2011.

[11] Y.L.Hsieh, Don-Lin Yang and Jungpin Wu, Using Data Mining to study Upstream and Downstreamcausal relationship in stock Market