Stock Price Prediction Using LSTM
Stock Price Prediction Using LSTM
Stock Price Prediction Using LSTM
ON
Stock Price Prediction Using LSTM
Submitted By:
Kunal Garg(00155102719)
Vipin(01655102719)
BACHELOR OF TECHNOLOGY
In
COMPUTER SCIENCE AND ENGINEERING
At
MAHAVEER SWAMI INSTITUTE OF
TECHNOLOGY
JAGDISHPUR, SONEPAT
1.1 Introduction
2. LITERATURE SURVEY
4. Design
4.3 DFD
6. Bibliography
Declaration
Science and Engineering from MVSIT hereby declare that the work
authentic record of our Work carried out during my degree under the
guidance of MS. SHRUTI MAM. The work reported in this has not
Vipin (01655102719)
Acknowledgement
We would like to express our deep gratitude to our guide Ms. SHRUTI for her
timely suggestions during the entire duration of our dissertation work, without
which this work would not have been possible. We would also like to convey our
deep regards to all other faculty members of BMCEM, who have bestowed their
great effort and guidance at appropriate times without which it would have been
very difficult on our part to finish this work. Finally, we would also like to thank
our friends for their advice and pointing out our mistakes, parents, and classmates
for their encouragement throughout our project period. And last but not least, we
successfully.
1. Problem Definition and Scope of Project
1.1 INTRODUCTION
People primarily buy stocks in the hope that their value will rise in the
future. However, there is always uncertainty in the stock market, which
makes people reluctant to invest their money in it. As a result, we require a
technique that can forecast stock market prices so that people can invest
their money.
1) The first step in the LSTM is to identify unnecessary information that will
be discarded from the cell state. A sigmoid layer makes this decision. This
layer is also known as the forget gate layer.
2) The following step determines what new information will be stored in the
cell state. The cell state is critical to the LSTM. This consists primarily of
two steps:
a) The input gate layer, a sigmoid layer, determines which values will
be updated.
b) Tanh layer generates a vector of new candidate values for that state.
The tanh function is a squashing function, which means it converts the
value to a value between -1 and +1.
3) To update the old cell state Ct-1 into the new cell state Ct, first multiply it
by Ft while forgetting the things we decided to forget earlier. Then we
multiply it by *Ct. This is the new candidate value, which is scaled
according to how much we decided to update each state value.
4) We will run a sigmoid layer to determine which part of the cell state we
will output. Then we run the cell state through tanh and multiply it by the
sigmoid state output to output only the parts we want.
1.2 MOTIVATION FOR WORK
Businesses are primarily concerned with customer satisfaction and product
reviews. Changes in social media sentiment have been shown to correlate with
changes in stock markets. Identifying and resolving customer complaints increases
customer satisfaction and an organization's trustworthiness. As a result, an
unbiased automated system is required to classify customer reviews about any
problem. Companies may have mountains of customer feedback collected in
today's environment, where we are understandably suffering from data overload
(though this does not imply better or deeper insights), but it is still impossible for
mere humans to analyze it manually without error or bias.
Companies with the best intentions are frequently trapped in an information
vacuum. You know you need insights to help you make decisions, and you know
you're lacking them, but you're not sure how to get them.
Sentiment analysis provides insights into the most important issues from
customers’ perspectives. Because sentiment analysis can be automated, decisions
can be based on a large amount of data rather than pure intuition.
Prediction methods are broadly classified into two types: statistical methods and artificial
intelligence methods. Statistical techniques include the logistic regression model, the ARCH
model, and others. Examples include multi-layer perceptron’s, convolutional neural networks,
naïve backpropagation networks, single-layer LSTM, support vector machines, recurrent neural
networks, and other artificial intelligence methods. They made use of a Long Short-Term
Memory Network (LSTM).
Forget Gate: A forget gate is responsible for removing information from the cell state.
• The information that is no longer required for the LSTM to understand things or information
that is less important is removed via a filter's multiplication.
• This is required for optimizing the performance of the LSTM network.
• This gate takes in two inputs; h_t-1 and x_t. h_t-1 is the hidden state from the previous cell, or
the output of the previous cell and x_t is the input at that particular time step
Input Gate:
1. Regulating what values need to be added to the cell state by involving a sigmoid function.
This is basically very similar to the forget gate and acts as a filter for all the information from hi-
1 and x_t.
2. Creating a vector containing all possible values that can be added (as perceived from h_t-1
and x_t) to the cell state. This is done using the tanh function, which outputs values from -1 to
+1.
3. Multiplying the value of the regulatory filter (the sigmoid gate) to the created vector (the tanh
function) and then adding this useful information to the cell state via addition operation.
Output Gate: The functioning of an output gate can again be broken down into three steps:
• Creating a vector after applying tanh function to the cell state, thereby scaling the values to the
range -1 to +1.
• Making a filter using the values of h_t-1 and x_t to regulate the values that need to be output
from the vector created above. This filter again employs a sigmoid function.
• Multiplying the value of this regulatory filter to the vector created in step 1 and sending it out
as output and to the next cell’s hidden state.
• n = len(dataset)
•
• error = 0
• for i in range(n): error += (abs(real[i] - pred[i])/real[i]) * 100
• accuracy = 100 - error/n
4. Design
4.1 System Architecture
5.11 Calculating LSTM output and Feeding it to the regression layer to get
final prediction
[1] Stock Price Prediction Using LSTM on Indian Share Market by Achyut Ghosh,
- Stock price prediction using LSTM, RNN and CNN-sliding window model -
2017.
[3] Murtaza Roondiwala, Harshal Patel, Shraddha Varma, “Predicting Stock Prices
[4] Xiongwen Pang, Yanqiang Zhou, Pan Wang, Weiwei Lin, “An innovative
[5] Ishita Parmar, Navan Shu Agarwal, Sheirsh Saxena, Ridam Arora, Shikhin
Market Prediction Using Machine Learning. [6] Pranav Bhat Electronics and
Savitribai Phule Pune University - A Machine Learning Model for Stock Market
Prediction.
[8] V Kranthi Sai Reddy Student, ECM, Sreenidhi Institute of Science and