SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
International Journal of Trend in Scientific Research and Development (IJTSRD)
Volume 5 Issue 4, May-June 2021 Available Online: www.ijtsrd.com e-ISSN: 2456 – 6470
@ IJTSRD | Unique Paper ID – IJTSRD42345 | Volume – 5 | Issue – 4 | May-June 2021 Page 728
LSTM Based Sentiment Analysis
Dirash A R1, Dr. S K Manju Bargavi2
1Student, 2Professor,
1,2Department of MCA, School of CS & IT, Jain Deemed-to-be University, Bangalore, Karnataka, India
ABSTRACT
Sentimental analysis is a context-based mining of text, which extracts and
identify subjective information from a text or sentence provided. Here the
main concept is extracting the sentiment of the text using machine-learning
techniques such as LSTM (Long short-term memory). This text classification
method analyses the incoming text and determines whether the underlined
emotion is positive or negative along with probability associated with that
positive or negative statements. Probability depicts the strength of a positive
or negative statement, if the probability is close to zero, it implies that the
sentiment is strongly negative and if probability is close to1, it means that the
statement is strongly positive. Here a web application is createdtodeploythis
model using a Python-based micro framework called flask. Many other
methods, such as RNN and CNN, are inefficient when compared to LSTM.
KEYWORDS: Flask, IDMB, LSTM, Machine Learning, RNN
How to cite this paper: Dirash A R | Dr. S
K Manju Bargavi "LSTM Based Sentiment
Analysis" Published
in International
Journal of Trend in
Scientific Research
and Development
(ijtsrd), ISSN: 2456-
6470, Volume-5 |
Issue-4, June 2021,
pp.728-732, URL:
www.ijtsrd.com/papers/ijtsrd42345.pdf
Copyright © 2021 by author (s) and
International Journal ofTrendinScientific
Research and Development Journal. This
is an Open Access article distributed
under the terms of
the Creative
Commons Attribution
License (CC BY 4.0)
(http://creativecommons.org/licenses/by/4.0)
I. INTRODUCTION
Sentiment Analysis is a type of predictive modelling activity
that involves training a model to predict the polarity of
textual data or sentiments such as positive and negative.
Various companies use Sentimental Analysis to better
understand their customers' reactions to their goods.The
ability of algorithms to analyze text has greatly improved as
a result of recent developments in deep learning.
In the early stages, methods such as Naive Bayes, Support
Vector Machines, and others are used to classify sentiment.
Neural networks and other deep learning approaches (CNN,
RNN, ANN) have recently acquired prominence due to their
outstanding results. The dataset is taken from the IMDB
movie review dataset. Movie reviews also provide valuable
information about the film. By reading thesereviews,wecan
manually determine if a film is goodorbad.ThesePositive or
negative sentiment analysis supports companies in
determining the social sentiments of their brands, services,
or goods based on online conversations on Twitter,
Facebook, and other social media platforms.
Users may providetext reviews,comments,orsuggestionsto
products on several social networking platforms or e-
commerce websites. These user-generated texts are an
good source of user sentiment on a variety of products and
services. For a product, such text has the potential to expose
both the item's relevant function/aspects as well as the
users' feelings about each feature. The item's
feature/aspects listed in the text serve the same purpose as
meta-data in content-based filtering, but the former are
more relevant to the recommender framework.. Since these
features are often listed by users in their reviews, they can
be considered the most important features that can have a
major impact on the user's experience with the item, while
the item's meta-data (which is typically provided by
manufacturers rather than consumers) may overlook
features that are important tousers.Aconsumercanexpress
different emotions for different things with similar
characteristics. Also, different users can have different
feelings about the same functionofanobject.Usersreactions
to features can be represented by a multi-dimensional rating
score that reflects their preferences.
The work presented in this paper focuses on sentiment
analysis using a machine learning approach. We can classify
reviews based on emotion in a variety of ways, but we are
using the most modern technique, LSTM networks. The
model can predict sentiment analysis on text using this
approach, and it is very accurate.
Fig: 1 List of positive and negative words
IJTSRD42345
International Journal of Trend in Scientific Research and Development (IJTSRD) @ www.ijtsrd.com eISSN: 2456-6470
@ IJTSRD | Unique Paper ID – IJTSRD42345 | Volume – 5 | Issue – 4 | May-June 2021 Page 729
II. RELATED WORKS
Deep learning algorithms have shown to be effective in a
variety of applications, includingspeechrecognition,pattern
recognition, and data classification. These approaches use a
deeper hierarchy of structures in neural networks to learn
data representation. Complicated concepts can be learned
using simpler ones as a foundation. Convolutional Neural
Networks (CNNs) have been shown to learn local features
from words or phrases among deep feed forward networks
[1].
Although Recurrent Neural Networks (RNNs) can learn
temporal dependencies in sequential data, they can't learn
temporal dependencies in random data[2].There aren't
many features in social media because the messages are so
short. To obtain more useful features, we expand on the
concept of distributedrepresentationofterms,inwhicheach
input is expressed by a large number of features, each of
which is involved in a large number of possible inputs. We
employ the Word2Vec word embedding model [3] to
represent social posts in a distributed manner.
[4]In this paper, we wish to examine how effective long
short-term memory (LSTM) [4] is in categorising sentiment
on brief texts in social media with scattered representation.
To begin, words in short texts are represented as vectors
using a Word2Vec-based word embeddingmodel.Second,in
short texts, LSTM is used to learn long-distance dependence
between word sequences. The prediction outcome is based
on the final output from the previous point in time. In our
sentiment classification studies on different social datasets,
we compared the efficiency of LSTM with Nave Bayes (NB)
and Extreme Learning Machine (ELM). As the results of the
experiments demonstrate, our proposed approach
outperforms traditional probabilistic models and neural
networks with more training data.
An artificial neural network is a network structure inspired
by human brain neurons. Nodes are arranged into layers,
with edges connecting nodes in adjacent layers. Errors can
be sent back to previous layers to adjust the weights of
corresponding edges via feed-forward computations.
Extreme Learning Machines (ELMs[5]are a form of neural
network that does not use back propagation to change the
weights. The secret nodes are allocated at random and are
never updated. As a result, the weights are normally learned
in a single move, which saves time.
Deep learning techniques, which employ several hidden
layers, are used for more complicated relationships. It
typically takes longer to compute with deeper network
structures. These methods were made possible by recent
advancements in hardware computing power and GPU
processing in software technologies. Several forms of deep
neural networks have been proposed basedonvariousways
of structuring multiplelayers,withCNNsandRNNsbeing the
most common. Convolution operations arenaturallyapplied
in edge detection and image sharpening, so CNNs are
commonly used in computer vision. They can also beused to
compute weighted moving averages and impulse responses
from signals. RNNs are a form of neural network in which
the current inputs of hidden layers are determined by the
previous outputs of hidden layers. This allows them to
interact with time sequences containing temporal
connections, such as speech recognition. In a previous
comparative research of RNN vs CNN in natural language
processing, RNNs were found to be more successful in
sentiment analysis than CNNs [6]. As a result, the focus of
this study is on RNNs.
Weights in RNNs may grow out of reach or disappear as the
time series grows longer. To overcome the vanishing
gradient problem [7]in training typical RNNs, LSTM [4]was
proposed to learn long-term dependence across extended
time periods. LSTM includes forget gates in additiontoinput
and output gates. They’re often used in applications
including time series prediction and handwriting
recognition. In this research,weuseLSTMtobuildsentiment
classifiers for shorter texts.
Natural language processing benefits from examining the
distributional relationships between word occurrences in
documents. The most straightforward method is to use one-
hot encoding to describe each word's occurrence in
documents as a binary vector. Word embedding models are
used in distributional semantics to map from a one-hot
vector space to a continuous vector space with a smaller
dimension than the traditional bag-of-words model. The
most common word embedding models are distributed
representations of words, such as Word2Vec [2] and
GloVe[8]which use neural networks to train occurrence
relations between words and documents in the contexts of
training data. In this research, we employ the Word2Vec
word embedding model to describe words in short texts.
Then, to catch the long-term dependence among words in
short texts, LSTM classifiers are educated. Each text's
sentiment can then be graded as either positive or negative.
Aditya Timmaraju and Vikesh Kumar [9] suggested a
Recursive RNN-based intelligent model forclassifyingmovie
reviews. This is a method for emotion detection in natural
language, such as text. This framework is an add-on for
sentiment classification at the sentence stage.
JanDeriu andMark Ceilieba[10]havedevelopeda framework
that categorizes the sentiment of tweets. The deep learning
methodology is used in this research. They used 2-layer
convolution neural networks in this study. The entire role is
divided into three subtasks here.
Sachin Kumar and Anand Kumar [11] proposed a new
method for the same mission, but using a different
methodology, namelyCNN.SentimentanalysisinNLPisused
in this paper since most texts contain knowledge in theform
of thoughts and emotions. This model will include a detailed
analysis of an opinion or sentiment that can be classified as
negative, optimistic, or neutral.
International Journal of Trend in Scientific Research and Development (IJTSRD) @ www.ijtsrd.com eISSN: 2456-6470
@ IJTSRD | Unique Paper ID – IJTSRD42345 | Volume – 5 | Issue – 4 | May-June 2021 Page 730
III. WORKING METHEODOLOGY
Fig: 2 Architectural diagram of classification process
3.1. Import Dataset
The model is based on the IMDB dataset, which stands for
“Internet Movie Database”, it is owned by Amazon. It has
information related to Movies, Video games, Web Series, TV
Series etc. that can be downloadedusingthekeras.datasetin
a format that is ready to use for neural networks. This data
contains 25000 movie reviews from IMDB, all of which have
already been reprocessed and labelled as either positive or
negative.
3.2. Word Embedding
In short texts, there is a better representation of minimal
content; we used the embedding layer, which is one of the
keras module's layers used for this purpose. Word
embedding is a text mining approach that develops a link
between words in textual data (Corpus).The context in
which words are used determines their syntactic and
semantic meanings.Thedistributional hypothesisposits that
words with similar semantic meanings emerge in similar
settings.
3.3. Machine Learning Algorithm
The dataset is divided into training dataset and Test set.We
will build a neural network model to solve a basic sentiment
analysis problem. The LSTM algorithm is used to build a
model for classifying sentiment analysis. LSTM stands for
Long short term memory. They are type of RNN (Recurrent
neural network) which is well suited for sequence
prediction problem. We can classify feedback based on
emotion in a number of ways, but we're using LSTM
networks, which is the most recent technique. Using this
method, the model can predict sentiment analysis on text,
and it is very accurate.
3.4. Classification
Google Collaboration will be used to train the model. The
model is trained using the training dataset before being put
to the test in the following phases. The accuracy of the
qualified sentiment classification model isdeterminedusing
the test dataset. The accuracy of the model determines the
model's efficiency.
3.5. Prediction
This text classification method examines the input text and
decides whether the underlined emotion is positive or
negative, as well as the likelihood associated with certain
positive or negative statements.Theintensityofa positiveor
negative argument is represented by probability. The
model's accuracy is 86.68 percent while using the LSTM
networks algorithm.
3.6. Deploy the Model In Flask
Following the development of the model, the next step is to
create a Web Application for it, which will be done with
Flask. Flask is a Python based micro web open source
Framework which doesn't require a particular tools or
libraries. Flask gives you the tools, frameworks, and
technologies needed to create a web application.
IV. RESULT
In this model, learning is the first step, and predicting is the
second. The model is trained with the dataset in thelearning
process, and it classifies the train dataset according to that
perception. During the learning process,themodel istrained
with the dataset, and it then classifies the train dataset
according to that perception. To avoid under fitting, we
should use a large dataset and a well-completed learning
process. Based on the training, the model learns how to
classify, and the model is then evaluated with the test set
during the testing process.
Fig 3 Epoch is generated
Fig 3 shows the results of the learning phase. Here tenser
flow is used, which is the backend of this model, which helps
in various machine learning task. The model is trained using
the training dataset before being put to the test in the
following phases. We can see how the output improves over
time as the epochs pass. The model's efficiency improves
epoch by epoch, meaning that it learns from its experience.
Fig 4 Accuracy is generated
Using the LSTM networks algorithm, the model's accuracyis
86.68%, as shown in Fig 2. When we use this dataset, the
performance of this model outperforms all other machine
learning algorithms. The LSTM is exceptional at classifying
sequence text data.
International Journal of Trend in Scientific Research and Development (IJTSRD) @ www.ijtsrd.com eISSN: 2456-6470
@ IJTSRD | Unique Paper ID – IJTSRD42345 | Volume – 5 | Issue – 4 | May-June 2021 Page 731
V. OUTPUT
Fig 5 Text is entered to check Sentiment
Fig 6 Sentiment is generated
Fig 7Text is entered to check Sentiment
Fig 8 output is generated
This is the output of for the project. In fig 5 and fig 7 we have
to add the statement for which we have to find the
sentiment. The output for the above statement is displayed
in fig 6 and fig 8, the above figure tells us whether the
statement is negative or positive along with the sentiment
associated with that, followed by an emoji. Probability
depicts the strength of a negativeor positivestatement,ifthe
probability is close to zero, it implies that the sentiment is
strongly negative and if probability is close to one, it means
that the statement is strongly positive.
VI. CONCLUSION
This model proposes sentiment classifiers that aids in the
classification of emotion in text sequences. The model will
predict whether the given text is positive or negative based
on the user input. This model was created using LSTM, and
the results showed that the Long Short Term Memory
Networks algorithmic standard outperformed others in
terms of precision.
Sentiment analysis is important since it allows companies to
easily consider their consumers' overall views. By
automatically classifying the sentiment behind reviews,
social media conversations, and other data, you can make
faster and more precise decisions. According to estimates,
90% of the world's data is unstructured or unorganised.
Every day, massive amounts of unstructured business data
are produced (emails, support tickets, talks, social media
conversations, surveys, posts, documents, and so on).
However, analysing opinion in a timely and productive
manner is difficult.
Sentiment analysis can be applied to countless aspects of
business, from brand monitoring and product analytics, to
customer service and market research. By integrating itinto
their existing systems and analytics, leading brands are able
to work faster, with more accuracy, toward more useful
ends.
VII. FUTURE SCOPE
We can improve the accuracy using hyper parameter tuning
on this particular neural network model. The above model
predicts the sentiment of a single sentence; in the future,
data in csv format will be given, and you can simply tweak it
in the application. We plan to expand this research in the
future so that various embedding models can be considered
on a wider range of datasets.
ACKNOWLEDGEMENT
I should convey my obligation to Dr MN Nachappa and Prof:
Dr SK Manju Bargavi and undertaking facilitators for their
effective motivation and encouragement throughout my
assessment work. Theirideal bearing,absoluteco-actionand
second discernment have made my work gainful.
REFERENCES
[1] Zhang, Y. Wallace and Byron, “A sensitivityanalysisof
(and practitioners' guide to) convolutional neural
networks for sentence classification,” arXiv preprint
arXiv:1510.03820, 2015.
[2] T. a. C. K. a. C. G. a. D. J. Mikolov, “Efficient estimation
of word representations in vector space,” arXiv
preprint arXiv:1301.3781, 2013.
[3] J. L. Elman, “Finding structure in time,” Cognitive
science, 1990.
[4] S. a. S. J. Hochreiter, “Long short-term memory,”
Neural computation, 1997.
[5] Huang, G.-B. Zhu, Q.-Y. Siew and Chee-Kheong,
“Extreme learning machine: theoryandapplications,”
Neurocomputing, 2016.
[6] Y. Wenpeng, K. Katharina and Y. M. S. Hinrich,
“Comparative study of CNN and RNN for natural
language processing,” arXiv preprint
arXiv:1702.01923, 2017.
International Journal of Trend in Scientific Research and Development (IJTSRD) @ www.ijtsrd.com eISSN: 2456-6470
@ IJTSRD | Unique Paper ID – IJTSRD42345 | Volume – 5 | Issue – 4 | May-June 2021 Page 732
[7] B. Yoshua, F. Paolo, u. Schmidhuber and E. Corso,
“Gradient Flow in Recurrent Nets: the Difficulty of
Learning Long-Term D ependencies*SeppHochreiter
Fakult at f ur Informatik,” Citeseer, 2001.
[8] Pennington, J. Socher, R. Manning and C. D, Glove:
Global vectors for word representation, 2014.
[9] M. A. Daly, Raymond E Pham, P. T, H. Dan, N. A. Y and
P. Christopher, Learning word vectors for sentiment
analysis, 2011.
[10] Deriu, J. Milan and C. Mark, Sentiment analysis using
convolutional neural networks with multi-task
training and distant supervision on italian tweets,
2016.
[11] K. S, S. Kumar, M. Anand and S. KP, Sentiment analysis
of tweets in malayalam using long short-term
memory units and convolutional neural nets, 2017.

More Related Content

PPTX
New sentiment analysis of tweets using python by Ravi kumar
PDF
Sentiment analysis of Twitter Data
PPTX
Sentiment Analysis Using Twitter
PPTX
Sentiment Analysis
PDF
Text classification & sentiment analysis
PPT
Ml ppt
PPTX
Twitter sentiment analysis.pptx
PPTX
TEXT SUMMARIZATION
New sentiment analysis of tweets using python by Ravi kumar
Sentiment analysis of Twitter Data
Sentiment Analysis Using Twitter
Sentiment Analysis
Text classification & sentiment analysis
Ml ppt
Twitter sentiment analysis.pptx
TEXT SUMMARIZATION

What's hot (20)

PPTX
Sentiment analysis
PPTX
Next word Prediction
PDF
Sentiment Analysis of Twitter Data
PPTX
Sentiment analysis of Twitter data using python
PPTX
Twitter sentiment analysis
PPTX
Sentiment analysis
PPT
How Sentiment Analysis works
PPTX
Sentimental analysis
PPTX
Introduction to Transformer Model
PPTX
Approaches to Sentiment Analysis
PDF
Sentiment Analysis
PPTX
Sentiment Analaysis on Twitter
PDF
Sentiment analysis - Our approach and use cases
PPTX
Long Short Term Memory LSTM
PPTX
Sentiment analysis of twitter data
PPTX
Sentiment Analysis in Twitter
PDF
Emotion Detection from Text
PDF
IRE2014-Sentiment Analysis
PPTX
Emotion Detection in text
PPTX
Sentiment Analysis
Sentiment analysis
Next word Prediction
Sentiment Analysis of Twitter Data
Sentiment analysis of Twitter data using python
Twitter sentiment analysis
Sentiment analysis
How Sentiment Analysis works
Sentimental analysis
Introduction to Transformer Model
Approaches to Sentiment Analysis
Sentiment Analysis
Sentiment Analaysis on Twitter
Sentiment analysis - Our approach and use cases
Long Short Term Memory LSTM
Sentiment analysis of twitter data
Sentiment Analysis in Twitter
Emotion Detection from Text
IRE2014-Sentiment Analysis
Emotion Detection in text
Sentiment Analysis
Ad

Similar to LSTM Based Sentiment Analysis (20)

PDF
Aspect based sentiment analysis using a novel ensemble deep network
PDF
A simplified classification computational model of opinion mining using deep ...
PDF
PDF
IRJET - Sentiment Analysis for Marketing and Product Review using a Hybrid Ap...
PDF
Detection of multiword from a wordnet is complex
PDF
A scalable, lexicon based technique for sentiment analysis
PDF
Phrase Structure Identification and Classification of Sentences using Deep Le...
PDF
Eat it, Review it: A New Approach for Review Prediction
PDF
1808.10245v1 (1).pdf
PDF
An in-depth review on News Classification through NLP
PDF
SENTIMENT ANALYSIS IN MYANMAR LANGUAGE USING CONVOLUTIONAL LSTM NEURAL NETWORK
PDF
Sentiment Analysis In Myanmar Language Using Convolutional Lstm Neural Network
PDF
SENTIMENT ANALYSIS FOR MOVIES REVIEWS DATASET USING DEEP LEARNING MODELS
PDF
Cyber bullying detection and analysis.ppt.pdf
PDF
Crime prediction using a hybrid sentiment analysis approach based on the bidi...
PDF
Suggestion Generation for Specific Erroneous Part in a Sentence using Deep Le...
PDF
IRJET- Survey for Amazon Fine Food Reviews
PDF
G04124041046
PDF
Evaluating sentiment analysis and word embedding techniques on Brexit
Aspect based sentiment analysis using a novel ensemble deep network
A simplified classification computational model of opinion mining using deep ...
IRJET - Sentiment Analysis for Marketing and Product Review using a Hybrid Ap...
Detection of multiword from a wordnet is complex
A scalable, lexicon based technique for sentiment analysis
Phrase Structure Identification and Classification of Sentences using Deep Le...
Eat it, Review it: A New Approach for Review Prediction
1808.10245v1 (1).pdf
An in-depth review on News Classification through NLP
SENTIMENT ANALYSIS IN MYANMAR LANGUAGE USING CONVOLUTIONAL LSTM NEURAL NETWORK
Sentiment Analysis In Myanmar Language Using Convolutional Lstm Neural Network
SENTIMENT ANALYSIS FOR MOVIES REVIEWS DATASET USING DEEP LEARNING MODELS
Cyber bullying detection and analysis.ppt.pdf
Crime prediction using a hybrid sentiment analysis approach based on the bidi...
Suggestion Generation for Specific Erroneous Part in a Sentence using Deep Le...
IRJET- Survey for Amazon Fine Food Reviews
G04124041046
Evaluating sentiment analysis and word embedding techniques on Brexit
Ad

More from ijtsrd (20)

PDF
A Study of School Dropout in Rural Districts of Darjeeling and Its Causes
PDF
Pre extension Demonstration and Evaluation of Soybean Technologies in Fedis D...
PDF
Pre extension Demonstration and Evaluation of Potato Technologies in Selected...
PDF
Pre extension Demonstration and Evaluation of Animal Drawn Potato Digger in S...
PDF
Pre extension Demonstration and Evaluation of Drought Tolerant and Early Matu...
PDF
Pre extension Demonstration and Evaluation of Double Cropping Practice Legume...
PDF
Pre extension Demonstration and Evaluation of Common Bean Technology in Low L...
PDF
Enhancing Image Quality in Compression and Fading Channels A Wavelet Based Ap...
PDF
Manpower Training and Employee Performance in Mellienium Ltdawka, Anambra State
PDF
A Statistical Analysis on the Growth Rate of Selected Sectors of Nigerian Eco...
PDF
Automatic Accident Detection and Emergency Alert System using IoT
PDF
Corporate Social Responsibility Dimensions and Corporate Image of Selected Up...
PDF
The Role of Media in Tribal Health and Educational Progress of Odisha
PDF
Advancements and Future Trends in Advanced Quantum Algorithms A Prompt Scienc...
PDF
A Study on Seismic Analysis of High Rise Building with Mass Irregularities, T...
PDF
Descriptive Study to Assess the Knowledge of B.Sc. Interns Regarding Biomedic...
PDF
Performance of Grid Connected Solar PV Power Plant at Clear Sky Day
PDF
Vitiligo Treated Homoeopathically A Case Report
PDF
Vitiligo Treated Homoeopathically A Case Report
PDF
Uterine Fibroids Homoeopathic Perspectives
A Study of School Dropout in Rural Districts of Darjeeling and Its Causes
Pre extension Demonstration and Evaluation of Soybean Technologies in Fedis D...
Pre extension Demonstration and Evaluation of Potato Technologies in Selected...
Pre extension Demonstration and Evaluation of Animal Drawn Potato Digger in S...
Pre extension Demonstration and Evaluation of Drought Tolerant and Early Matu...
Pre extension Demonstration and Evaluation of Double Cropping Practice Legume...
Pre extension Demonstration and Evaluation of Common Bean Technology in Low L...
Enhancing Image Quality in Compression and Fading Channels A Wavelet Based Ap...
Manpower Training and Employee Performance in Mellienium Ltdawka, Anambra State
A Statistical Analysis on the Growth Rate of Selected Sectors of Nigerian Eco...
Automatic Accident Detection and Emergency Alert System using IoT
Corporate Social Responsibility Dimensions and Corporate Image of Selected Up...
The Role of Media in Tribal Health and Educational Progress of Odisha
Advancements and Future Trends in Advanced Quantum Algorithms A Prompt Scienc...
A Study on Seismic Analysis of High Rise Building with Mass Irregularities, T...
Descriptive Study to Assess the Knowledge of B.Sc. Interns Regarding Biomedic...
Performance of Grid Connected Solar PV Power Plant at Clear Sky Day
Vitiligo Treated Homoeopathically A Case Report
Vitiligo Treated Homoeopathically A Case Report
Uterine Fibroids Homoeopathic Perspectives

Recently uploaded (20)

PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Classroom Observation Tools for Teachers
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Computing-Curriculum for Schools in Ghana
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Cell Types and Its function , kingdom of life
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
Complications of Minimal Access Surgery at WLH
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Basic Mud Logging Guide for educational purpose
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
STATICS OF THE RIGID BODIES Hibbelers.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Classroom Observation Tools for Teachers
Renaissance Architecture: A Journey from Faith to Humanism
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Computing-Curriculum for Schools in Ghana
Microbial disease of the cardiovascular and lymphatic systems
Cell Types and Its function , kingdom of life
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Complications of Minimal Access Surgery at WLH
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPH.pptx obstetrics and gynecology in nursing
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Basic Mud Logging Guide for educational purpose
human mycosis Human fungal infections are called human mycosis..pptx
Abdominal Access Techniques with Prof. Dr. R K Mishra
Module 4: Burden of Disease Tutorial Slides S2 2025

LSTM Based Sentiment Analysis

  • 1. International Journal of Trend in Scientific Research and Development (IJTSRD) Volume 5 Issue 4, May-June 2021 Available Online: www.ijtsrd.com e-ISSN: 2456 – 6470 @ IJTSRD | Unique Paper ID – IJTSRD42345 | Volume – 5 | Issue – 4 | May-June 2021 Page 728 LSTM Based Sentiment Analysis Dirash A R1, Dr. S K Manju Bargavi2 1Student, 2Professor, 1,2Department of MCA, School of CS & IT, Jain Deemed-to-be University, Bangalore, Karnataka, India ABSTRACT Sentimental analysis is a context-based mining of text, which extracts and identify subjective information from a text or sentence provided. Here the main concept is extracting the sentiment of the text using machine-learning techniques such as LSTM (Long short-term memory). This text classification method analyses the incoming text and determines whether the underlined emotion is positive or negative along with probability associated with that positive or negative statements. Probability depicts the strength of a positive or negative statement, if the probability is close to zero, it implies that the sentiment is strongly negative and if probability is close to1, it means that the statement is strongly positive. Here a web application is createdtodeploythis model using a Python-based micro framework called flask. Many other methods, such as RNN and CNN, are inefficient when compared to LSTM. KEYWORDS: Flask, IDMB, LSTM, Machine Learning, RNN How to cite this paper: Dirash A R | Dr. S K Manju Bargavi "LSTM Based Sentiment Analysis" Published in International Journal of Trend in Scientific Research and Development (ijtsrd), ISSN: 2456- 6470, Volume-5 | Issue-4, June 2021, pp.728-732, URL: www.ijtsrd.com/papers/ijtsrd42345.pdf Copyright © 2021 by author (s) and International Journal ofTrendinScientific Research and Development Journal. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (CC BY 4.0) (http://creativecommons.org/licenses/by/4.0) I. INTRODUCTION Sentiment Analysis is a type of predictive modelling activity that involves training a model to predict the polarity of textual data or sentiments such as positive and negative. Various companies use Sentimental Analysis to better understand their customers' reactions to their goods.The ability of algorithms to analyze text has greatly improved as a result of recent developments in deep learning. In the early stages, methods such as Naive Bayes, Support Vector Machines, and others are used to classify sentiment. Neural networks and other deep learning approaches (CNN, RNN, ANN) have recently acquired prominence due to their outstanding results. The dataset is taken from the IMDB movie review dataset. Movie reviews also provide valuable information about the film. By reading thesereviews,wecan manually determine if a film is goodorbad.ThesePositive or negative sentiment analysis supports companies in determining the social sentiments of their brands, services, or goods based on online conversations on Twitter, Facebook, and other social media platforms. Users may providetext reviews,comments,orsuggestionsto products on several social networking platforms or e- commerce websites. These user-generated texts are an good source of user sentiment on a variety of products and services. For a product, such text has the potential to expose both the item's relevant function/aspects as well as the users' feelings about each feature. The item's feature/aspects listed in the text serve the same purpose as meta-data in content-based filtering, but the former are more relevant to the recommender framework.. Since these features are often listed by users in their reviews, they can be considered the most important features that can have a major impact on the user's experience with the item, while the item's meta-data (which is typically provided by manufacturers rather than consumers) may overlook features that are important tousers.Aconsumercanexpress different emotions for different things with similar characteristics. Also, different users can have different feelings about the same functionofanobject.Usersreactions to features can be represented by a multi-dimensional rating score that reflects their preferences. The work presented in this paper focuses on sentiment analysis using a machine learning approach. We can classify reviews based on emotion in a variety of ways, but we are using the most modern technique, LSTM networks. The model can predict sentiment analysis on text using this approach, and it is very accurate. Fig: 1 List of positive and negative words IJTSRD42345
  • 2. International Journal of Trend in Scientific Research and Development (IJTSRD) @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD42345 | Volume – 5 | Issue – 4 | May-June 2021 Page 729 II. RELATED WORKS Deep learning algorithms have shown to be effective in a variety of applications, includingspeechrecognition,pattern recognition, and data classification. These approaches use a deeper hierarchy of structures in neural networks to learn data representation. Complicated concepts can be learned using simpler ones as a foundation. Convolutional Neural Networks (CNNs) have been shown to learn local features from words or phrases among deep feed forward networks [1]. Although Recurrent Neural Networks (RNNs) can learn temporal dependencies in sequential data, they can't learn temporal dependencies in random data[2].There aren't many features in social media because the messages are so short. To obtain more useful features, we expand on the concept of distributedrepresentationofterms,inwhicheach input is expressed by a large number of features, each of which is involved in a large number of possible inputs. We employ the Word2Vec word embedding model [3] to represent social posts in a distributed manner. [4]In this paper, we wish to examine how effective long short-term memory (LSTM) [4] is in categorising sentiment on brief texts in social media with scattered representation. To begin, words in short texts are represented as vectors using a Word2Vec-based word embeddingmodel.Second,in short texts, LSTM is used to learn long-distance dependence between word sequences. The prediction outcome is based on the final output from the previous point in time. In our sentiment classification studies on different social datasets, we compared the efficiency of LSTM with Nave Bayes (NB) and Extreme Learning Machine (ELM). As the results of the experiments demonstrate, our proposed approach outperforms traditional probabilistic models and neural networks with more training data. An artificial neural network is a network structure inspired by human brain neurons. Nodes are arranged into layers, with edges connecting nodes in adjacent layers. Errors can be sent back to previous layers to adjust the weights of corresponding edges via feed-forward computations. Extreme Learning Machines (ELMs[5]are a form of neural network that does not use back propagation to change the weights. The secret nodes are allocated at random and are never updated. As a result, the weights are normally learned in a single move, which saves time. Deep learning techniques, which employ several hidden layers, are used for more complicated relationships. It typically takes longer to compute with deeper network structures. These methods were made possible by recent advancements in hardware computing power and GPU processing in software technologies. Several forms of deep neural networks have been proposed basedonvariousways of structuring multiplelayers,withCNNsandRNNsbeing the most common. Convolution operations arenaturallyapplied in edge detection and image sharpening, so CNNs are commonly used in computer vision. They can also beused to compute weighted moving averages and impulse responses from signals. RNNs are a form of neural network in which the current inputs of hidden layers are determined by the previous outputs of hidden layers. This allows them to interact with time sequences containing temporal connections, such as speech recognition. In a previous comparative research of RNN vs CNN in natural language processing, RNNs were found to be more successful in sentiment analysis than CNNs [6]. As a result, the focus of this study is on RNNs. Weights in RNNs may grow out of reach or disappear as the time series grows longer. To overcome the vanishing gradient problem [7]in training typical RNNs, LSTM [4]was proposed to learn long-term dependence across extended time periods. LSTM includes forget gates in additiontoinput and output gates. They’re often used in applications including time series prediction and handwriting recognition. In this research,weuseLSTMtobuildsentiment classifiers for shorter texts. Natural language processing benefits from examining the distributional relationships between word occurrences in documents. The most straightforward method is to use one- hot encoding to describe each word's occurrence in documents as a binary vector. Word embedding models are used in distributional semantics to map from a one-hot vector space to a continuous vector space with a smaller dimension than the traditional bag-of-words model. The most common word embedding models are distributed representations of words, such as Word2Vec [2] and GloVe[8]which use neural networks to train occurrence relations between words and documents in the contexts of training data. In this research, we employ the Word2Vec word embedding model to describe words in short texts. Then, to catch the long-term dependence among words in short texts, LSTM classifiers are educated. Each text's sentiment can then be graded as either positive or negative. Aditya Timmaraju and Vikesh Kumar [9] suggested a Recursive RNN-based intelligent model forclassifyingmovie reviews. This is a method for emotion detection in natural language, such as text. This framework is an add-on for sentiment classification at the sentence stage. JanDeriu andMark Ceilieba[10]havedevelopeda framework that categorizes the sentiment of tweets. The deep learning methodology is used in this research. They used 2-layer convolution neural networks in this study. The entire role is divided into three subtasks here. Sachin Kumar and Anand Kumar [11] proposed a new method for the same mission, but using a different methodology, namelyCNN.SentimentanalysisinNLPisused in this paper since most texts contain knowledge in theform of thoughts and emotions. This model will include a detailed analysis of an opinion or sentiment that can be classified as negative, optimistic, or neutral.
  • 3. International Journal of Trend in Scientific Research and Development (IJTSRD) @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD42345 | Volume – 5 | Issue – 4 | May-June 2021 Page 730 III. WORKING METHEODOLOGY Fig: 2 Architectural diagram of classification process 3.1. Import Dataset The model is based on the IMDB dataset, which stands for “Internet Movie Database”, it is owned by Amazon. It has information related to Movies, Video games, Web Series, TV Series etc. that can be downloadedusingthekeras.datasetin a format that is ready to use for neural networks. This data contains 25000 movie reviews from IMDB, all of which have already been reprocessed and labelled as either positive or negative. 3.2. Word Embedding In short texts, there is a better representation of minimal content; we used the embedding layer, which is one of the keras module's layers used for this purpose. Word embedding is a text mining approach that develops a link between words in textual data (Corpus).The context in which words are used determines their syntactic and semantic meanings.Thedistributional hypothesisposits that words with similar semantic meanings emerge in similar settings. 3.3. Machine Learning Algorithm The dataset is divided into training dataset and Test set.We will build a neural network model to solve a basic sentiment analysis problem. The LSTM algorithm is used to build a model for classifying sentiment analysis. LSTM stands for Long short term memory. They are type of RNN (Recurrent neural network) which is well suited for sequence prediction problem. We can classify feedback based on emotion in a number of ways, but we're using LSTM networks, which is the most recent technique. Using this method, the model can predict sentiment analysis on text, and it is very accurate. 3.4. Classification Google Collaboration will be used to train the model. The model is trained using the training dataset before being put to the test in the following phases. The accuracy of the qualified sentiment classification model isdeterminedusing the test dataset. The accuracy of the model determines the model's efficiency. 3.5. Prediction This text classification method examines the input text and decides whether the underlined emotion is positive or negative, as well as the likelihood associated with certain positive or negative statements.Theintensityofa positiveor negative argument is represented by probability. The model's accuracy is 86.68 percent while using the LSTM networks algorithm. 3.6. Deploy the Model In Flask Following the development of the model, the next step is to create a Web Application for it, which will be done with Flask. Flask is a Python based micro web open source Framework which doesn't require a particular tools or libraries. Flask gives you the tools, frameworks, and technologies needed to create a web application. IV. RESULT In this model, learning is the first step, and predicting is the second. The model is trained with the dataset in thelearning process, and it classifies the train dataset according to that perception. During the learning process,themodel istrained with the dataset, and it then classifies the train dataset according to that perception. To avoid under fitting, we should use a large dataset and a well-completed learning process. Based on the training, the model learns how to classify, and the model is then evaluated with the test set during the testing process. Fig 3 Epoch is generated Fig 3 shows the results of the learning phase. Here tenser flow is used, which is the backend of this model, which helps in various machine learning task. The model is trained using the training dataset before being put to the test in the following phases. We can see how the output improves over time as the epochs pass. The model's efficiency improves epoch by epoch, meaning that it learns from its experience. Fig 4 Accuracy is generated Using the LSTM networks algorithm, the model's accuracyis 86.68%, as shown in Fig 2. When we use this dataset, the performance of this model outperforms all other machine learning algorithms. The LSTM is exceptional at classifying sequence text data.
  • 4. International Journal of Trend in Scientific Research and Development (IJTSRD) @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD42345 | Volume – 5 | Issue – 4 | May-June 2021 Page 731 V. OUTPUT Fig 5 Text is entered to check Sentiment Fig 6 Sentiment is generated Fig 7Text is entered to check Sentiment Fig 8 output is generated This is the output of for the project. In fig 5 and fig 7 we have to add the statement for which we have to find the sentiment. The output for the above statement is displayed in fig 6 and fig 8, the above figure tells us whether the statement is negative or positive along with the sentiment associated with that, followed by an emoji. Probability depicts the strength of a negativeor positivestatement,ifthe probability is close to zero, it implies that the sentiment is strongly negative and if probability is close to one, it means that the statement is strongly positive. VI. CONCLUSION This model proposes sentiment classifiers that aids in the classification of emotion in text sequences. The model will predict whether the given text is positive or negative based on the user input. This model was created using LSTM, and the results showed that the Long Short Term Memory Networks algorithmic standard outperformed others in terms of precision. Sentiment analysis is important since it allows companies to easily consider their consumers' overall views. By automatically classifying the sentiment behind reviews, social media conversations, and other data, you can make faster and more precise decisions. According to estimates, 90% of the world's data is unstructured or unorganised. Every day, massive amounts of unstructured business data are produced (emails, support tickets, talks, social media conversations, surveys, posts, documents, and so on). However, analysing opinion in a timely and productive manner is difficult. Sentiment analysis can be applied to countless aspects of business, from brand monitoring and product analytics, to customer service and market research. By integrating itinto their existing systems and analytics, leading brands are able to work faster, with more accuracy, toward more useful ends. VII. FUTURE SCOPE We can improve the accuracy using hyper parameter tuning on this particular neural network model. The above model predicts the sentiment of a single sentence; in the future, data in csv format will be given, and you can simply tweak it in the application. We plan to expand this research in the future so that various embedding models can be considered on a wider range of datasets. ACKNOWLEDGEMENT I should convey my obligation to Dr MN Nachappa and Prof: Dr SK Manju Bargavi and undertaking facilitators for their effective motivation and encouragement throughout my assessment work. Theirideal bearing,absoluteco-actionand second discernment have made my work gainful. REFERENCES [1] Zhang, Y. Wallace and Byron, “A sensitivityanalysisof (and practitioners' guide to) convolutional neural networks for sentence classification,” arXiv preprint arXiv:1510.03820, 2015. [2] T. a. C. K. a. C. G. a. D. J. Mikolov, “Efficient estimation of word representations in vector space,” arXiv preprint arXiv:1301.3781, 2013. [3] J. L. Elman, “Finding structure in time,” Cognitive science, 1990. [4] S. a. S. J. Hochreiter, “Long short-term memory,” Neural computation, 1997. [5] Huang, G.-B. Zhu, Q.-Y. Siew and Chee-Kheong, “Extreme learning machine: theoryandapplications,” Neurocomputing, 2016. [6] Y. Wenpeng, K. Katharina and Y. M. S. Hinrich, “Comparative study of CNN and RNN for natural language processing,” arXiv preprint arXiv:1702.01923, 2017.
  • 5. International Journal of Trend in Scientific Research and Development (IJTSRD) @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD42345 | Volume – 5 | Issue – 4 | May-June 2021 Page 732 [7] B. Yoshua, F. Paolo, u. Schmidhuber and E. Corso, “Gradient Flow in Recurrent Nets: the Difficulty of Learning Long-Term D ependencies*SeppHochreiter Fakult at f ur Informatik,” Citeseer, 2001. [8] Pennington, J. Socher, R. Manning and C. D, Glove: Global vectors for word representation, 2014. [9] M. A. Daly, Raymond E Pham, P. T, H. Dan, N. A. Y and P. Christopher, Learning word vectors for sentiment analysis, 2011. [10] Deriu, J. Milan and C. Mark, Sentiment analysis using convolutional neural networks with multi-task training and distant supervision on italian tweets, 2016. [11] K. S, S. Kumar, M. Anand and S. KP, Sentiment analysis of tweets in malayalam using long short-term memory units and convolutional neural nets, 2017.