0% found this document useful (0 votes)
80 views4 pages

Forecasting Stock Prices Using LSTM and Web Sentiment Analysis

Uploaded by

Vipul Singh
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)
80 views4 pages

Forecasting Stock Prices Using LSTM and Web Sentiment Analysis

Uploaded by

Vipul Singh
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/ 4

© July 2020| IJIRT | Volume 7 Issue 2 | ISSN: 2349-6002

Forecasting Stock Prices using LSTM and Web Sentiment


Analysis

Karan Sharma
Department of Computer Science and Engineering, Galgotias University

Abstract— The craft of estimating the stock prices has dynamically after some time with high prediction
been a troublesome task for huge numbers of capacity.
researchers and analysts. Indeed, investors are The paper that we have introduced demonstrated and
profoundly interested in the exploration area of stock
predicted the stock returns of NIFTY 50 using
price prediction. For a good and fruitful investment,
LSTM. I have gathered 5 year of recorded data of
numerous investors are sharp in knowing the future
circumstance of the stock market. An effective system NIFTY 50 and utilized it for the training and
for the stock market helps traders, investors, and validation purposes for the model. The next segment
analysts by giving strong information like the future of the paper will be methodology where we will
direction of the stock market. In this work, I am clarify about each procedure in detail. From that
presenting a Recurrent Neural Network (RNN) and point onward, we will have pictorial representation of
Long Short-Term Memory (LSTM) approach to predict the analysis that we have used and we will likewise
the stock market indices. reason about the outcomes accomplished.

Index Terms— Long short-term memory (LSTM), II. METHODOLOGY


Recurrent neural network (RNN), nifty 50, root mean
square error (RMSE), prediction, stock prices, web Different kinds of neural networks can be developed
sentiment analysis. by the mix of various factors like network topology,
training method etc. For this experiment, we have
I. INTRODUCTION
considered Recurrent Neural Network and Long
Short-Term Memory.
There are a huge number of financial indicators and
This section we will discuss the methodology of our
furthermore the variance of the stock market are
system. Our system consists of several stages which
exceptionally vicious. However, as the technology is
are as follows:-
getting advanced, the chance to increase a consistent
fortune from the stock market is increased and it
Stage 1: Raw Data
additionally encourages specialists to find the most
In this stage, the historical stock data is gathered
informative pointers to make a better prediction. The
from https://www.quandl.com/information/NSE and
forecast of the market value is of great importance in
this data is utilized for the prediction of future stock
amplifying the profit of stock option buy while
prices.
keeping the risk low.
Stage 2: Data Preprocessing
Recurrent Neural Network (RNN) has demonstrated
The pre-handling stage includes:-
to be one of the most impressive models for handling
a. Data discretization: Part of data reduction but
sequential data.
with specific significance, particularly for
Long Short-Term memory is one of the best RNNs
numerical data.
architecture. LSTM presents the memory cell, a unit
b. Data Transformation: Normalization.
of computation that replaces conventional artificial
c. Data Cleaning: Fill in missing values.
neurons in the hidden layer of the network. With
d. Data Integration: Integration of data files.
these memory cells, network are able to effectively
After the dataset is changed into a clean dataset, the
associate memories and input remote in time, thus
dataset is divided into training and testing sets
suit to get a handle on the structure of data

IJIRT 150045 INTERNATIONAL JOURNAL OF INNOVATIVE RESEARCH IN TECHNOLOGY 207


© July 2020| IJIRT | Volume 7 Issue 2 | ISSN: 2349-6002

in order to evaluate. Here, the training values are Error, RMSE intensifies and seriously punishes the
taken as the more recent values. Testing data is kept large error.
as 5-10 percent of the complete dataset.

Stage 3: Feature Extractions


In this layer, just the features which are to be fed to
the neural networks are chosen. We will choose the
feature from open, high, low, close, volume, date.
Stage 4: Training Neural Network
In this stage, the data is fed care of to the neural
system and prepared for forecast appointing arbitrary
predispositions and loads. Our LSTM model is made
out of a successive info layer followed by 2 LSTM
layers and dense layer with ReLU activation and
afterward at last a thick output layer with linear
activation function.

The code of the Neural Network implemented in IV. EXPERIMENTAL WORK


Keras is as follows
 Dataset description: We gained the data from
https://www.quandl.com. We have gathered the
historical stock information of NIFTY 50 from
the National Stock Exchange. We have gathered
every day’s dataset and kept a window size of 22
days. Data ranges from 01.01.2011 to
31.12.2016.
 Sequence Data: We got 1312 groupings from
