Literature Review (Stock Market Prediction)
Literature Review (Stock Market Prediction)
Literature Review (Stock Market Prediction)
Abstract
There are many systematic reviews on predicting stock. However, each reveals a different portion
of the hybrid AI analysis and stock prediction puzzle. The principal objective of this research was
to systematically review the existing systematic reviews on Artificial Intelligence (AI) models
applied to stock market prediction to provide valuable inputs for the development of strategies in
stock market investments. We reviewed numerous research papers and reviews and our work
finally revealed that Long-Short Term Memory (LSTM), Support Vector Machines(SVM) , and
Artificial Neural Network(ANN) and Random Forest(RF) are the most popular AI models used for
predicting stock prices. The most commonly used data set is the stock closing price for training the
models which gave the most accurate and precise predictions as accuracy is the most
employed performance metric of the predictive models. In our review we also identified the gaps in
the research referred. Specifically, we indicate that future research could benefit from exploring
different data sources and combinations. We also suggest that different AI models will have
different advantages and applicable scenarios. Lastly, we recommend better evaluating different
prediction indicators and standards to reflect prediction models’ actual value and impact.
Introduction
Stock market prediction has long been a focal point for investors and researchers alike, driven by
the dynamic and complex nature of financial markets. With the advent of advanced technologies
and methodologies, particularly in the realm of artificial intelligence (AI), the quest for accurate
short-term price trend prediction has intensified. This pursuit is fueled by the recognition of the
significant challenges posed by factors such as market efficiency and noise, as noted by Fama [26].
Traditional approaches to stock market prediction have encompassed both technical and qualitative
analyses. Technical analysis relies on historical stock price data and trading volumes, while
qualitative analysis considers external factors such as political conditions, economic indicators, and
company performance [1] [2]. However, the emergence of intelligent techniques, particularly those
based on AI, has opened new avenues for enhancing prediction accuracy.
Machine learning techniques have demonstrated considerable promise in deciphering the intricate
patterns within large and nonlinear datasets characteristic of stock market data. Classical
algorithms such as linear regression, as well as more sophisticated methods like Support Vector
Machine (SVM) and Random Forest (RF), have shown improvements in prediction efficiency [4]
[10]. Moreover, neural network-based approaches, including Artificial Neural Networks (ANN),
Convolutional Neural Networks (CNN), Recurrent Neural Networks (RNN), and Long Short-Term
Memory (LSTM), have garnered attention for their ability to uncover hidden features and
relationships within complex data structures
Recent research has witnessed a convergence of machine learning and deep learning techniques,
with hybrid models incorporating both neural networks and optimization strategies such as feature
engineering [23] [24]. These advancements underscore the ongoing evolution of predictive models
in the stock market domain. However, alongside the strides in model sophistication, questions
persist regarding the trade-offs between computational costs and predictive accuracy [4].
In the context of a literature review, we aim to synthesize and analyze existing research in the field
of stock market prediction, particularly with a focus on short-term price trend forecasting. Our
review presents an overview of the methodologies, findings, and trends identified in prior works,
highlighting key contributions and areas for further exploration. Drawing upon a range of studies,
we examine the evolution of predictive models, from traditional methods to advanced techniques
based on machine learning and deep learning. In this context, we identify a gap in the literature
regarding the integration of comprehensive feature engineering and LSTM-based deep learning
models in short-term stock market prediction. By addressing this gap and building upon the
insights gleaned from previous research, our review aims to shed light on the current state-of-the-
art and provide direction for future studies in this area.
2
Data Set:
The collection is made up of data that has been taken from open sources and covers a broad range
of stock-related information, with a primary focus on the Chinese stock market in the research of
Jingyi Shen and M. Omair Shafiq. The dataset include fundamental data for each stock ID, daily
price data, and details on suspensions, resumptions, top 10 shareholders, and other information.
While for the research on closing price prediction by Mehar Vijha, Deeksha Chandolab, Vinay
Anand Tikki walb, Arun Kumar included data from a 10 year period from 2009 to 2019. The data
was taken from companies Johnson and Johnson and JP Morgan Chase. The data contains
information about the stock such as High, Low, Open, Close, Adjacent close and Volume.
The data set chosen ranges from two to three years for the research made by Jingyi Shen and M.
Omair Shafiq. The two main factors which led to the decision to restric the dataset to a two year
period: first, investors often use data from the previous two years to analyze stock market patterns;
second, there may be advantages to utilizing more recent data.
For the experimental study for the LSTM model the live data was downloaded for namely google
and Reliance from yahoo finance.
Table 1 Google
Table 2 Reliance
Attribute
Min Max
Name
Attribute
Min Max
Open 87.74 1005.49 Name
Open 205.5 3298
Low 86.37 996.62
Low 197.15 3141.3
High 98.29 1008.61
High 219.5 3298
Close 87.58 1004.28
Close 203.2 3220.85
3
Table 3 Sample Input
Methodology
1. Artificial Neural Network (ANN)
Artificial Neural Networks (ANN) represent an advanced data mining technique capable of
discerning underlying trends within data and extrapolating them. Unlike traditional methods, ANN
excels at deciphering complex patterns in unstructured data. The model operates through a
structured framework consisting of three layers: an input layer, a hidden layer, and an output layer.
The input layer incorporates various new variables, including H-L, O-C, 7 DAYS MA, 14 DAYS
MA, 21 DAYS MA, and 7 DAYS STD DEV. Each input's weights are multiplied and aggregated
before being transmitted to neurons in the hidden layer. Subsequently, the aggregated weights are
processed in the output layer, which comprises a single neuron providing the predicted closing
price of the stock. Figure 1 illustrates a detailed depiction of the ANN architecture, showcasing the
new variables serving as inputs.
4
Figure 1Detailed architecture of Artificial Neural Network (ANN) for stock price prediction
2. Random Forest(RF)
One method of ensemble machine learning is called Random Forest (RF). It can carry out tasks
including both classification and regression. Rather than depending solely on individual decision
trees to reduce model variation, the aim is to aggregate numerous decision trees to decide the final
output. The training of each decision tree, which in turn decides the decision at the tree's nodes, is
done in this work using newly produced variables. Because of its enormous size, stock market data
typically has a significant level of noise, which can lead to trees growing entirely differently than
would be predicted.
LSTMs are a type of neural network that can learn long-term dependencies and are useful for
predicting stock prices. They examine a sequence of stock prices over time to detect patterns and
predict future prices.
At the heart of LSTM networks are memory cells that store and update information over time.
These memory cells are connected through a network of gates that control the flow of information.
The three fundamental gates in an LSTM network are:
5
Figure 2 Fundamental gates of LSTM
1. Forget Gate: This gate determines what information from the previous time step should be
discarded or forgotten.
2. Input Gate: The input gate decides which new information from the current time step
should be stored in the memory cell.
3. Output Gate: The output gate selects what information from the memory cell should be
used to make the prediction for the current time step.
6
After performing principal component extraction, we obtain a matrix with reduced scale, where the
most effective features are transformed into principal components to train our prediction model.
We use an LSTM model and include a conversion step for our stock price dataset, as outlined in
Algorithm 2. The TimeSeriesConversion() function shifts the principal components matrix into a
time series by adjusting the input data frame according to a specified number of time steps,
referred to as "term length" in this study. The processed dataset includes both input and forecast
sequences. For this research, the LAG parameter is set to 1, as the model aims to detect daily
fluctuations in feature patterns. Additionally, N_TIME_STEPS varies from 1 trading day to 10
trading days. The DataPartition(), FitModel(), and EvaluateModel() functions follow standard steps
without customization. Details regarding the neural network structure, optimizer choice, and other
parameters are provided in the ModelCompile() function.
Result
Analysis for ANN and RF models:
To evaluate the effectiveness of the models, a comparison is made between the techniques on some
different sector companies namely, JP Morgan, JNJ using both ANN and RF models. Predicted
closing prices are subjected to Root Mean Square Error (RMSE), Mean Absolute Percentage Error
(MAPE) and Mean Bias Error (MBE) for finding the final minimalized errors in the predicted
price.
(1)
where ‘Oi’ refers to the original closing price, ‘Fi’ refers to the predicted closing price and ‘n’
refers to the total window size. MAPE has also been used to evaluate the performance of the model
and is computed using eq. 2.
(2)
where ‘Oi’ refers to the original closing price, ‘Fi’ refers to the predicted closing price and ‘n’
refers to the total
7
window size. MBE has also been used to evaluate the performance of the model and is computed
using eq. 3.
(3)
where ‘Oi’ refers to the original closing price, ‘Fi’ refers to the predicted closing price and ‘n’
refers to the total window size. Fig. 2 represents graphs showing original closing price of stock
with respect to predicted closing price of stock of five different companies using ANN. Fig. 3
represents graphs showing original closing price of stock vs predicted closing price of stocks using
RF. Comparative analysis of the RMSE, MAPE and MBE values obtained using ANN and RF
model is shown in Table 2, it can be observed that ANN shows better prediction results for stock
prices.
Figure 3 Predicted v/s original (expected) closing stock price using ANN.
8
Figure 4 Predicted v/s original (expected) closing stock price using RF.
Table 4 Comparative analysis of RMSE, MAPE and MBE values obtained using ANN and RF model
Company ANN RF
RMSE MAPE MBE RMSE MAPE MBE
JPMORGAN 1.28 0.89% -0.0310 1.41 0.93% -0.0313
The comparative analysis indicates, that for JP Morgan and Co., Johnson & Johnson companies,
ANN proves to be a better technique, giving better RMSE and MAPE values, as shown in the
Table 1.
But now we will have to do a comparative analysis using LSTM models as well to see if it is more
reliable in predicting the stock prices with more accuracy.
9
Analysis for LSTM model:
SYSTEM ARCHITECTURE
Data Selection: The first step is to select data for an organization and split the data into training
and testing. we have used 75% for training and 25% for testing purposes.
Pre-processing of data: In pre-processing, we are selecting attributes required for the algorithm
and the remaining attributes are neglected. The selected attributes are Trade Open, Trade High,
Trade Low, Trade Close, Trade Volume. In pre-processing, we are using normalization to get
values in a particular range.
Prediction using LSTM: In this system, we are using the LSTM algorithm for predicting stock
values. Initially, the training data is passed through the system and train the model. Then in the
testing phase, the predicted values are compared with the actual values.
Evaluation: In the evaluation phase we are calculating the Accuracy, Mean Square Error (MSE)
and Root Mean Square Error (RMSE) values for comparison.
10
Experimental Results:
GOOGLE:
RELIANCE:
11
Conclusion:
Because stock values are constantly fluctuating and depend on a variety of factors that create
intricate patterns, predicting stock market returns is a difficult undertaking. The historical dataset
that is accessible on the company's website is insufficient because it only includes a small number
of features, such as the volume of shares traded, adjacent close value of stock prices, high, low, and
open prices. Using the factors that already exist, new variables have been added in order to
increase the accuracy of the forecasted price value. The stock's closing price the following day is
predicted using ANN, LSTM, and RF is also employed for a comparative analysis.
From these experimental review of the functioning of these models we get the following results:
The comparative analysis based on RMSE, MAPE and MBE values clearly indicate that ANN
gives better prediction of stock prices as compared to RF. Results show that the best values
obtained by ANN model gives RMSE (0.42), MAPE (0.77) and MBE (0.013).
But after taking the LSTM model into account we find out that the LSTM model gives us a better
accuracy and consistency in predicting the stock market prices in accordance with the parameters
chosen for comparison.
For future work, deep learning models could be developed which consider financial news articles
along with financial parameters such as a closing price, traded volume, profit and loss statements
etc., for possibly better results.
12
References:
1. Atsalakis GS, Valavanis KP. Forecasting stock market short-term trends using a neuro-fuzzy based methodology. Expert Syst Appl.
2009;36(7):10696–707.
2. Ayo CK. Stock price prediction using the ARIMA model. In: 2014 UKSim-AMSS 16th international conference on computer modelling
and simulation. 2014. https://doi.org/10.1109/UKSim.2014.67.
3. Brownlee J. Deep learning for time series forecasting: predict the future with MLPs, CNNs and LSTMs in Python. Machine Learning
Mastery. 2018. https://machinelearningmastery.com/time-series-prediction-lstm-recurrent-neural-networks- python-keras/
4. Eapen J, Bein D, Verma A. Novel deep learning model with CNN and bi-directional LSTM for improved stock market index prediction.
In: 2019 IEEE 9th annual computing and communication workshop and conference (CCWC). 2019. pp. 264–70.
https://doi.org/10.1109/CCWC.2019.8666592.
5. Fischer T, Krauss C. Deep learning with long short-term memory networks for financial market predictions. Eur J Oper Res.
2018;270(2):654–69. https://doi.org/10.1016/j.ejor.2017.11.054.
6. Guyon I, Weston J, Barnhill S, Vapnik V. Gene selection for cancer classification using support vector machines. Mach Learn
2002;46:389–422.
7. Hafezi R, Shahrabi J, Hadavandi E. A bat-neural network multi-agent system (BNNMAS) for stock price prediction: case study of DAX
stock price. Appl Soft Comput J. 2015;29:196–210. https://doi.org/10.1016/j.asoc.2014.12.028.
8. Halko N, Martinsson PG, Tropp JA. Finding structure with randomness: probabilistic algorithms for constructing approximate matrix
decompositions. SIAM Rev. 2001;53(2):217–88.
9. Hassan MR, Nath B. Stock market forecasting using Hidden Markov Model: a new approach. In: Proceedings—5th international
conference on intelligent systems design and applications 2005, ISDA’05. 2005. pp. 192–6. https://doi. org/10.1109/ISDA.2005.85.
10. Hochreiter S, Schmidhuber J. Long short-term memory. J Neural Comput. 1997;9(8):1735–80. https://doi.
org/10.1162/neco.1997.9.8.1735.
11. Hsu CM. A hybrid procedure with feature selection for resolving stock/futures price forecasting problems. Neural Comput Appl.
2013;22(3–4):651–71. https://doi.org/10.1007/s00521-011-0721-4.
12. Huang CF, Chang BR, Cheng DW, Chang CH. Feature selection and parameter optimization of a fuzzy-based stock selection model
using genetic algorithms. Int J Fuzzy Syst. 2012;14(1):65–75. https://doi.org/10.1016/J.POLYM ER.2016.08.021.
13. Huang CL, Tsai CY. A hybrid SOFM-SVR with a filter-based feature selection for stock market forecasting. Expert Syst Appl. 2009;36(2
PART 1):1529–39. https://doi.org/10.1016/j.eswa.2007.11.062.
14. Idrees SM, Alam MA, Agarwal P. A prediction approach for stock market volatility based on time series data. IEEE Access.
2019;7:17287–98. https://doi.org/10.1109/ACCESS.2019.2895252.
15. Ince H, Trafalis TB. Short term forecasting with support vector machines and application to stock price prediction. Int J Gen Syst.
2008;37:677–87. https://doi.org/10.1080/03081070601068595.
16. Jeon S, Hong B, Chang V. Pattern graph tracking-based stock price prediction using big data. Future Gener Comput Syst. 2018;80:171–
87. https://doi.org/10.1016/j.future.2017.02.010.
17. Kara Y, Acar Boyacioglu M, Baykan ÖK. Predicting direction of stock price index movement using artificial neural net- works and
support vector machines: the sample of the Istanbul Stock Exchange. Expert Syst Appl. 2011;38(5):5311– 9.
https://doi.org/10.1016/j.eswa.2010.10.027.
18. Khaidem L, Dey SR. Predicting the direction of stock market prices using random forest. 2016. pp. 1–20.
19. Kim K, Han I. Genetic algorithms approach to feature discretization in artificial neural networks for the prediction of
20. Lee MC. Using support vector machine with a hybrid feature selection method to the stock trend prediction. Expert
21. Lei L. Wavelet neural network prediction method of stock price trend based on rough set attribute reduction. Appl
22. Lin X, Yang Z, Song Y. Expert systems with applications short-term stock price prediction based on echo state net-
13
23. Liu G, Wang X. A new metric for individual stock trend prediction. Eng Appl Artif Intell. 2019;82(March):1–12. https://
doi.org/10.1016/j.engappai.2019.03.019.
24. Liu S, Zhang C, Ma J. CNN-LSTM neural network model for quantitative strategy analysis in stock markets.
2017;1:198–206. https://doi.org/10.1007/978-3-319-70096-0.
25. Long W, Lu Z, Cui L. Deep learning-based feature engineering for stock price movement prediction. Knowl Based
26. Malkiel BG, Fama EF. Efficient capital markets: a review of theory and empirical work. J Finance. 1970;25(2):383–417.
27. Tushare API. 2018. https://github.com/waditu/tushare. Accessed 1 July 2019.
14