0% found this document useful (0 votes)
18 views5 pages

Kumar 2021

This document presents a study on financial time series forecasting using a stacked Long Short-Term Memory (LSTM) model, comparing its performance against traditional models like Moving Average (MA) and XGBoost. The research utilizes historical stock data from Infosys Limited on the Bombay Stock Exchange and demonstrates that the proposed LSTM model outperforms the benchmark models in terms of accuracy. The paper outlines the methodology, experiments, and results, concluding that deep learning techniques are more effective for stock market predictions.

Uploaded by

ganeshmeti1043
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views5 pages

Kumar 2021

This document presents a study on financial time series forecasting using a stacked Long Short-Term Memory (LSTM) model, comparing its performance against traditional models like Moving Average (MA) and XGBoost. The research utilizes historical stock data from Infosys Limited on the Bombay Stock Exchange and demonstrates that the proposed LSTM model outperforms the benchmark models in terms of accuracy. The paper outlines the methodology, experiments, and results, concluding that deep learning techniques are more effective for stock market predictions.

Uploaded by

ganeshmeti1043
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Analysis of Financial Time Series Forecasting

2021 11th International Conference on Cloud Computing, Data Science & Engineering (Confluence) | 978-1-6654-1451-7/20/$31.00 ©2021 IEEE | DOI: 10.1109/Confluence51648.2021.9377158

using Deep Learning Model

Raghavendra Kumar*1,2 Pardeep Kumar1 Yugal Kumar1


1Department of Computer Science 1Department of Computer Science 1Department of Computer Science

& Engineering, Jaypee University of & Engineering, Jaypee University of & Engineering, Jaypee University of
Information Technology, Information Technology, Information Technology,
Waknaghat (HP), INDIA Waknaghat (HP), INDIA Waknaghat (HP), INDIA
*[Link]@[Link] pardeepkumarkhokhar@[Link] yugalkumar.14@[Link]
2Departmentof Information Technology
KIET Group of Institutions
Delhi NCR Ghaziabad (INDIA)
*ORCID: 0000-0002-0178-2935

Abstract- Time series data analysis and its forecasting is a foremost The financial market enables companies to issue and pitch their
trend of stock market prediction. Accurate prediction of stocks shares to the common public for the first time through the
brings more profit to market traders and helps in financial decision procedure of initial public offerings (IPO). Machine Learning
making. There are various machine learning and deep learning models provide the ability to automatically learn and improve
models assist to predict the stock market accuracy. Recent work
concludes that various models like Support Auto Regressive
from its experiences. It may also require some additional time and
Integrated Moving Average (ARIMA), Vector Machine (SVM), resources for proper training [2]. There are well known time
Artificial Neural Network (ANN), XGBoost, and Recurrent Neural forecasting models Autoregressive (AR), Moving Average (MA),
Network (RNN) were preferred to obtain improved accuracy. In this Auto Regressive Moving Average (ARMA), Auto Regressive
study, a stacked Long Short-Term Memory (LSTM) model is Integrated Moving Average (ARIMA) considered as linear
proposed to predict the stock market accuracy and proposed model models. Artificial Neural Network (ANN), Recurrent Neural
is compared with Moving Average (MA) and XGBoost models. The Network (RNN), Naive Bayes and LSTM, Deep Belief Network
experiments are performed on the historical dataset of Infosys (DBNs) are considered as non-linear models [4,5]. Various
Limited of Bombay Stock Exchange, India (BSE30). The model is models and combinations are discussed in the recent study based
also evaluated through performance measures Root Mean Square
Error (RMSE) and Mean Absolute Percentage Error (MAPE) and
on financial time series analysis and found that deep learning
found that proposed stacked LSTM model outperformed the models like RNN, LSTM, DBNs and its variant have been the
benchmark model. proven model to achieve improved accuracy [21].

Objective of this paper is to propose a stacked LSTM model for


Index Terms- Time Series Data, ARIMA, LSTM time series forecasting using stock market data. Noticeably, this
study proves to have a best result over similar counterparts.
I. INTRODUCTION Remaining part of this paper is organized as follows. Section-2
includes related works and the brief discussion of existing
Time series data considers massive amounts of data, high models. Section-3 illustrates the methodology which includes
dimensional and updates continuously. The continuous updates stacked LSTM along with the hyper parameter tuning. Section-4
in numerical sequence maintain the dependency in the dataset. reports the result and discussion about dataset and obtained
Therefore, the previous value is interrelated with the upcoming effective outcome from their counterparts. Section-5 finally,
values and so on. Time series analysis keeps time intervals in concludes the paper and enlightens the future prospect of the
specific time periods into consideration while dealing with data. study.
Stipulated Time interval generates behaviour and pattern in data
series which help to design a forecasting model of the stock
market [1,2].

