Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

2nd INTERNATIONAL CONFERENCE ON ADVANCED COMPUTING AND SOFTWARE ENGINEERING (ICACSE-2019)

A Fibonacci Heap based Ensemble Model for


Stock Price Prediction
Vijay Kumar Dwivedi1 and M.M. Gore2

Abstract—The prediction of stock price with high accuracy and consistency is a major challenge. A lot of research has been done to
predict the stock price. However, there is a scope of improvement in accuracy and consistency of the prediction. This article proposes
a Fibonacci heap based ensemble model that predicts the closing price of a stock for the next trading day. The proposed model is a
combination of different (time series and regression) models. The model computes the median of significant prediction models that are
organized in a Fibonacci heap data structure. The performance of this model is tested with the datasets of well-known eleven stocks.
The results prove the effectiveness of the proposed model over other traditional prediction models with respect to consistency and
accuracy.
Keywords: Accuracy, Consistency, Ensemble, Fibonacci Heap, Prediction, Stock Price



I. INTRODUCTION 1 Exchange (BSE), India. The datasets have been


incrementally updated for each trading day. The analysis of
Stock traders invest money in the stock market to earn
results infers that the proposed model performs better in
maximum profit. To maximize the gain, traders make
terms of accuracy and consistency as compared to other
strategies for trading. The volatility and dynamic nature of
prediction models for similar datasets.
stock price are the major challenges for the effectiveness of
This paper is organized into five sections. Section II
a trading strategy. The change in price of a stock depends
discusses the related works of stock price prediction.
on change in various dynamic factors, like, gold prices,
Section III elaborates the proposed model. Section IV
crude oil prices, currency exchange rates, inflation rates,
provides the results and section V concludes this article.
sensex index and various government policies. The stock
price prediction models are used to meet these challenges. II. RELATED WORK
Stock price prediction is performed using different
models, which are based on a particular technique. The Two major approaches used for stock price prediction are
major prediction techniques for stock price prediction are Fundamental approach and Technical approach. The
Artificial Neural Network (ANN), Time Series, and fundamental approach analyzes the changes in price of a
Regression. The model based on a specific technique stock using the financial data of a company that owns the
cannot predict stock price with high accuracy and stock. This approach is mainly used by long-term traders,
consistency. It can be improved using an Ensemble who hold purchased stocks for longer period of time. The
technique, which is a logical combination of various technical approach analyzes the changes in the historical
prediction models. The ensemble model provides more data of a stock through prediction charts and using
consistent and accurate stock price prediction. The popular different modeling & visualization techniques. This
ensemble techniques include Bagging, Boosting, and approach is primarily used by short-term traders, who hold
Stacking. their purchased stocks for a short span of time. This
This article proposes a Fibonacci Heap based approach includes ANN, Time series, Regression, and
heterogeneous ensemble model that predicts the closing Ensemble.
price of a stock for the next trading day. The proposed ANN technique employs the set of artificial neurons to
model combines different time series technique models and perform the prediction. This technique is prone to over-
regression technique models to predict the stock price. The fitting. Time series technique utilizes the historical time
ensemble model organizes the considered prediction series data of a stock to predict its price. The traditionally
models using Fibonacci heap data structure and computes used time series based techniques are Naïve, Exponential
their median on the basis of Mean Percentage Error. The Smoothing, Averaging, and Autoregressive. Regression
proposed model predicts the closing price of all the eleven technique [5] uses the relationship between the dependent
stocks listed under S&P-IT sector in Bombay Stock variable (closing price of a stock) and the independent
variables (attributes of historical data). Linear regression
and non-linear regression are two traditional variants of
1,2Department of Computer Science and Enginering, this technique. Ensemble technique [1, 2, 3, 4, 6] combines
MNNIT, Allahabad, Prayagraj, India the different prediction models to provide high accuracy
E-mail: 1vijay.kr.dwivedi@gmail.com, 2gore@mnnit.ac.in and consistency as compared to any other individual

Electronic copy available at: https://ssrn.com/abstract=3368764


306 2nd International Conference on Advanced Computing and Software Engineering (ICACSE-2019)

models. The popular variants of ensemble techniques are (that may influence the change in stock price). The sensex
Bagging [1, 3], Boosting [4], and Stacking [2, 6]. data of world's ten major stock exchanges have also been
The proposed model is based on stacking ensemble downloaded for the experimental purpose.
technique, which utilizes the predicted values by different Table 1: Stocks listed on S&P BSE-IT
prediction models. A combiner algorithm is used to predict
the stock price, which accepts the prediction values of Sl. No. Company Name No. of Observations
1 HCL Tech Ltd. 4025
different models and returns the computed effective value 2 HEXAWARE TECH. LTD. 3853
for the ensemble model. 3 INDIAN INFO TECH. LTD. 1413
4 INFOSYS LTD. 3941
III. FIBONACCI HEAP BASED ENSEMBLE MODEL 5 MINDTREE LTD. 2206
6 MPHASIS LTD. 3929
A Fibonacci heap is a data structure which links multiple 7 ORACLE FINANCIAL SERVICES 3382
values in such a way that the minimum value is pointed by LTD.
the root of the structure. In other words, a Fibonacci heap 8 TCS LTD. 2838
is a collection of several other min-heap data structures. 9 TECH MAHINDRA LTD. 2336
This article proposes a Fibonacci heap based ensemble 10 VAKRANGEE LTD. 3940
11 WIPRO LTD. 4041
model for stock price prediction. Initially, a Fibonacci heap TOTAL OBSERVATIONS 35904
is constructed for various predicted prices of a stock that
are generated by various other prediction models. Then, the The proposed model also generates various types of
model computes the median of these values extracted in a technical analysis indicators. Table 2 shows the list of
Fibonacci sequence from the earlier constructed Fibonacci technical analysis indicators used by various regression
heap data structure. Figure 1 shows the overview of the technique based prediction models.
proposed model. Table 2: Technical analysis indicators

