0% found this document useful (0 votes)
18 views

Application of Machine Learning and Deep Learning Algorithms To The Prediction of Stock Market Trends

Uploaded by

Roshan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Application of Machine Learning and Deep Learning Algorithms To The Prediction of Stock Market Trends

Uploaded by

Roshan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

2023 Global Conference on Information Technologies and Communications (GCITC)

Karnataka, India. Dec 1-3, 2023

Application of Machine Learning and Deep


Learning Algorithms to the Prediction of Stock
Market Trends
2023 Global Conference on Information Technologies and Communications (GCITC) | 979-8-3503-0816-7/23/$31.00 ©2023 IEEE | DOI: 10.1109/GCITC60406.2023.10426519

Shravan Khunti Prikshit Kumar M.Lakshman Rao


Dept.of Aerospace Engineering Dept.of Information Technology Dept.of Mechanical Engineering
Chandigarh University JC Bose University of Science and Madanapalle Institute of Technology &
Ludhiana - Chandigarh State Hwy, Technology Science
Punjab, India Faridabad, Haryana, India Madanapalle, India.
[email protected] [email protected] [email protected]

T Vijay Muni Varun Sanjeev Singh Shaik Chand Mabhu Subhani


Dept.of Electrical and Electronics Dept.of Aerospace Engineering Department of Mechanical Engineering
Engineering Chandigarh University Eswar College of Engineering
Koneru Lakshmaiah Education Foundation Ludhiana - Chandigarh State Hwy, Narasaraopeta, India.
Vaddeswaram, India. Punjab, India [email protected]
[email protected] [email protected]

Abstract—The stock market's inherent volatility poses A method called "data mining" is used to look at huge
ongoing challenges for stock traders, as it is subject to a amounts of business and financial information, and
multitude of circumstances that exert influence on its behavior. techniques from this method are used to guess how stocks
This research aims to mitigate the risk associated with will move. There are times when temporal stock markets
forecasting stock market trends through the utilization of deep need to be mined to get more information when current
learning and machine learning techniques. Eleven machine events and their connections need to be tracked through time.
learning models were utilized in this study: random forest, Stock projection uses derived data, basic data, and a set of
logistic regression, xgboost, naive Bayes, K-nearest neighbors, pure technical data to guess what stocks will be worth in the
decision tree and support vector classifier and extreme
future. Fundamental data shows how the company works and
gradient boosting. Additionally, two powerful deep learning
techniques: recurrent neural networks (RNN) and long short
the state of the market, while straight technical data is based
term memory (LSTM) were used. From the Tehran Stock on past stock data. By using both data mining classification
Exchange, four market groups were chosen for the methods and stock predictions together, we can find
experimental estimates. Petroleum, non-metallic minerals, unknown parts of a company's stock prices by looking at past
basic metals, and diversified financials are all part of these data. An important part of this prediction is the use of
categories. classification methods like k-Nearest Neighbors (KNN),
neural networks, regression, decision tree induction, and
Keywords: stock market trend prediction, deep learning, evolutionary algorithms.
Support Vector Classifier, Artificial Neural Network, stock
trading, k-nearest neighbors, RNN, long short-term memory

I. INTRODUCTION II. EXISTING SYSTEM


The focus of recent business research has been on Researchers Shin et al. (2005) used genetic-algorithm
challenging and time-consuming topics like future stock approach to develop a set of trading rules for the Korea Stock
price estimates. Contrarily, financial data is perceived as Price Index-200 (KOSPI 200). The statistical analysis
being challenging to forecast and anticipate. Business method used in the research by Hellestrom and Homlstrom
associations, scholars, and interested parties are keen to (1998) was a modified k-nearest neighbors (kNN) algorithm.
obtain the stock price projection of stock market trends This investigation set out to improve prediction accuracy by
because they think that knowledge from the past and present pinpointing exactly where associated areas are located within
influences events that will happen in the future. Fama's the input space. Researchers in Sweden zeroed particularly
efficient market hypothesis (EMH) (1990) shows that on the years 1987–1996, specifically.
forecasting market prices is challenging. In the Zimbabwe stock market during the year 2004, the
Each stock is determined by a number of additional WNN model and the SES model, as presented by Mpofu in
elements in addition to the buying and selling of stocks and 2012, were utilized for the purpose of forecasting stock
shares on stock exchanges. One such aspect is the closing prices. In their study, Gavrilov et al. (2004) employed the
price, which is crucial for predicting the price of the clustering stocks approach to classify a total of 500 stocks
company's stock the next day. The factors that affect stock derived from the Standard & Poor's 500 indices. The dataset
movements over time are related to one another and exhibit comprised 252 numbers, with one of them representing the
predictable patterns. Political stability and other opening stock price.
unanticipated events are among the economic factors that
have been researched for stock price forecasting.