978-1-6654-1451-7/21/$31.00 2021
c IEEE 877

Authorized licensed use limited to: Carleton University. Downloaded on May 31,2021 at 01:59:10 UTC from IEEE Xplore. Restrictions apply.
II. RECENT WORK
Suryoday B. et al. implemented Random Forests and XGBoost
It's a known fact that human beings are persistent in their classifiers that are used to predict the stock values. The robustness
thoughts. A human being doesn’t think anything from scratch to can be evaluated by the parameters- accuracy, precision, recall,
recall something but recall the previous instance to make and F-score. Exponential smoothing, which is a rule of thumb
correlation with future entities. RNN theory (Fig-1) only links the technique, is used for smoothing the time series. It is founded that
current task with previous information, not the context of the XGBoost classifier works better than the random forest
information. If we consider the statement “I am Indian…. I speak classifier [6]. Shubharthi D. et al. considered Apple Inc. and
Marathi”. Therefore, previous information suggests the next word Yahoo Inc. of 5 years to implement eXtreme Gradient Boosting
might be related to language, but the context is about Indian. (XGBoost). The parameters used are RMSE, accuracy, precision,
When this information gap is increased, the accuracy of RNN gets recall and specificity. Robustness and accuracy can be achieved
affected. This is called long term dependencies constraints [16]. by analysing the receiver operating characteristics (ROC) curve.
LSTM can easily track and hold the previous information and It is a graphical plot that illustrates the performance of a binary
connect with a new input set by evaluating what to learn and what classifier system. XGBoost performs well with an accuracy of
to forget. 87% for 60 days and 90 days than the other machine learning
techniques [7]. Puchong P. et al. chosen dataset of BEC, ITD,
PTT and SCB stocks of Thailand Stock Exchange between
January 1st, 2009 and July 31st, 2009. In this study, three
methods are applied to compute MA, Simple Moving Average
(SMA), Exponential Moving Average (EMA) and Weighted
Moving Average (WMA). As obtained result profits generated
from SMA were higher than WMA and EMA. Stocks in set 50
stock indexes of Thailand Stock Exchange showed most
promising net profits from the use of the three moving averages
and trading points of time length 20 days [8]. Aloysius E et al.
Fig:1 Recurrent Neural Network (RNN) architecture unfolding at time interval
worked on Autoregressive Integrated Moving Average (ARIMA)
model is used which is based on ARMA. It is widely used to
LSTM (Fig-2) by Hochreiter and Schmidhuber [16] is a special predict linear time series data. RMSE and MAPE are used. Series
and significant branch of RNN that works on long term are highly correlated to immediate past values forecast accuracy.
dependencies. It is well known state of the art technique in ARIMA is better approach than forecasting directly, because of
sequential data series. The LSTM network is designed to handle the accuracy it provides. MA (Moving Average) model is
the long-term dependency problem and correlate previously relevant if the AR(Auto-regression) process also involves past
inherent series of produced data. The entire LSTM network values of error items [9]. Mohammad A. et al. showed a new
known as LSTM units constituted from states of cells. Each cell model which delivers short-term predicting of new high
has its significant role to produce data for the next layer. Entire technology procedure. Method shows accuracy and its
functioning of the LSTM unit is divided in three segments known presentation capabilities. ARIMA model was selected with MSE
as gates to maintain the flow of information [16,17]. parameter. It also concluded that forecasting accuracy of ARIMA
model decreases gradually at the stage of growth process, period
Recurrent Neural Networks (RNN) is a special variant of to period. It is limited to short term forecasting. To compare the
Artificial Neural Networks (ANN) that is best fit for sequential performance of model parameters RMSE (Root Mean Square
data series. Stock market data is found as best time series data Error) and MAPE (Mean Absolute Error) are used [18].
due to its volatile nature. Therefore, RNN is examined for stock
market prediction and return based on recent study. LSTM is III. RESEARCH METHODOLOGY
another proven variant of RNN and has been validated by
research as well as industrial’s traders. It is introduced by This section includes the proposed models used to implement the
Hochreiter and Schmidhuber [16] to overcome the shortcoming selected dataset. The detailed discussion of the models indicates
of RNN. LSTM is known for its memory architecture and the positive influence as well as the constraints with real time
network units connected to each other. The purpose of each unit stock market time series dataset.
to save the context of domain like trends and volatility in stock
market. Based on recent study, this paper has put efforts to A. Moving Average (MA)
accumulate the results and methodology. In recent, Hiransha, M.
et al. (2018) implemented four types of deep learning Moving average (MA) is an average of any subset of numbers.
architectures that is Multilayer Perceptron (MLP), Recurrent MA computes the current trends of the market with the help of
Neural Networks (RNN), Long Short-Term Memory (LSTM) dataset. Average represents the mid value of a set of numbers.
and Convolutional Neural Network (CNN). This study used the MA is computed multiple times for several subsets of data.
datasets of National Stock Exchange (NSE), India and New York Arithmetic means are used for measurement of a trend. Problem
Stock Exchange (NYSE), USA to examine the given models. faced in moving average is that it eliminates the oscillatory
Experiment is conducted for 10 years of span. Result analysis fluctuations. It assumes that trend is linear. The limitation of MA
depicts the limitations of ARIMA model on nonlinear patterns of is that it cannot use the long-term forecasting trend of time series
univariate time series prediction. Proposed study concluded the data [8].
deep learning models are better performing than the ARIMA
model [3].

