Sentiment Analysis Task on Twitter Data
Sentiment Analysis Task on Twitter Data
Final Assignment
1 Introduction
Pang et al. (2008) [1] defines Sentiment Analysis as follows: “Sentiment anal-
ysis is the process to identify and analyze polarity from short texts, sentences,
and documents.”
According to them, sentiment seems to require a higher level of understand-
ing than just topic-based classification. Sentiment analysis has many uses in the
field of political and social sciences as well as for businesses. Companies can
use sentiment analysis to analyze customers’ satisfaction level of their products
and accordingly improve their products based on the opinions of customers to
provide better services in the future.
In this research paper, we are going to use BERT (Bidirectional Encoder Rep-
resentations from Transformers) [2]. We will benchmark BERT against current
methods to perform the Sentiment Analysis task on the Twitter data.
2 A. Akshat
2 Related Work
Sentiment analysis has become an interesting field for researchers with the in-
crease in amount of text messages from social media and blog posts. A compre-
hensive overview of prevailing work has been given in Pang and Lee, 2008 [1]. In
their paper, they have described the current approaches and techniques for an
opinion-oriented information retrieval. Pak and Paroubek (2010) [4] in their pa-
per have scraped tweets from Twitter using Twitter API. They combined those
tweets together and created a corpus in which each tweet was annotated by
emoticons. A Multinomial Naıve Bayes classifier which used N-gram and POS-
tags as features was trained and tested on the corpus. Parikh and Movassate
(2009) [5] have used Naıve Bayes bigram model to classify tweets and compared
it with Maximum Entropy model. They inferred that Naıve Bayes model per-
forms much better than Maximum Entropy model. On the contrary, Go and
L.Huang (2009) [6] say that SVM outperforms other models. They made use
of unigrams, bigrams and POS for their feature space. Cliche (2017) described
in his paper about Twitter sentiment classifier using Convolutional Neural Net-
works (CNNs) and Long Short Term Memory (LSTM) networks. His sentiment
classifier utilized huge volumes of unlabeled data to pre-train word embeddings.
A subset of the unlabeled data set was then used to refine the word embeddings
using distant supervision. Lastly, the final CNNs and LSTMs were trained on
the SemEval-2017 Twitter dataset where the word embeddings are refined again.
The goal was to improve performance of his sentiment classifier for which several
CNNs and LSTMs were combined together.
3 Data
For this research paper, we have used the SemEval 2017 Tweets dataset [3]. The
data collected from Twitter is particularly useful in Sentiment Analysis for the
following reasons:
We can observe the sample of our Twitter data in the figure 1. The dataset
provided had 3 columns in each file, namely
– Item ID
– Sentiment (Positive, Neutral, Negative)
– Sentiment Text (Tweet)
4 Method
In this section, we will describe the methods and experiments performed. We
used a pre-trained general BERT to perform the task of Sentiment Analysis.
To perform the Sentiment Analysis using pre-trained BERT and evaluating and
comparing its performance against current methods, we choose Logistic Re-
gression and Support Vector Machines as our baseline methods.
The distribution of Tweets with respect to its polarity can be seen in the
figure 2. It shows that the polarity is almost fairly distributed among the dataset
used for performing the experiments in this paper.
4.2 Experiment
5 Results
From the results table, we can see that pre-trained BERT performs better
than the respective baseline models over all metrics. However, Logistic Regres-
sion seems to perform better than the Support Vector Machines. SVM seems
to perform worse when we have a large dataset and the dataset contains a lot
of noise since Twitter data has a lot of noise this can be the reason behind its
performance.
6 Conclusion
References
1. Bo Pang and Lillian Lee (2008): ”Opinion Mining and Sentiment Analysis”,
Foundations and Trends® in Information Retrieval: Vol. 2: No. 1–2, pp 1-135.
https://doi.org/http://dx.doi.org/10.1561/1500000011
6 A. Akshat
2. Jacob Devlin, Ming-Wei Chang, Kenton Lee and Kristina Toutanova (2018):
”BERT: Pre-training of Deep Bidirectional Transformers for Language Understand-
ing”. https://doi.org/https://arxiv.org/abs/1810.04805
3. SemEval-2017 Task 4. https://doi.org/https://alt.qcri.org/semeval2017/task4/
4. Pak, Alexander Paroubek, Patrick. (2010). Twitter as a Corpus for
Sentiment Analysis and Opinion Mining. Proceedings of LREC. 10.
https://www.researchgate.net/publication/220746311
Twitter as a Corpus for Sentiment Analysis and Opinion Mining
5. Parikh, Ravi Movassate, Matin. (2009). Sentiment Analysis of User-
Generated Twitter Updates using Various Classication Techniques.
https://www.researchgate.net/publication/242660794
Sentiment Analysis of User-Generated Twitter Updates using Various Classication
Techniques/citation/download
6. Go, Alec Bhayani, Richa Huang, Lei. (2009). Twitter sen-
timent classification using distant supervision. Processing. 150.
https://www.researchgate.net/publication/228523135 Twitter sentiment classification
using distant supervision