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

Stock Price Prediction 2024

Very nice

Uploaded by

75sgrtnjwb
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)
17 views

Stock Price Prediction 2024

Very nice

Uploaded by

75sgrtnjwb
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
You are on page 1/ 6

A comprehensive analysis of Stock Price

Prediction Algorithms
1Aditya 2Ankita 3Sujal
Sharma Maitra
University Institute of Engineering University Institute of Engineering University Institute of Engineering
Chandigarh University Chandigarh University Chandigarh University
Mohali, India Mohali, India Mohali, India
[email protected] [email protected] [email protected]

4Mohita Gupta 5Ali Siddiqui 6Komal

University Institute of Engineering University Institute of Engineering University Institute of Engineering


Chandigarh University Chandigarh University Chandigarh University
Mohali, India Mohali, India Mohali, India
[email protected] [email protected] [email protected]

Abstract— The allure of potential returns in the stock market is developments in the machine learning field offer a persuasive
tempered by its inherent risks, prompting investors to seek tools counterpoint.
that can offer insights into future price movements. Traditional
statistical methods, while foundational, often fall short in Stock price analysis has often been constructed by statistical
capturing the nonlinear and complex dynamics of markets. In tools, which include moving averages and Bollinger Bands,
response, the burgeoning field of machine learning (ML) has and this is based on a solid foundation. Unfortunately, they
emerged as a potent ally in stock price prediction. This paper cannot account for the non-linearity and complexity of
delves into the application of ML in stock price prediction, markets, something documented throughout academic
presenting a comprehensive comparative analysis of leading finance literature. This has propelled AI models that have
models. We first elucidate the rationale behind employing ML learned patterns from large datasets to now emerge as
for this purpose, highlighting the multifaceted nature of the powerful tools in predicting stock prices.
stock market and the limitations of conventional statistical tools.
The high dimensionality and presence of rational and irrational One important area of the utilization of machine learning in
components in the market environment make it fertile ground stock price prediction is deeply analyzed in this research
for ML algorithms adept at pattern recognition. Drawing from paper. In order to conduct an objective and thorough
academic finance literature and leveraging large datasets, ML comparative analysis of a number of leading models, we start
models have demonstrated prowess in discerning intricate with an explanation of why ML can be used to predict stock
market patterns and forecasting price movements. We conduct prices. In turn, the complex nature of the stock market
an objective assessment of various ML approaches, evaluating environment, characterized by high dimensionality and the
their efficacy in navigating the complexities of the stock market presence of both rational and irrational components, lends
landscape. Through this comparative analysis, we aim to provide itself perfectly to being solved by pattern recognition tools
investors and researchers with valuable insights into the that are very powerful at processing ML algorithms.
strengths and limitations of different ML models for stock price
prediction. By shedding light on the evolving intersection of Here comes the next part, where we would like to highlight
finance and artificial intelligence, this research contributes to a the giants in the stock price prediction niche – ML models. It
deeper understanding of predictive analytics in financial is linear regression, a primitive model which will be
markets and informs decision-making processes in investment considered as a benchmark to compare with. Subsequently,
strategies. we demonstrate some of the more advanced approaches such
as:
Keywords— (Stock Price Prediction, Deep Learning, Linear
Regression, K- Nearest Neighbour’s, Support Vector Machine, Support Vector Machines (SVMs): Models for support
Machine Learning, long short-Term Memory(LSTM) ) vector machines (SVMs) are adept in their capabilities of
uncovering hyperplanes, which then serve to separate data
I. INTRODUCTION points belonging to different classes effectively, thus
The stock market has its potential returns as the main allowing them to learn complicated decision boundaries and
attraction. But the lure of these rewards is intermingled with potentially discover obscure patterns in financial data.
their ever-present dangers. In their ceaseless attempts to
manoeuvre this ever-changing scene, investors have always Decision Trees: Intuitive models are usually a mimicry of the
been in search of ways that will help them understand what tree structure, and every node in that tree is the basis of a
future prices of stocks are likely to be. Although it is hard to decision based on some characteristic feature from the data.
predict or anticipate perfectly how a market will behave, The traversal along this tree leads to an output that could be
given its multifaceted nature and myriad underlying factors,
easily interpreted and also provides transparency about and statistical techniques like ARIMA and linear regression,
decision-making steps. which served as benchmarks against more advanced machine
learning (ML) paradigms. ML techniques including support
vector machines, decision trees, and random forests, showed
Random Forests: Ensemble methods like Random Forests
promise in predicting stock movements, especially when
use the wisdom of many multiple decision trees created
combined with sophisticated feature engineering.
independently to get better predictions of higher accuracy and
Additionally, deep learning architectures like recurrent neural
robustness than a single tree.
networks and convolutional neural networks emerged as
potent tools, excelling at learning patterns from sequential
K-Nearest Neighbours (KNN): KNN is known to classify data. Graph-based methods, such as graph neural networks
data points through their proximity or similarity to their and network analysis techniques, offered a novel approach by
closest k neighbour’s in the training set. In the context of representing financial markets as complex networks.
stock price prediction, KNN could spot resembling historical However, challenges such as market volatility and the
patterns and apply these findings to predict future trends. integration of unstructured textual data persisted,
necessitating interdisciplinary collaboration between experts
Artificial Neural Networks (ANNs): ANS are in ML, finance, and natural language processing to overcome
interconnected layers of artificial neurons which are derived them. In conclusion, the paper underscored the dynamic and
from the structure and function of the human brain. They can evolving nature of research in leveraging news sentiments for
comprehend such intricate dynamics of the stock market due stock market prediction, highlighting the need for further
to their ability to learn complex non-linear relationships exploration and innovation in this field.
within data through a process known as backpropagation,
using its resultant networks that operate in parallel. Yoney Kirsal Ever1, Kamil Dimililer, and Boran
Specifically, Long Short-Term Memory (LSTM) network Sekeroglu[2] discussed various different techniques and
architectures have proven effective for stock price prediction algorithms that can be used to predict stock prices in their
tasks on sequential data. paper titled as “Comparison of Machine Learning Techniques
for Prediction Problems.” The paper's exploration delved into
Thus, this paper will offer a comparative analysis of the the intricacies of machine learning techniques for prediction
strengths and weaknesses of each model. Their mathematical tasks, seeking to unravel the complexities inherent in
frameworks, how they handle different types of data like selecting the most suitable approach for diverse problem
historical prices, technical indicators, news sentiment etc., domains. By conducting preliminary experiments on a varied
and computational efficiency will be examined. array of datasets, ranging from real estate evaluation to
financial forecasting, the study provided a comprehensive
This work has implications for investors and financial analysis of the performance of four widely-used ML
institutions alike. In doing this, we hope to identify the most algorithms. The findings revealed that while fluctuations in
appropriate approach in predicting stock prices by carefully dataset instances did not directly influence technique
assessing the performance of these models on real-world performance, the underlying characteristics of the datasets
datasets. The accuracy and robustness of predictions made by played a pivotal role in shaping prediction rates. Notably,
each model will be assessed using metrics such as mean neural network algorithms emerged as frontrunners,
squared error (MSE), mean absolute error (MAE), and demonstrating superior predictive capabilities, especially
directional accuracy (DA). with back-propagation and radial basis function architectures.
These algorithms showcased not only higher prediction rates
but also maintained stability across different datasets.
Therefore, this research holds great significance for investors
Conversely, decision tree regressors, while widely adopted,
and financial institutions who would want to leverage
exhibited comparatively lower and less consistent
information obtained from this comparative analysis. By
performance. Support vector regression, though delivering
doing so, they may reduce risks associated with making
stable results, fell short of achieving optimal rates across all
uninformed decisions.
datasets, underscoring the need for further refinement. The
paper's insights hold significant implications for practitioners
and researchers alike, offering valuable guidance in
II. LITERATURE REVIEW navigating the intricate landscape of machine learning
techniques for prediction tasks. Furthermore, the delineation
Ritesh Kumar Shukla, Suruchi Talwani[1] discussed of future research directions, including the expansion of the
predicting the stock prices in their paper titled as “ Prediction dataset pool and the exploration of additional ML
of Stock Price Market Using News Sentiments By Machine methodologies like linear regression and long-short term
Learning.” The paper comprehensively explored the memory networks, promises to deepen our understanding and
utilization of news sentiments for predicting stock market enhance prediction accuracy in diverse problem domains. In
movements, elucidating the evolution of methodologies, essence, the paper represents a pivotal contribution to the
addressing prevalent challenges, and outlining future evolving discourse on machine learning applications in
research directions in this domain. It surveyed traditional predictive analytics, laying a solid foundation for future
approaches such as econometric models endeavors aimed at pushing the boundaries of prediction
accuracy and efficacy.
Malti Bansal, Apoorva Goyal, Apoorva Choudhary[3] Prices using Machine Learning (Regression, Classification)
introduced a series of algorithms to predict the stock markets Algorithms.” The paper takes the challenge of entering the
and conducted a number of experiments to validate them. bumpy world of ML with its advanced techniques of the very
They published in the paper, with the title “Stock Market latest development in the deep-learning technologies. The
Prediction with High Accuracy using Machine Learning common denominator in an environment that's never static is
Techniques”. The paper aimed to better understand the stock finding amongst the investors on their way to a successful
market prediction process using Machine Learning and Deep trading the right path that will show them the mysteries of
Learning algorithms. The challenging landscape of market financial markets. Blessed with a prosperous and detailed
investment in the presence of market volatility and the database invested with Yahoo Finance, the study is aimed at
environment of uncertainty introduced the area to refine discovering the secrets behind wooly movements in stock
predictive models. The high rate of uncertainties meant that prices.
predictive models need to improve if investors aim to address
issues associated with the financial investment. The research With a keen focus on the esteemed Apple stock, revered for
focused on the data from 12 famous companies in the Indian its influence and significance in the market, the study delves
stock market. The data collection involved a five-year deep into the realms of data preprocessing, diligently
period of stock price data. This attention to detail has incorporating essential attributes such as momentum,
guaranteed that the dataset is rich and comprehensive enough volatility, and sector details to enrich the analytical
to serve as a solid basis for further analysis. Using an orderly framework. Through rigorous experimentation and analysis,
process, the paper has meticulously described the an array of ML models is put to the test, each vying for
methodology, the research has meticulously mapped out the supremacy in the realm of predictive accuracy. Amidst this
steps involved in the analysis. Such transparency played a rigorous evaluation, the Logistic Regression Model emerges
crucial role not only in establishing the study’s validity but in as the shining star, boasting a remarkable maximum mean
its repeatability. All the future researchers will now simply accuracy of 68.622%. These groundbreaking findings not
follow the established roadmap and carry out their own only underscore the transformative potential of ML
analysis based on the one published in this paper. Therefore, methodologies but also provide a beacon of hope for
the essential part of the paper was the extensive comparative investors, offering invaluable insights to inform their
analysis of five separate ML and DL algorithms: K-Nearest investment decisions with confidence and clarity. Upon the
Neighbors, Linear Regression, Support Vector Regression, basis of the work done there would be created new research
Decision Tree Regression and Long Short-Term Memory. projects to test and improve the existing predictive models
and the very same work we can safely call a milestone on the
way to the ultimate accuracy of the models which are
Through robust methodologies in which the selected becoming more and more applicable in the world of ever-
algorithms are evaluated, the study aimed to provide new and changing financial markets. Through employing data-
critical understanding into the strength and weakness of the oriented intelligence and advanced technological tools,
subject algorithms in the context of stock price prediction. investors find themselves more to confront the volatility of
The presented results from the comparative analysis, the stock market and are armed with a newfound ability to
represented in tables and graphs, provide vital understanding predict market changes. This is probably a new time to make
on the performance outcomes and delivery of both investment decisions, which are based on forecasting and
algorithms. Most importantly, the study has indicated the knowledge.
capacity of DL algorithms, more specifically Long Short-
Term Memory, in proper forecasting of stock prices due to its Md. Hafizur Rahman, Sayeda Islam Nahid, Ibna Huda Al
ability to capture complex temporal relationships inherent in Fahad, Faysal Mahmud Nahid[5] used stock prices as data to
the data as well as the subtle patterns. train LSTM based ML models in the paper named as “ Stock
Price Prediction Using LSTM Based Machine Learning
Models.” The paper explored the concept of stock price
prediction through employing LSTM based machine learning
The acquired insights enabled investors to develop a broader
models to forecast future movement of the markets The
insight into the forecasting abilities of the various algorithms,
research contrasts with the mainstream technical analysis,
allowing them to make better-informed decisions when it
which focuses on trend detection and presents a predictive
comes to their investments. Overall, the aforementioned
model for the Dhaka Stock Exchange 30 companies built on
research significantly aided in furthering the possibilities of
the foundations of historical data from the DSE30 index. We
stock market forecasting while creating the foundation for
came up with many LSTM architecture designs to predict the
future research in this area. As a result of clarifying the
stock prices based on the setting of a training period, that is,
possibilities of ML and DL in terms of enhanced forecasting
from January 2019 to January 2021. By means of tireless
accuracy, the paper provided a solid foundation for the future
examination and processing, the study gave us invaluable
development and improvement of predictive models. In the
thoughts about the LSTM-based machine learning's ability to
long term, it will lead to a more stable, reliable, and efficient
predict stock movement, therefore, the investors are
financial system.
empowered to utilize the tools given in this trail for their
advantage in making economic decisions. Going along, these
results illustrated the impressive capabilities of LSTM
S.Ravikumar, P. Saraf[4] proposed a technique to predict
models in this field, opening a new area of opportunity to take
stock prices in their paper titled as “Prediction of Stock
better decisions in
stock market trading and to develop better forecasting might be. Nonetheless, since it assumes that the connection
strategies. between the variables is always perfectly straight and simple,
it may not pick up on all of the market’s twists and turns.
Haorui Zhang[9] talks about applications like linear Furthermore, unexpected market movements or unforeseen
regression and LSTM neural network to predict the prices of occurrences may put a wrench in the gears of these
stock shares, in his paper named as “Forecasting Stock Prices predictions. Although linear regression helps establish a basic
using Linear Regression and LSTM Neural Network”. The understanding of stock price patterns, it is frequently
article explored the stock price prediction dynamic in combined with other methods or tweaked with more data to
comparison with linear regression model and Long Short- create patterns that are more adaptable and realistic in
Term Memory (LSTM) neural network model to foretell the response to real-world market events.
stock price of Amazon. Striving to develop models accessible
to individual investors, the study utilized historical stock SVM:
price data from the company as the sole data source. In order to predict stock prices, an SVM model should be
Evaluation of model performance was conducted using created. SVM is a machine that aims to divide the data into
metrics such as Mean Squared Error (MSE), Mean Absolute two groups: one is for rising prices, and another is for falling
Error (MAE), Root Mean Squared Error (RMSE), and R- prices with an efficient mean. This algorithm does that by
squared (R2). Surprisingly, the findings revealed that in using a hyperplane that wins to split the classes, and it does
scenarios with limited data sources, the simplistic linear so by maximizing the distance between them. This distance
regression model outperformed LSTM models. Additionally, is determined using past stock data and other related factors,
within the LSTM neural network framework, it was observed including trading volume, technical indicators, and economic
that Single Layer LSTM exhibited superior performance conditions. The task is to model a line on a graph that will
compared to Multi-layer LSTM and Bi- directional LSTM separate two sets of points while maximizing the distance
architectures. Furthermore, the study highlighted the between them. Yet, SVM can perform poorly with big
significance of epoch values in LSTM models, with those set datasets and noisy data as the proper choice of kernel is
at 200 proving more favourable in stock price prediction essential to the SVM performance. Overall, SVM appears to
compared to values of 50 or 500. The application of be a sound theoretical framework for stock price prediction
Bidirectional LSTM and Multi-layer LSTM in stock price but can combine with other techniques and ensemble
prediction also provided insights into potential parameter approaches to improve the predictability of the method and
setting optimizations. This study aimed to develop more tackle market behaviour complexity.
efficient stock price prediction techniques by running a
comparison between linear regression and LSTM neural KNN:
network paradigm which is aimed at forecasting the stock
price of Amazon. The study retrospectively analyzed the One way to predict stock prices using k-Nearest Neighbours
performance of a given model in the financial markets in algorithm is to take a look at the historical data of similar
order to provide inputs on how better to enhance future stock price movement from which to predict the next trend.
predictive modelling efforts to address issues in financial In this approach, historical data points are represented in a
markets. This study undoubtedly helped in providing multi-dimensional space based on various features such as
valuable insight into a landscape of stock price prediction, trading volume, price momentum, technical indicators,
which is useful to the investors and researchers in every way through which future stock prices are represented. When it
to cope up with the complexities of the financial markets. comes to predicting a new data point ; a future stock price,
the KNN algorithm identifies the k nearest neighbors from
the above representation and decides the class or value based
III. METHODOLOGY on the average or weighted average of the outcomes. The
structure of the KNN model becomes computationally
Machine learning methods are as critical in predicting stock inefficient for large datasets, and it does not consider the
prices since they use historical data to determine patterns and identifications carefully. Moreover, it requires a good
tendencies that help predict future prices. They are selection of the number of neighbors and the distance metric.
exceptional in selecting features to predict, like trading
volume, price momentum, and news and social media tones Deep Learning (LSTM)
from news and twitter remarks. They help to create automatic
trading techniques by including professional analysis Long Short-Term Memory networks are a kind of recurrent
indicators and utilizing reinforcement learning in algorithmic neural network architecture. LSTMs are primarily used in
trading. This method helps investors become more prudent predicting stock prices. LSTMs were created to tackle the
and take advantage of market openings as they occur in actual issue of long-term dependencies in an RNN layer. In brief,
time, greatly improving the efficacy and accuracy of stock LSTM cell takes in info, processes it in three steps, retains
price estimation. some of it, alters some of it, and produces a new output, as
shown in . An LSTM model is used in stock prediction and
Linear Regression: analyses multiple strategies using diagnostic indicators.
Linear regression to predict stock prices based on historical Meanwhile, computing future stock prices is a way to gain
stock data and other factors like trading volume and this using excluded trends. Thus, diagnostic indicators can
economic indicators is analogous to drawing a straight line performance of LSTM models on stock price predicting .
through historical points to predict where the next point
K-Nearest Neighbors (KNN):
IV. COMPARITIVE ANALYSIS OF ALGORITHMS
Because it is based on similarity theory, K-Nearest
Neighbours is a simple yet effective algorithm that is
Linear Regression frequently used for stock price predictions. The stock price
is forecasted by averaging out the prices of the k nearest
Linear regression is a method used to predict stock prices data points. Symbolically, this is written as . KNN is
by establishing a straight line connection between straightforward to understand and set up, with low
independent variables (features) and the dependent variable prerequisites for data initiatives and few assumptions about
(stock price). The algorithm creates an equation based on data distribution . This makes KNN ideal for detecting
observed data to minimize the gap between predicted trends in high-dimensional datasets and correlation issues.
values. In terms this can be expressed as y=mx+c, where y As the amount of data and the dimensions of the data
represents the predicted stock price x denotes the increase so does the amount of data that needs to be
variable(s) m stands for the slope of the regression line and retrieved. Therefore, KNN might lead to inefficiency
c is the intercept. While linear regression is valued for its calculation when scaled to extensive data.
simplicity and ease of interpretation in analyzing
relationships between features and stock prices it may Long Short-Term Memory (LSTM) Neural Network:
struggle with capturing trends in stock price data, which
can limit its predictive accuracy, in complex market Another subset of RNNs that is tailored to stock price
scenarios. prediction is LSTM . LSTM is a specialized type of RNN
used for time-series data analysis because its architecture
Support Vector Machine (SVM): can capture all the temporal dependencies and sequential
patterns. Its architecture can also be seen as one of the best
Support Vector Machines (SVMs) are machine learning architectures developed for stock price forecasting. LSTM
tools known for their effectiveness in predicting stock uses forget, input, and output gates to learn and forget
prices. These algorithms excel at analyzing datasets by information over time. Just as previously discussed on
determining the hyperplane that maximizes the gap RNN, there are some mathematical formulas used to learn
between different sets of data points. In the realm of stock the relationships to be involved, normally element- wise
price forecasting SVMs aim to establish a dividing line that multiplications and addition at the LSTM cells and other
categorizes price changes into groups like "buy" or "sell." activation functions like the sigmoid and tanh functions.
From a perspective SVMs work to increase the distance Large volumes of data are needed for training and fine-
between support vectors and the decision boundary while tuning LSTM models, and they may be prone to overfitting.
reducing classification errors. One of their strengths is their Nevertheless, their ability in capturing long- term
ability to handle outliers and classify data accurately which dependencies and subtleties in stock price data is
allows them to capture patterns within stock price trends. unmatched, making them essential tools for precise stock
price prediction.