878 2021 11th International Conference on Cloud Computing, Data Science & Engineering (Confluence 2021)

Authorized licensed use limited to: Carleton University. Downloaded on May 31,2021 at 01:59:10 UTC from IEEE Xplore. Restrictions apply.
B. XGBoost variable (Fig.3) with the forecasting horizon 1.
The dataset values are normalized in the range of (0-1) using
Boosting is referring as an ensemble technique where obtained equation-11. The range from 0 to 1 obtains normalized multi-
errors from individual model are added to improve the overall dimensional time series data since raw data range varies widely
accuracy. However, ensemble techniques can be performed of the selected stock.
through different ways to improve the accuracy. The ensemble
technique uses the set of Classification and Regression Trees X`= X-Xmin / Xmax -Xmin (1)
(CART). Multiple sets of CART are used to provide strong
predictive power. XGBoost is an optimized distributed gradient Given equation (1) holds X` as scaled data value of raw data X
boosting library which is highly efficient, flexible and portable while, Xmin and Xmax are the minimum and maximum values of X
[6]. A machine learning algorithm called Gradient Boosting respectively.
algorithm is used for making building predictive tree-based
models [7].

C. Stacked Long Short-Term Memory (LSTM)

Long Short-Term Memory (LSTM) is a type of Recurrent Neural


Network (RNN)architecture used in deep learning technique.
LSTM addresses the vanishing gradient problem since RNN has
such problem. RNN fails to save the context of domain.
Therefore, RNN cannot hold the long-term dependency. Due to
LSTM memory structure, it allows learning of long-term
dependencies. LSTM is a well-known deep learning model
known for sequence prediction problems and have been proven Fig.3 Dataset division based on closing value
to be extremely effective. Based upon the importance of content,
content can be kept or vanished with the help of input gate and The hyper parameters and performance of the LSTM network
forget gate, respectively [16]. before and after tuning on the validation set are given in Table-1.

LSTM has variety of version hold different architectures such as


vanilla LSTM, stacked LSTM and ConLSTM. Most of the
architecture holds the three gates known as three gates, the input
gate, the output gate and the forget gate. Few LSTM models do
not have these gates or having a higher probability to have some
other gates. The cell node is responsible for keeping track of the
dependencies between elements in the input sequence [16].

Fig 2 LSTM Unit by Hochreiter- Schmidhuber [16]

D. Dataset Description

In this study, historical dataset of Infosys Limited of Bombay


Stock Exchange, India (BSE30) is considered for the period of
May 15, 2018 to May 14, 2019. As data pre-processing steps
dataset is divided into training (80%) and testing part (20%). Fig.4 Forecasting Model
However, to ensure the model to not come in overfitting and
underfitting issues training dataset is further divided into IV. EXPERIMENTS SETUP AND RESULTS DISCUSSION
validation dataset (20% of training set). Validation set is
implemented the 10-fold cross validation to ensure the best fit In the first model Moving Average (MA) performance metric
model for time series forecasting for n days. This fitted model is parameters Root Mean Square Error (RMSE) and Mean Absolute
used to predict the stock forecasting for the selected stock Infosys Percentage Error (MAPE) are obtained as 10.094 and 1.13,
Limited of Bombay Stock Exchange, India (BSE30). In the respectively. This value is better than the core machine learning
experiments closing price is considered as an independent models used previously. In the second model XGBoost, RMSE
and MAPE are obtained as 8.807 and 1.014, respectively that is