979-8-3503-0816-7/23/$31.00 ©2023 IEEE 1


Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on November 06,2024 at 09:20:06 UTC from IEEE Xplore. Restrictions apply.
III. PROPOSED WORK of 0 indicates data loss, but a 1 indicates data storage for later
In order to forecast stock prices, the author of this study use.
examines the efficacy of several ML algorithms. Using
indicators that check for equality, the author converts stock
values to binary data from continuous forms and uses four
stock datasets using these formats. We will update the
dataset with 1 if the previous stock price is lower than the
current stock price; else, we will update it with -1.
A. LSTM .
1) Introduction to Long Short Term Memory Fig. 2. Forget gate
An RNN is synonymous with LSTM. In the context of
Recurrent Neural Networks (RNNs), it is a characteristic that b) Input Gate:
the current time step of the network receives input from the The primary role of the input gate is to facilitate the
output of the preceding time step. The Long Short Term incorporation of relevant information into the cell state. The
Memory (LSTM) was created by Schmidhuber and Sigmoid function is employed to regulate the data, and, akin
Hochreiter.The phenomenon of long-term reliance in to the forget gate, the inputs x t and h t-1 are utilized to filter
recurrent neural networks (RNNs) refers to the limitation of the values that require retention as shown in fig 3. The tanh
these models in accurately predicting words that are kept in function is employed to generate a vector including the
the long-term memory. However, RNNs are capable of complete set of potential values derived from x t and h t-1,
making several precise predictions by relying on recent exhibiting an output range spanning from -1 to +1.
input.The problem at hand was successfully resolved by the Ultimately, the values in the vector are subjected to
utilization of the Long Short-Term Memory (LSTM) model. multiplication by regulated values in order to provide
Recurrent Neural Networks (RNNs) exhibit reduced pertinent data.
efficiency when confronted with longer gap lengths. The
LSTM algorithm inherently possesses the capability to retain
information for an extended duration by default. The Long
Short-Term Memory (LSTM) model is commonly employed
in many applications such as time-series data prediction,
classification, and processing.
2) Structure of LSTM :
Examples of hierarchical structures used by algorithms
include Long Short Term Memory, which uses four neural
networks, or cells, and several memory blocks.

Fig. 3. Input gate

c) Output Gate:
The inputs to the system are represented by h t-1 and h t-
2 as shown in fig 4. The resultant output The role of Gates is
to extract significant information from the existing cell state
and provide it as the output. The hyperbolic tangent function
is employed to generate the vector output from the cell. The
data is thereafter subjected to value filtration for retention
and managed by the utilization of the sigmoid function.
Ultimately, the values of the vector are multiplied by
controlled values and thereafter utilized as both output and
Fig. 1. Structure of LSTM input for the subsequent cell.

The cells hold all the information, and the gates are
responsible for accessing and modifying that data, as seen in
figure 1.
There are three gates:–
a) Forget Gate:
When data from a cell's state is no longer required, the
forget gate is used to remove it. Here is the forget gate in Fig.
2. As seen in figure 2, the gate takes two inputs, x t and h t-1,
and multiplies them with the weight matrices before adding
the bias. The activation function receives the result from the
previous step and returns a binary value. A cell state's output Fig. 4. Output gate

2
Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on November 06,2024 at 09:20:06 UTC from IEEE Xplore. Restrictions apply.
IV. RESULTS

Fig. 8. page view of training and testing of dataset

Fig. 5. view page for 'Upload Stock Dataset' option The program is using 27,97 records for training and 30
records for testing out of the total of 27,97 records in the
Figure 5 shows how to load the dataset by returning to dataset on the top page. Once you have both the training and
the previous page and selecting 'Upload Stock Dataset'. testing data, you may train all of the algorithms using the
dataset given in figure 8 by clicking the "Run Continuous
Prediction" button..

Fig. 6. uploading of dataset

Figure 6 shows the screen that appears after selecting and Fig. 9. ANN and LSTM model
uploading the "petrol" dataset on the previous page. Then, to
access this dataset, click the "Open" button. In the screen shown in Figure 9, we have implemented an
ANN and LSTM model. Once the model is complete, we
will use it to predict the stock price for a 30-day test period.

Fig. 7. page view after uploading dataset

There were some missing values in the dataset that was Fig. 10. Forecasted values
loaded on the previous page. Using the 'Preprocess Dataset'
option, you may eliminate missing values and divide the From day 1 to day 30, we can see the actual and
dataset in half, making it suitable for training and testing. In predicted values in figure 10. It is clear that both sets of
Figure 7, you may see this screen. numbers are pretty similar, suggesting that LSTM is
accurately forecasting the stock prices. See the graph below
for the aforementioned actual and predicted values..

3
Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on November 06,2024 at 09:20:06 UTC from IEEE Xplore. Restrictions apply.
The results for continuous data are better when using
ANN and LSTM, as shown in Figure 13. Select "View
Comparison Table" from the screen's navigation bar to
access the table of comparisons.