Sl. No. Name Description


1 OP Opening Price (in Rs.)
2 CP Closing Price (in Rs.)
3 MaxP Maximum Price (in Rs.)
4 MinP Minimum Price (in Rs.)
5 Vol Volume of Trades
6 SMI Stochastic Momentum Index
7 MA3 Moving Average for Three Days
8 MA5 Moving Average for Five Days
9 MA7 Moving Average for Seven Days
10 MA9 Moving Average for Nine Days
11 MACD Moving Average Convergence/Divergence
12 3BIAS Difference between CP and MA3
13 5BIAS Difference between CP and MA5
14 7BIAS Difference between CP and MA7
15 9BIAS Difference between CP and MA9
16 RSI Relative Strength Index
17 BB Bollinger Band
The preprocessing techniques have been applied on
the gathered data. The preprocessing operation constitutes
of the normalization process, handling missing values, and
detecting outliers. In the proposed model, the missing
values have been replaced with the previous existing
values of the same data. The outliers have been detected
but not removed, considering the real volatile aspect of the
stock market. Hence, the proposed model is trained with
outliers. Another aspect of performing prediction with
outliers is that it improves the consistency and accuracy of
prediction with real data, which may contain outliers.
Figure 1: Overview of the proposed model A stationary data is a time series data that has a
The historical datasets of each eleven stocks listed on constant mean and fixed variance. The proposed model
S&P-IT is collected for the duration April 1, 2000 to tests the stationarity of given historical datasets using
December 28, 2018. Table 1 lists all the eleven stocks. The Dickey-Fuller Test. The result of stationary test determines
datasets have been updated at the end of each trading day. the generation of base prediction models. For stationary
This incremental update captures the recent patterns that datasets, the generated prediction models are based on the
relates to the historical datasets (of all the concerned techniques, like, Naïve, Simple Average, Moving Average,
stocks) and also to the datasets of other responsible factors Weighted Moving Average, and Simple Exponential

Electronic copy available at: https://ssrn.com/abstract=3368764


A Fibonacci Heap based Ensemble Model for Stock Price Prediction 307

Smoothing. For non-stationary datasets, the prediction Figure 2 shows the performance of the proposed ensemble
models are based on other techniques, like, Naïve Trend, model for all the considered stocks in the gathered
Naïve Rate of Change, Double Moving Average, Double historical data sets. The proposed model predicts 90
Exponential Smoothing, Triple Exponential Smoothing, percent of the observations with 70 percent accuracy,
Simple Linear Regression and Multiple Linear Regression. which is much better than the considered traditional
The proposed ensemble model utilizes the list of models. As the accuracy is increased, there is a sharp dip in
global indicators & technical analysis indicators, list of consistency. Due to page limitation, the detailed result of
attributes belonging to historical data sets, and the all the generated models for considered stocks could not be
attributes of datasets belonging to world's major stock shown.
exchanges. The details of all these lists could not be
provided due to page limitation. The base prediction V. CONCLUSION
models are pruned on the basis of obtained Mean A Fibonacci heap based ensemble model for stock price
Percentage Error (MPE) of the training datasets. The prediction has been proposed. The proposed model follows
values predicted by the remaining prediction models are an incremental approach to predict the closing price of a
organized in a Fibonacci heap data structure. Then the stock for the next trading day. The analysis of results
ensemble model is trained with the training datasets of that exhibits that the proposed ensemble model predicts better
stock. This model predicts the closing price of a stock for than the other traditional prediction models with high
the next trading day. accuracy in a consistent manner.
IV. RESULTS REFERENCES
[1] Leo Brieman, “Bagging predictors”, Machine Learning, vol. 24(2),
pp. 123-140, August 1996.
[2] Leo Breiman, “Stacked regressions”. Machine Learning, vol. 24(1),
pp. 49-64, 1996.
[3] K Leo Breiman, “Random forests”, Machine Learning, vol. 45(1),
pp. 5-32, Oct. 2001.
[4] Yoav Freund and Robert E. Schapire, “Experiments with a new
boosting algorithm”, In Proceedings of the Thirteenth International
Conference on Machine Learning (ICML'96), pp. 148-156, San
Francisco, CA, USA, Morgan Kaufmann Publishers Inc., 1996.
[5] Lucas Nunno, “Stock market price prediction using linear and
polynomial regression models”, University of New Mexico
Computer Science Department Albuquerque, New Mexico, United
States, 2014.
[6] David H. Wolpert, “Stacked generalization”, Neural Networks, vol.
5, pp. 241-259, 1992.

Figure 2: Accuracy performance for all the stocks

Electronic copy available at: https://ssrn.com/abstract=3368764

You might also like