2021 11th International Conference on Cloud Computing, Data Science & Engineering (Confluence 2021) 879

Authorized licensed use limited to: Carleton University. Downloaded on May 31,2021 at 01:59:10 UTC from IEEE Xplore. Restrictions apply.
found superior to moving average model. Recent work on Table-2 illustrate the results obtained from Moving Average,
XGBoost suggest the model acceptance with stock market time XGBoost and LSTM network for the identified dataset. Obtained
series data [19,20,21]. results are examined on Intel(R) Core (TM) i5-8265UC @ 1.8
However, proposed stacked LSTM model in Fig.4 obtained best GHz with 2TB secondary storage and 16GB RAM as commodity
accuracy among three models used in this study. During the hardware on Python3.0 in tensor flow environment.
experiments tuning of hyperparameters of LSTM unit was a
challenging task. In the study initially, LSTM hyperparameters V. CONCLUSION
window size, lstm_units, drop_out, batch_size and epoch are set
as 9, 50, 1, 1 and 1 respectively while after tuning final values are Stock market is a foremost research domain of financial time
obtained as window size (3), lstm_units (128), drop_out (1), series analysis. Machine Learning and soft computing approaches
batch_size (8) and epoch (150) illustrated in Table-1. With the are widely adopted to gain more profits to organization and
help of hyper parameters tuning stacked LSTM obtained 7.834 market traders. This paper evolves a stock forecasting model
RMSE and 0.8022 MAPE that is 11.04% and 20.88% improved namely, stacked LSTM. Long Short Term Memory (LSTM) is
RMSE and MAPE than second best XGBoost model. identified as best time series prediction model due to its unique
memory structure discussed in section-3. Proposed model is
TABLE-1 -TUNING LSTM HYPER PARAMETERS computed the improved accuracy with performance measures as
RMSE, MAPE to compare the model’s performance. Though,
Parameters Original Value After Tuning XGBoost is highly efficient, flexible and portable algorithm but
stacked LSTM obtains the superior results over MA and
N 9 3
XGBoost. Proposed stacked LSTM model obtained 11.04% and
lstm_units 50 128 20.88% improved RMSE and MAPE than second best XGBoost
drop_out prob 1 1 model. However, LSTM model required more optimization for
its global and local hyper parameters and various evolutionary
optimizer Adam Adagrade algorithms can be applied as future prospect to overcome this
epochs 1 150 issue.
batch_size 1 8
V. ACKNOWLEDGEMENT
Based on recent study, RMSE is considered as standard deviation We wish to thanks to Department of Computer Science &
of the residuals. RMSE is identified to compute the error measure Engineering, Jaypee University of Information Technology,
using estimated values through selected model and actual values Waknaghat (HP) and Department of Information Technology,
using equation 1. KIET Group of Institutions, Delhi NCR Ghaziabad (UP) along
with anonymous reviewer’s comments, without them this
publication is not probable.
ܴ‫ ܧܵܯ‬ൌ ඥσ௡௜ୀଵሺܺ݅ െ ܺԢ݅ሻ;Ȁ݊ (2)