Fig. 11. Forecasted values provides information on the accuracy, SCORE,


and ROC AUC values

As illustrated in Figure 11, the text part of the


aforementioned panel displays the accuracy, SCORE, and
ROC AUC values for all methods that use continuous data. Fig. 14. LSTM FSCORE
The accompanying graph shows the correlation between the
x-axis, which represents the number of days, and the y-axis, For continuous data, the LSTM FSCORE is near the top
which represents the stock price. While the green line shows of the screen. For binary data, it is seen below.
the expected price, the red line shows the current price. An
acceptable level of performance from the LSTM algorithm is
shown by the little discrepancy between the actual and
forecasted prices. Click the "Run Binary" button to continue.

Fig. 15. LSTM achieved 100% accuracy, FSCORE, and ROC AUC

The aforementioned screen shows that LSTM attained


100% accuracy, FSCORE, and ROC AUC when given
binary input. Figure 15 shows the compare and contrast
graph for all techniques' binary data.
Fig. 12. Graphs comparison with all algorithms

Just as in the previous screen, binary prediction yields the


best results; in the in-text area, we can see that the LSTM
accuracy is 1.0, meaning it is absolutely accurate. Figure 12
displays a graph of all algorithms; to see it, choose
"Comparison Graph" from the menu.

Fig. 16. LSTM outperforms all other algorithms in terms of output


outcomes

In the fig 16 graph, LSTM outperforms all other


algorithms in terms of output outcomes.
V. CONCLUSIONS
Everyone knows that there are a lot of variables that
influence the stock market, making it hard for traders to
anticipate when prices will go up or down. The project's goal
Fig. 13. ANN and LSTM are providing superior results for continuous data
is to reduce the danger of utilizing deep learning and

4
Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on November 06,2024 at 09:20:06 UTC from IEEE Xplore. Restrictions apply.
machine learning algorithms to predict stock market long short-term memory (LSTM), as models in both methods
movements. The 10 technical indicators that comprise our has been shown beyond a reasonable doubt.
input values are derived from a decade's worth of data and
serve two functions. The indicators are constructed using REFERENCES
continuous stock trading value data first, and then they are [1] J. J. Murphy, Technical Analysis of the Financial Markets: A
converted to binary. Finding ways to use deep learning and Comprehensive Guide to Trading Methods and Applications,
machine learning to predict how the stock market would Penguin, 1999.
behave was the driving force behind this study. The Tehran [2] T. Turner, A Beginner’s Guide To Day Trading Online, New York,
NY, USA:Simon and Schuster, 2007.
Stock Exchange's petroleum, diversified financials, non-
[3] H. Maqsood, I. Mehmood, M. Maqsood, M. Yasir, S. Afzal, F. Aadil,
metallic minerals, and basic metals markets were our four et al., "A local and global event sentiment-based efficient stock
choices. Ten years' worth of data across ten distinct exchange forecasting using deep learning", Int. J. Inf. Manage., vol.
technological domains made up the dataset used for the 50, pp. 432-451, Feb. 2020.
inquiry. [4] W. Long, Z. Lu and L. Cui, "Deep learning-based feature engineering
for stock price movement prediction", Knowl.-Based Syst., vol. 164,
In this work, we used nine distinct ML models for pp. 163-173, Jan. 2019.
prediction: Support Vector Classifier (SVC), Decision Tree, [5] J. B. Duarte Duarte, L. H. Talero Sarmiento and K. J. Sierra Juárez,
XGBoost, Naive Bayes, Random Forest, Logistic "Evaluation of the effect of investor psychology on an artificial stock
Regression, and K-Nearest Neighbors (KNN). Additional market through its degree of efficiency", Contaduría y
deep learning techniques used were Recurrent Neural Administración, vol. 62, pp. 1361-1376, Oct. 2017.
Networks (RNNs) and Long Short-Term Memory [6] Lu and Ning, A Machine Learning Approach to Automated Trading,
Boston, MA, USA:Boston College Computer Science Senior, 2016.
(LSTM).Our models were fed data that was both discrete and
continuous. Three distinct classification criteria formed the [7] M. R. Hassan, B. Nath, and M. Kirley, "A fusion model of HMM
ANN and GA for stock market forecasting", Expert Syst. Appl., vol.
basis of our assessment of these models. The model 33, no. 1, pp. 171-180, Jul. 2007.
outperforms continuous data when given binary input, [8] W. Huang, Y. Nakamori, and S.-Y. Wang, "Forecasting stock market
according to our analysis. The effectiveness of deep learning movement direction with support vector machine", Comput. Oper.
techniques, particularly recurrent neural networks (RNN) and Res., vol. 32, no. 10, pp. 2513-2522, Oct. 2005.

5
Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on November 06,2024 at 09:20:06 UTC from IEEE Xplore. Restrictions apply.

You might also like