Parameter Regression SVM KNN LSTM

Complexity Low Medium to High Low High

Interpretability High Low Low Low

Nonlinearity Limited High Moderate High

Handling Sensitive Robust sensitive Sensitive


Outliers

Performance May Good Highly dependent Highly dependent on data


underperform on data distribution
with nonlinear distribution
data

Competency Low High Moderate to high High

Efficiency Low Low Moderate Moderate to high


Training Time Low High Moderate High

Prediction Low Low Moderate Moderate to high


Time

Data size Small to medium Small to medium Small to medium Suitable for large datasets
size datasets size datasets size datasets

Strength Simple, Handles complex Intuitive, easy to Captures temporal


interpretable nonlinear data well implement, No dependencies, time-series data
explicit model
training

Limitations Non-linear data Computationally Sensitive to Requires large amount of data


cannot be intensive, less outliers and for training and tuning, leads to
handled interpretable intensive overfitting

5) M. H. Rahman, S. I. Nahid, I. H. Al Fahad, F. M.


Nahid and M. M. Khan, "Price Prediction Using
LSTM Based Machine Learning Models," 2021
IEEE 12th Annual Information Technology,
REFERENCES Electronics and Mobile Communication
Conference (IEMCON), Vancouver, BC, Canada,
1) R. K. Shukla, S. Talwani, M. Rakhra, G. Dhiman 2021.
and A. Singh, "Prediction of Stock Price Market 6) Manoshi Das Turjo, Mohammad Monirujjaman
Using News Sentiments By Machine Learning," Khan et al., "Smart Supply Chain Management
2023 10th IEEE Uttar Pradesh Section Using Blockchain and Smart Contract", Scientific
International Conference on Electrical, Programming, vol. 2021, pp. 12, 2021.
Electronics and Computer Engineering 7) B. M. Henrique, V. A. Sobreiro and H. Kimura,
(UPCON). "Stock price prediction using support vector
2) Kirsal Ever, Y., Dimililer, K., Sekeroglu, B. regression on daily and up to the minute prices",
(2019). Comparison of Machine Learning The Journal of finance and data science, vol. 4,
Techniques for Prediction Problems. In: Barolli, no. 3, pp. 183-201, 2018.
L., Takizawa, M., Xhafa, F., Enokido, T. (eds) 8) M. Vijh, D. Chandola, V. A. Tikkiwal and A.
Web, Artificial Intelligence and Network Kumar, "Stock closing price prediction using
Applications. WAINA 2019. Advances in machine learning techniques", Procedia
Intelligent Systems and Computing, vol 927. computer science, vol. 167, pp. 599-606, 2020.
Springer, Cham. 9) H. Zhang, "Stock Price Prediction using Linear
3) Malti Bansal, Apoorva Goyal, Apoorva Regression and LSTM Neural Network," 2022
Choudhary, Stock Market Prediction with High International Conference on Machine Learning
Accuracy using Machine Learning Techniques, and Intelligent Systems Engineering (MLISE),
Procedia Computer Science, Volume 215, 2022, Guangzhou, China, 2022.
Pages 247-265, ISSN 1877-0509. 10) A. I. Al-Alawi and Y. A. Alaali, "Stock Market
4) S. Ravikumar and P. Saraf, "Prediction of Stock Prediction using Machine Learning Techniques:
Prices using Machine Learning (Regression, Literature Review Analysis," 2023 International
Classification) Algorithms," 2020 International Conference On Cyber Management And
Conference for Emerging Technology (INCET), Engineering (CyMaEn), Bangkok, Thailand,
Belgaum, India, 2020. 2023.

You might also like