References
‫ ܧܲܣܯ‬ൌ ͳȀ݊ σ௡௜ୀଵȁܺ݅ െ ܺԢ݅Ȁܺ݅ȁ ‫ͲͲͳ כ‬ (3)
[1] Nelson, D. M., Pereira, A. C., & de Oliveira, R. A. (2017, May). Stock
market's price movement prediction with LSTM neural networks. In 2017
On the other hand, Mean Absolute Percentage Error (MAPE) is
International Joint Conference on Neural Networks (IJCNN) (pp. 1419-
known as a normalized error obtained through selected models 1426). IEEE.
[18]. [2] Shah, D., Isah, H., & Zulkernine, F. (2019). Stock Market Analysis: A
Review and Taxonomy of Prediction Techniques. International Journal of
TABLE 2 - COMPARISON OF PERFORMANCE METRICS Financial Studies, 7(2), 26.
[3] Hiransha, M., Gopalakrishnan, E. A., Menon, V. K., & Soman, K. P. (2018).
NSE stock market prediction using deep-learning models. Procedia
Method RMSE MAPE computer science, 132, 1351-1362.
[4] Basak, S., Kar, S., Saha, S., Khaidem, L., & Dey, S. R. (2019). Predicting
Moving Average 10.094 1.13 the direction of stock market prices using tree-based classifiers. The North
XGBoost 8.807 1.014 American Journal of Economics and Finance, 47, 552-567.
[5] Dey, S., Kumar, Y., Saha, S., & Basak, S. (2016). Forecasting to
LSTM 7.834 0.8022 Classification: Predicting the direction of stock market price using Xtreme
Gradient Boosting. Working paper. DOI: 10.13140/RG. 2.2. 15294.48968.
[6] Hirabayashi, A., Aranha, C., & Iba, H. (2009, July). Optimization of the
trading rule in foreign exchange using genetic algorithm. In Proceedings of
the 11th Annual conference on Genetic and evolutionary computation (pp.
1529-1536). ACM.
[7] Ariyo, A. A., Adewumi, A. O., & Ayo, C. K. (2014, March). Stock price
prediction using the ARIMA model. In 2014 UKSim-AMSS 16th
International Conference on Computer Modelling and Simulation (pp. 106-
112). IEEE.
[8] Kohli, P. P. S., Zargar, S., Arora, S., & Gupta, P. (2019). Stock Prediction
Using Machine Learning Algorithms. In Applications of Artificial
Intelligence Techniques in Engineering (pp. 405-414). Springer, Singapore.
[9] Asghar, M. Z., Rahman, F., Kundi, F. M., & Ahmad, S. (2019).
Fig 4 Experimental result of Forecasting models Development of stock market trend prediction system using multiple
regression. Computational and Mathematical Organization Theory, 1-31.

880 2021 11th International Conference on Cloud Computing, Data Science & Engineering (Confluence 2021)

Authorized licensed use limited to: Carleton University. Downloaded on May 31,2021 at 01:59:10 UTC from IEEE Xplore. Restrictions apply.
[10] Patel, J., Shah, S., Thakkar, P., & Kotecha, K. (2015). Predicting stock
market index using fusion of machine learning techniques. Expert Systems
with Applications, 42(4), 2162-2172.
[11] Abraham, A., Nath, B., & Mahanti, P. K. (2001, May). Hybrid intelligent
systems for stock market analysis. In International Conference on
Computational Science (pp. 337-345). Springer, Berlin, Heidelberg. Bruno
M.H,
[12] Henrique, B. M., Sobreiro, V. A., & Kimura, H. (2018). Stock price
prediction using support vector regression on daily and up to the minute
prices. The Journal of finance and data science, 4(3), 183-201.
[13] Thakur, M., & Kumar, D. (2018). A hybrid financial trading support system
using multi-category classifiers and random forest. Applied Soft
Computing, 67, 337-349.
[14] Göçken, M., Özçalıcı, M., Boru, A., & Dosdoğru, A. T. (2019). Stock price
prediction using hybrid soft computing models incorporating parameter
tuning and input variable selection. Neural Computing and
Applications, 31(2), 577-592.
[15] W.Y. Goh, C.P. Lim, K.K. Peh, Predicting drug dissolution profiles with an
ensemble of boosted neural networks: a time series approach, IEEE
Transactions on Neural Networks 14 (2) (2003) 459–463.
[16] Hochreiter, S., &Schmidhuber, J. (1997). Long short-term memory. Neural
computation, 9(8), 1735-1780.
[17] Fischer, T., & Krauss, C. (2018). Deep learning with long short-term
memory networks for financial market predictions. European Journal of
Operational Research, 270(2), 654-669.
[18] Kumar, R., Kumar, P., & Kumar, Y. (2020). Time Series Data Prediction
using IoT and Machine Learning Technique. Procedia Computer
Science, 167, 373-381.
[19] Nobre, J., & Neves, R. F. (2019). Combining principal component analysis,
discrete wavelet transform and XGBoost to trade in the financial
markets. Expert Systems with Applications, 125, 181-194.
[20] Wang, Y., & Guo, Y. (2020). Forecasting method of stock market volatility
in time series data based on mixed model of ARIMA and XGBoost. China
Communications, 17(3), 205-221.
[21] Sezer, O. B., Gudelek, M. U., & Ozbayoglu, A. M. (2020). Financial time
series forecasting with deep learning: A systematic literature review: 2005–
2019. Applied Soft Computing, 90, 106181.

2021 11th International Conference on Cloud Computing, Data Science & Engineering (Confluence 2021) 881

Authorized licensed use limited to: Carleton University. Downloaded on May 31,2021 at 01:59:10 UTC from IEEE Xplore. Restrictions apply.

You might also like