Stock Prediction Analysis Using LSTM
Stock Prediction Analysis Using LSTM
Authors
Sushruta Mishra
Oindrila Ajha
Tiyasha Dutta
Souryadipta Das
Soham Das
Presented by Co-author
Oindrila Ajha
1. INDEX:
● INTRODUCTION
● LITERATURE REVIEW
● HIGHLIGHTS OF THE PAPER
● PROPOSED METHODOLOGY
● RESULTS AND DISCUSSION
● COMPARATIVE ANALYSIS WITH OTHER MODELS
● CONCLUSION AND FUTURE SCOPE
● REFERENCES
2. ABSTRACT:
Stock analysis is a way for traders and financial experts to study the stock market and make smart decisions
about buying and selling shares. It involves doing thorough research to understand how well a stock or an
industry is performing before making any investments. There are two main types of stock analysis: technical
and fundamental. Technical analysis uses past market data and charts to predict how stocks might behave in
the future. On the other hand, fundamental analysis looks at a company's data, like its financial history and
how it makes money, to figure out if it's a good investment. The main goal of stock analysis is to pick the best
times to buy and sell stocks. Traders might focus on one type of analysis or use both. No matter the method,
doing careful research is really important to make wise investments and avoid losing money.
Keywords - Stock Analysis, Technical analysis, Shares, Predict future advances, fundamental analysis, revenue
streams, traders, investments
3. INTRODUCTION:
In essence, prominent quantitative traders with substantial capital engage in the practice of purchasing stocks, futures, and
equities at discounted rates and subsequently selling them at premium prices. While discussions about trends in stock market
forecasting are not novel, investors commonly undertake two distinct types of stock analysis before making purchase
decisions. The first is fundamental analysis, where investors evaluate a stock's intrinsic value in conjunction with factors such
as market conditions, the economy, and the political landscape. Conversely, technical analysis delves into market data,
examining past prices and volumes to trace the evolution of equities. The increasing significance of machine learning in various
industries has motivated traders to apply these methodologies to the stock market, yielding positive results in some instances.
This essay outlines the creation of a program for predicting financial data, utilizing a dataset comprising historical stock price
data for algorithm training. The primary goal of these predictions is to mitigate uncertainty associated with investment strategy
selection.
The stock market, often characterized by a random walk, presents challenges in forecasting due to volatility. Investor
confidence is notably impacted by the volatility of stock market indices, attributed to the dynamic and unpredictable nature of
stock values influenced by various factors. Machine learning has been employed in endeavors to predict stock values, with
research projects having distinct goals, such as short-term, long-term, or quick predictions, focusing on specific stocks,
industries, or general trends. Two prediction types, dummy predictions based on established rules and real-time predictions
utilizing internet-derived stock prices, are employed in stock market prediction systems. Notably, machine learning methods,
particularly the LSTM algorithm in Python, have been introduced for forecasting the stock market, leveraging advancements in
4. LITERATURE REVIEW :
REFERENCE MODEL KEY FEATURES TRAINING DATA ACCURACY
[1] HYBRID Model Sentiment analysis and Historical stock price >90%
technical indicators data
[2] SVR and MACD Model Support vector Historical stock price >80%
regression and moving data
average convergence
divergence
[3] LSTM and RF Model Long short-term Financial data and >80%
memory and random textual data from news
forest articles
[4] LSTM and BOW Model Long short-term Financial news articles >80%
memory and bag-of- and stock price data
words
[5] LSTM and Sentiment Long short-term Financial news articles >88%
Analysis Model memory and sentiment
analysis
4. LITERATURE REVIEW :
REFERENCE MODEL KEY FEATURES TRAINING DATA ACCURACY
[6] ARIMA and Big Data Autoregressive integrated Stock price data, news articles, >80%
Analytics Model moving average and big data social media data, economic
analytics indicators
[7] Linear Regression and Linear regression and long Financial news and technical Improvement
LSTM Model short-term memory indicators in accuracy
[8] Sentiment Analysis of Sentiment analysis of tweets Social media data, technical Improvement
Tweets Model and technical indicators indicators in accuracy
[10] Technical Indicators Moving averages, relative Stock data from the Indian stock Outperformed
and Sentiment Analysis strength index, stochastic market established
Model oscillator, and sentiment approaches
analysis
5. HIGHLIGHTS OF THE PAPER:
Some main highlights of our stock prediction model that uses moving average deep learning technique (LSTM) and Python
Streamlit are:
1. Advanced Predictive Analysis: Our stock prediction model is equipped with deep learning capabilities, specifically utilizing
LSTM algorithms, to analyze vast amounts of historical stock data. This in-depth analysis helps identify patterns that can
aid in making predictions about future stock prices.
2. Diverse Data Sources: The model offers the flexibility to work with multiple datasets from the yfinance library. This allows
traders to examine stock prices from various companies and sectors, enabling them to make well-informed comparisons
and decisions.
3. User-Friendly Streamlit Dashboard: We've created an interactive Streamlit dashboard that simplifies the process of
visualizing predicted stock prices alongside actual data. This feature empowers users to easily track trends over time,
making it a valuable tool for traders.
4. Easy Customization: Built with Python, our model is incredibly user-friendly and highly customizable. This means you can
easily tweak it to fit your specific needs, integrate it with other data sources, and even enhance its functionality with
additional analytical tools.
5. LSTM Precision: Our model stands out for its accuracy in predicting stock prices, thanks to the power of LSTM deep
learning techniques combined with moving averages. Traders can rely on these accurate predictions to make well-
informed investment decisions across a diverse range of industries and companies.
Overall, this model can offer traders a powerful and flexible tool for analyzing and predicting stock prices across a wide range of
industries and companies.
6. PROPOSED METHODOLOGY : 1. Raw Stock Data: Unprocessed and uninterested information on stocks and
the stock market is referred to as "raw stock data." Data that is recorded and
reported by financial institutions, media outlets, and data providers includes
stock prices, trade volumes, business financial reports, and other measures.
2.Data Cleaning and Preprocessing: The actions taken to prepare raw data
for analysis are referred to as data cleaning and preprocessing. This
procedure entails cleaning up any errors, discrepancies, or missing numbers
from the data and converting it into a format that can be used for analysis.
3.Expansion of Available features: Data cleaning and preprocessing are the
procedures used to get raw data ready for analysis. This process comprises
fixing any mistakes, conflicts, or missing data from the data and transforming
it into an analysis-ready format.
4.Refining relevant features: Refining relevant features is an important
process used in data analysis to improve the accuracy and efficiency of the
model by highlighting the essential elements in the dataset.
5.Dimension Reduction using Principal Component Analysis (PCA):
Dimension reduction is an important tool in data analysis. It involves
minimizing the number of features in a dataset while retaining the important
data and PCA or Principal Component Analysis is a most popular method for
data reduction.
6. PROPOSED METHODOLOGY : 6.High Weighted Features Extraction: High weighted feature extraction is a
technique used in data analytics to identify and rank the most important
features in a dataset. Weights are related to features which are extracted
from the dataset depending upon their importance of the analysis. And the
features having the maximum weights are used for further investigation.
7.Model Building using Convolution Neural Networks, Long Short-Term
Memory (LSTM), or a combination of both: For the analysis of complex data,
such as photos, videos, or time series data, model creation utilizing
convolutional neural networks (CNNs), long short-term memory (LSTM), or a
mix of the two is a potent method.
8.Hyper parameter tuning to obtain better results: In order to enhance the
performance of a machine learning model, hyper parameter tuning involves
optimizing the values of the hyper parameters. Hyper parameters are settings
made before the model is trained and cannot be discovered through data
learning. The model's learning rate, regularization intensity, number of
hidden units, number of layers, and other parameters are controlled by them.
9.Training the model with respect to time on stock datasets: Using past stock
price data, one can forecast future stock prices by training a model on stock
datasets. The length of time the model is trained over is a crucial factor to
take into account when training a model on stock datasets.
6. PROPOSED METHODOLOGY :
10.Evaluating the stock data model: A stock data model's predictive accuracy
must be measured in order to evaluate it. In this context, a number of
frequently used evaluation measures are employed, including Mean squared
error (MSE), Mean absolute error (MAE), R-squared (R2), Sharpe ratio, and
Profit and loss (P&L).
11.Testing the stock data model: A stock data model is tested by comparing
its performance to results from a fresh, unrelated dataset that was not used
in the model's development. To make sure that the model's performance is
not biased towards the training data and that it can generalize effectively to
new, untested data, it is crucial to do this.
12.Visualization of the stock data model: Visualizing the stock data model
means using graphs and charts to show and understand how well the model
predicts and performs. This visual approach helps us see patterns and trends
in the data and pinpoint where the model might need some tweaks for better
results.
7. RESULTS & DISCUSSION:
Some of the few things to remember are firstly, predicting stock price or movement is a very challenging endeavor.
● Personally, it is believed that any of the stock prediction models available should be taken for granted or relied upon
without careful consideration. However, models might be able to accurately forecast changes in stock price.
● Secondly, avoid falling for publications that display forecast curves that perfectly overlap actual stock values. This is
meaningless in practice and can be duplicated with a straightforward averaging technique. Predicting the swings of the
stock price is a more sensible course of action.
● Lastly, the findings you get have a huge impact on the model's hyper-parameters. Running certain techniques on the
hyper-parameters would therefore be a really excellent idea.
10. REFERENCES :
1. "A hybrid machine learning model for stock price prediction using sentiment analysis and technical indicators," by V. Sharma et al. (2021). DOI:
10.1109/ICAS51307.2021.9415016.
2. "Stock price prediction using machine learning algorithms and technical analysis," by S. S. Gupta and S. Kumar (2021). DOI:
10.1109/ICPS48432.2021.9483429.
3. "Stock price prediction using machine learning algorithms with financial and textual data," by Y. Zhao et al. (2020). DOI:
10.1016/j.procs.2020.09.129.
4. "Machine learning-based stock price prediction using financial news articles," by S. Kwon and J. Lee (2020). DOI: 10.1016/j.dcan.2019.07.005.
5. "Stock price prediction using machine learning and sentiment analysis," by H. A. Alzahrani et al. (2020). DOI: 10.1007/978-3-030-49190-1_31.
6. "Stock price prediction using machine learning algorithms and big data analytics," by T. Gao et al. (2019). DOI: 10.1016/j.future.2019.06.027.
7. "A machine learning-based stock price prediction model using financial news and technical indicators," by J. Liu et al. (2019). DOI:
10.1109/ICMLA.2019.00139.
8. "A stock price prediction model using machine learning algorithms and social media analysis," by Z. Ma et al. (2019). DOI: 10.3390/app9224851.
9. "A comparative study of machine learning techniques for stock price prediction," by S. Selvin et al. (2018). DOI: 10.1109/ICRIS.2018.8598704.
10. "Stock price prediction using machine learning techniques and time series analysis," by G. Jain and S. Kumar (2017). DOI:
10.1109/ICCSP.2017.8286499.
THANK YOU!