01.01.2011 to 31.12.2016. From these dataset we
Stage 5: Output Generation utilized 1180 examples for training reason and
In this layer, the output value generated by the output 132 examples for testing reason.
layer of the RNN is compared with the target value.  Training Detail: For preparing the model we
The error or the contrast between the objective and utilized RMSprop as the analyzer and normalised
the obtained output value is minimized by utilizing every vector of the arrangement. We utilized
back propagation algorithm which adjusts the Google cloud engine as atraining platform
weights and the biases of the network. [Machine type: n1-standard (2 vCPUs, 7.5 GB
memory), CPU stage: Intel Ivy Bridge] and
III. ANALYSIS utilized Ubuntu 18.04, Keras (Frontend) and
Tensorflow (Backend) as the learning
For analyzing the effectiveness of the system we environment. For our explore, we have utilized a
have used the Root Mean Square Error(RMSE). The various set of parameters with an alternate
error or the difference between the target and the number of epochs to measure the RMSE of
obtained value by utilizing by the RMSE value. Training and Testing dataset.
RMSE is the square root of the mean/averagel of the
square of all the error. The utilization of RMSE is V. EXPERIMENTAL RESULTS
highly common and it makes a magnificent general
purpose error metric for numerical predictions. Table 1: Comparing the Results by Using Different
Contrasted with the comparative Mean Absolute Parameters and Epochs.

IJIRT 150045 INTERNATIONAL JOURNAL OF INNOVATIVE RESEARCH IN TECHNOLOGY 208


© July 2020| IJIRT | Volume 7 Issue 2 | ISSN: 2349-6002

Parameters No. of Training Testing


Epoch RMSE RMSE
Open/Close 250 0.01491 0.01358
Open/Close 500 0.01027 0.00918
High/Low/Close 250 0.01511 0.014
High/Low/Close 500 0.01133 0.01059
High/Low/Open/Close 250 0.0133 0.01236
High/Low/Open/Close 500 0.00983 0.00859

Figure 5: High/Low/Close with 500 epochs

Figure 2: Open/Close with 250 epochs

Figure 6: High/Low/Open/Close with 250 epochs

Figure 3: Open/Close with 500 epochs

Figure 7: High/Low/Open/Close with 500 epochs

Subsequent to performing different reproductions


with an alternate number of boundaries and ages, we
have seen that
by taking 4 highlights set (High/Low/Open/Close)
with 500 ages we accomplish the best outcomes with
preparing RMSE of 0.00983 and testing RMSE of
0.00859.
Figure 4: High/Low/Close with 250 epochs
VII. CONCLUSION

IJIRT 150045 INTERNATIONAL JOURNAL OF INNOVATIVE RESEARCH IN TECHNOLOGY 209


© July 2020| IJIRT | Volume 7 Issue 2 | ISSN: 2349-6002

The fame of stock market trading is developing


rapidly, which is urging researchers to discover new
techniques for the prediction using new methods. The
forecasting method is not just helping the researchers
moreover it helps investors and any individual
dealing with the stock market. So as to help
anticipate the stock indices, a forecasting model with
great precision is required.
In this work, we have utilized one of the most precise
forecasting technology utilizing Recurrent Neural
Network and, Long Short-Term Memory unit which
helps investors, analyst or any personal keen in
investing into the stock market by giving them a
decent information of future circumstance of the
stock market.
REFERENCES

[1] Zhi S U, Man L U, Dexuan L I. Deep Learning


in Financial Empirical Applications: Dynamics,
Contributions and Prospects [J]. Journal of
Financial Research, 2017..
[2] Kai Chen, Yi Zhou and FangyanDai ―A LSTM-
based method for stock returns prediction: A
case study of China stock market, ‖IEEE
International Conference on Big Data, 2015.
[3] Xu T, Zhang J, Ma Z, et al. Deep LSTM for
Large Vocabulary Continuous Speech
Recognition [J]. 2017.
[4] Prashant S. Chavan, Prof. Dr. Shrishail. T. Patil
―Parameters for Stock Market Prediction,‖
Prashant S Chavan et al, Int.J.Computer
Technology & Applications, Vol 4 (2),337-340.
[5] Shih C H, Yan B C, Liu S H, et al. Investigating
Siamese LSTM networks for text
categorization[C]// Asia-pacific Signal &
Information Processing Association Summit &
Conference. 2017.
[6] SharvilKatariya, Saurabh Jain―Stock Price
Trend Forecasting using Supervised Learning
Methods.
[7] Hochreiter, Sepp, and Jürgen Schmidhuber―
Long short-term memory,‖ Neural computation
9.8 (1997): 1735-1780

IJIRT 150045 INTERNATIONAL JOURNAL OF INNOVATIVE RESEARCH IN TECHNOLOGY 210

You might also like