Application of Machine Learning and Deep Learning Algorithms To The Prediction of Stock Market Trends
Application of Machine Learning and Deep Learning Algorithms To The Prediction of Stock Market Trends
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
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. 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..
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.
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. 15. LSTM achieved 100% accuracy, FSCORE, and ROC AUC
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.