Sentiment Analysis Using LSTM

Sentiment Analysis Using LSTM

Anweshan Mukherjee, Rajarshi Saha, Ashwin Gupta, Debabrata Datta, Anal Acharya
Copyright: © 2023 |Pages: 24
DOI: 10.4018/978-1-7998-9220-5.ch057
OnDemand:
(Individual Chapters)
Available
$37.50
No Current Special Offers
TOTAL SAVINGS: $37.50

Abstract

Sentiment analysis is a vast growing field as various branches of artificial intelligence are being used in different fields. Incorporating sentiment analysis in the field of psychology would be of great help to both doctors for easy diagnosis and patients for self-checking. The research work proposed in this article focuses on obtaining the dependency of one word with others in its current context using long short-term memory (LSTM) for obtaining the sentiment. The dataset used consists of 156060 movie reviews and a model was trained to classify the cleaned text data into three classes – Negative, Neutral, and Positive. The performance of the model was evaluated by checking the loss generated and the validation accuracy after each epoch. The model and its hyper parameters were also tuned to obtain the best model in terms of validation accuracy.
Chapter Preview
Top

Introduction

Sentiment Analysis is a field of study in Natural Language Processing (NLP) domain that focuses on determining the sentiment of data given as input; mostly, classified into three classes – negative, neutral and positive. It focuses on identification and classification of opinions or sentiments conveyed in the source text (Neethu, M. S., & Rajasree, R, 2013). Sentiment analysis can be defined as a process that automates mining of attitudes, opinions, views and emotions from text, speech, tweets, and database sources through NLP. It is also referred to as subjectivity analysis, opinion mining, and appraisal extraction. Analysis of user generated data to extract the sentiment or opinion of the crowd is of prime importance in the real world (Kharde, V., & Sonawane, P, 2016).

There are three basic methodologies of Sentiment Analysis:

  • 1.

    Symbolic techniques or Rule-based approach

  • 2.

    Machine learning techniques or Automatic approach

  • 3.

    Hybrid techniques

Rule-based techniques require an outsized database of predefined emotions and sentiments and an efficient knowledge representation for classifying sentiments properly (Neethu, M. S., & Rajasree, R, 2013). In rule-based approach, we use a set of human-crafted rules or guidelines to help determine the subjectivity, polarity, or the subject of an opinion. Rule-based systems are very naive since they do not consider how words are combined in a sequence. Although more advanced processing techniques can be used, and new rules added to support new expressions and vocabulary. However, adding new rules may affect the previous results, and eventually the whole system may get very complex. Since rule-based systems often need fine-tuning and maintenance, they also need regular investment.

Machine learning approach in sentiment analysis involves using a training set to train and develop a sentiment classifier model that categorizes or classifies sentiments. It is simpler than rule-based approach since such a large database of predefined emotions or sentiments is not required (Neethu, M. S., & Rajasree, R, 2013). Machine learning techniques for sentiment classification are useful because they are able to capture the context accurately by modelling many features efficiently. They are capable of adapting to changing input and can calculate as a part of the process the degree of uncertainty of classification, making them a suitable technique for many applications (Boiy, E., & Moens, M. F, 2008). Machine learning techniques or Automatic approaches rely on different machine algorithms to classify opinions. In this technique, a sentiment analysis task is modelled as a classification problem, where a classifier is loaded with a text and returns a category, e.g., positive, negative, or neutral. This approach involves a training and a prediction process. In the training process the model learns to associate a particular input i.e., a text to the corresponding output or tag, based on the test samples used for training. The feature extractor then transfers the text input into a feature vector. Pairs of feature vectors and tags (positive, negative, or neutral) are input into the machine learning algorithm to generate a model. In the prediction process, the feature extractor is used to transform unknown text inputs into feature vectors. These feature vectors are then input into the model, which then generates the predicted tags (positive, negative, or neutral). For classifying the text, various statistical models may be used such as Naïve Bayes (NB), Support Vector Machines (SVM), Linear Regression, and Deep Learning.

Finally, hybrid approaches combine the desirable elements of rule-based and Machine Learning techniques into one system. The main advantage of this approach is that the results are often more accurate.

The research work highlighted in this paper uses a machine learning based approach for classifying texts into three classes – negative, positive and neutral. The methodology proposed here was also deployed into a web application so that anyone can use it, and if developed further, can be used in several critical applications such as in the field of psychology or, detecting the overall opinion from the reviews obtained for any product or, predicting the sentiment of a suspected criminal during interrogation.

Key Terms in this Chapter

Fine-Tuning: Process of adjusting the concerned parameters precisely to get optimum results.

Long Short-Term Memory: A type of Recurrent Neural Network which can process long sequence of data and remember values over arbitrary time intervals.

Tokenization: The process of separating sections of an input string based on a delimiter.

Sentiment Analysis: A field of study in Natural Language Processing (NLP) domain that focuses on determining the sentiment of data given as input.

Stemming: The process of transforming an inflected word to its root form.

Recurrent Neural Network: A type of Artificial Neural Network which can use its internal memory to process an input sequence.

Artificial Neural Network: A subset of machine learning whose structure is inspired by the human brain and they mimic the way biological neurons signal each other.

Complete Chapter List

Search this Book:
Reset