Professional Documents
Culture Documents
net/publication/335471905
CITATIONS READS
11 1,022
6 authors, including:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Siti hafizah Ab hamid on 27 April 2020.
Chempaka Seri binti Abdul Razak1, Muhammad Ameer bin Zulkarnain1, Siti Hafizah
binti Ab Hamid1, Badrul Anuar bin Juma’at1, Mohd Zalisham Jali2, Hasni bin Meon3,
1 Fac. Of Computer Sc. & Info. Techno, University of Malaya, Malaysia
2 Universiti Sains Islam Malaysia, Malaysia
3 Universiti Selangor, Malaysia
1 Introduction
Social media acts as a tool in public health providing instant communication in cross
generation. The social media applications for instance; Facebook, Instagram, and Twit-
ter encourage users to share their experiences, opinions, knowledge, and locations. In
addition, the applications provide a gigantic corpus of data from different regions, eco-
nomic climates, and languages which gives insights from political sentiment to public
health situation (Boydstun et al., 2013), (Aramaki, Maskawa, and Morita, 2011).
2
Among all social media platforms, Twitter is the only microblogging medium that al-
lows users to post short messages.
2 Related Works
Social media acts as a tool in public health providing instant communication in cross
generation. The social media applications for instance; Facebook, Instagram, and Twit-
ter encourage users to share their experiences, opinions, knowledge, and locations. In
addition, the applications provide a gigantic corpus of data from different regions, eco-
nomic climates, and languages which gives insights from political sentiment to public
health situation (Boydstun et al., 2013), (Aramaki, Maskawa, and Morita, 2011).
Among all social media platforms, Twitter is the only microblogging medium that al-
lows users to post short messages.
Twitter is one of the most popular social networking sites with almost 326 million ac-
tive users and 90 mil- lion tweets publicly broadcasted to a large audience [1]. Many
researchers have successfully utilized Twitter data as a source of insights into the epi-
demiology of emotions, depression and other mental disorders of the users who tweet.
De Choudhury et al. [2] used linguistic features to train a classifier to examine Twitter
posts that indicated depression among young mothers. Coppersmith et al. [3] looked
for tweets that explicitly stated “I was just diagnosed with depression” sentences. Pre-
otiuc-Pietroi et al. [4] applied broader textual features such as LIWC, LDA and frequent
1-3 grams on the Twitter data to examine the personality of the users with self- declared
post-traumatic stress (PTSD) disorders.. Resnik et al. [5] proved that the LDA model
can uncover a meaningful and potentially useful latent structure for the automatic iden-
tification of important topics for depression detection. Bentoni et al. [6] demonstrated
the effectiveness of multi-task learning (MTL) models on detecting mental health dis-
orders without the users clinical history. He used feed-forward perceptron and feed-
forward multi-task models trained to predict each task separately as well as to predict a
set of conditions simultaneously. Reece et al. [7] found out that the first stage of de-
pression may be detectable from the users Twitter posts several months prior to his
system analysis with 0.87 AUC of performance probability.
Table below shows a comparison of techniques used for all the research papers. All
related works used Twitter data to analyse and detect depression or mental disorder
using different methods of Machine Learning. However, they limit to English Language
and very specific domain or target users.
3 Methodology
The text classification techniques are divided into Machine Learning (ML) approach,
Lexicon-Based (LB) approach and Hybrid approach. The ML approach applies for the
ML algorithms and uses linguistic features. The LB approach relies on the sentiment
lexicon, a collection of known and precompiled sentiment terms. The LB approach is
divided into dictionary-based approach and corpus-based approach which use statistical
or semantic methods to find sentiment polarity. The Hybrid approach combines both
approaches and is very common with sentiment lexicons playing a key role in the ma-
jority of the methods.
The system employs a Machine Learning approach (Naïve Bayes), Lexicon-based ap-
proach (Natural Language Processing (NLP) technique) and Deep Learning approach
(Feedforward Neural Network).
P(label) is the prior probability of a label or the likelihood that a random feature set the
label. P(features|label) is the prior probability that a given feature set is being classified
as a label. P(features) is the prior probability that a given feature set is occurred. Given
the Naïve Bayes assumption which states that all features are independent, the equation
could be rewritten as follows:
P(label)∗P(𝑓1|𝑙𝑎𝑏𝑒𝑙)∗… …∗P(fn|label)
𝑃(𝑙𝑎𝑏𝑒𝑙|𝑓𝑒𝑎𝑡𝑢𝑟𝑒𝑠) = (2)
P(features)
An improved NB classifier was proposed by Kang and Yoo [8] to solve the problem of
the tendency for the positive classification accuracy to appear up to approximately 10%
higher than the negative classification accuracy. This creates a problem of decreasing
4
the average accuracy when the accuracies of the two classes are expressed as an average
value. They showed that using this algorithm with restaurant reviews narrowed the gap
between the positive accuracy and the negative accuracy compared to Naïve Bayes and
Support Vector Machine. The accuracy is improved in recall and precision compared
to both Naïve Bayes and Support Vector Machine.
Natural Language Processing (NLP) techniques are sometimes used with the lexicon-
based approach to find the syntactical structure and help in finding the semantic rela-
tions. Moreo and Romero [9] have used NLP techniques as preprocessing stage before
they used their proposed lexicon- based SA algorithm. Their proposed system consists
of an automatic focus detection module and a sentiment analysis module capable of
assessing user opinions of topics in news items which use a taxonomy- lexicon that is
specifically designed for news analysis. Their results were promising in scenarios
where colloquial language predominates.
The approach for SA presented by Caro and Grella [10] was based on a deep NLP
analysis of the sentences, using a dependency parsing as a pre-processing step. Their
SA algorithm relied on the concept of Sentiment Propagation, which assumed that each
linguistic element like a noun, a verb, etc. can have an intrinsic value of sentiment that
is propagated through the syntactic structure of the parsed sentence. They presented a
set of syntactic-based rules that aimed to cover a significant part of the sentiment sali-
ence expressed by a text. They proposed a data visualization system in which they
needed to filter out some data objects or to contextualize the data so that only the infor-
mation relevant to a user query is shown to the user. In order to accomplish that, they
presented a context- based method to visualize opinions by measuring the distance, in
the textual appraisals, between the query and the polarity of the words contained in the
texts themselves. They extended their algorithm by computing the context-based polar-
ity scores. Their approach approved high efficiency after applying it on a manual corpus
of 100 restaurants reviews.
Min and Park [11] have used NLP from a different perspective. They used NLP tech-
niques to identify tense and time expressions along with mining techniques and a rank-
ing algorithm. Their proposed metric has two parameters that capture time expressions
related to the use of products and product entities over different purchasing time peri-
ods. They identified important linguistic clues for the parameters through an experiment
with crawled review data, with the aid of NLP techniques.
arranged in multiple layers, where information in the resulting network of units is prop-
agated forward from one layer to another, from an initial input layer, to one or more
hidden layers, and then finally to an output layer, in a non-cyclic fashion. In this study,
the initial layer consisted of the inputs, represented as a “bag of words”, or a vector of
zeros and ones, with each value in the vector representing the presence or absence of a
unique token. These inputs are then multiplied by a vector of weights, which are the
parameters for the network that are trained through a learning process. The output pro-
duced by a hidden layer, or a layer between the input and output layers, is the result of
the application of an activation function to the values from the previous layer.
4 System Requirement
The functional requirement describes what the system will do. It is based on the view-
point of the target users.
1. The system shall allow the user and the administrator to login to the system via Twit-
ter.
2. The system shall be able to display the user’s followers and following profiles.
3. The system shall be able the user to display the user, his or her followers, and his or
her following tweets.
4. The system shall be able to visualise the analysed data in chart and table manner.
5. The sentiment module shall be able to receive Twitter data from the Twitter API
6. The sentiment module shall be able to calculate tweets sentiment score
7. The system shall allow the administrator to view users that have registered to the
system
8. The system shall allow the administrator to delete registered user from the system
Interoperability
1. The system is able to connect to Twitter database via the Twitter API
2. The system is able to communicate to three Python Application via REST API
6
5 System Development
Figure below shows the Use Case Diagram for the system. The user will login to the
system and they are able to analyze their tweet sentiment. The user also able to analyze
their followers or following tweets sentiment.
The system will send the tweets in JSON to be analyzed and stored the results in the
database. The tweets will be analyzed in all three models. The system will return the
predicted sentiments which are Positive, Negative or Neutral. When the system returns
two Positive results and one Negative or Neutral result, the system will take the Positive
predicted sentiment as for the Overall Predicted Sentiment, same as for two Negative
results and two Neutral results.
Both NLP model and ML model are not compatible to Malay tweets and tweets that
have more than one language which then predicted the tweets are Neutral. But for DL
model, the system can predict tweet in Malay and tweet that have more than one lan-
guage. For this result, when the system finds that both NLP and ML predicted the tweets
are neutral, it will then ignore both model results and take the DL model results. Figure
3 until Figure 6 shows the interface of the system.
Fig. 4. Number of Positive and Negative tweets of a user for each month (2019)
8
Fig. 5. Number of Positive and Negative tweets of a user for each month (2018)
6 Results
After extracting the data, this resulted in having 10,882 processed tweets, combined
English and Malay tweets. The tweets are then analyzed using three different tech-
niques which are Naïve Bayes Classifier technique, NLP techniques and Deep Learning
technique.
Table 2. Accuracy Score based on Techniques
Techniques Accuracy Score
Naïve Bayes 0.68
NLP 0.64
Feedforward Neural Network 0.72
For Naïve Bayes technique, it gives an accuracy score of 0.68 meanwhile for the NLP
technique produce an accuracy score of 0.64. It is found that both Naïve Bayes tech-
niques and NLP technique works well with English tweet, but it is not compatible to
Malay tweets as the corpus used is not in Malay. As for Deep Learning technique, the
accuracy score for the model is 0.72 which is the highest among of all the other tech-
niques. the model able to learn recognize the sentiments for Malay tweets, but the ac-
curacy of the model needs to be improved as more data need to be extracted.
Naïve Bayes Classifier technique and NLP technique gives a neutral value for Malay
tweets and combined tweets that consist more than one language in a tweet. Hence, we
can conclude that the model doesn’t compatible for other languages than English
tweets. As for Deep Learning technique, it manages to analyze on the Malay tweets and
tweets that have more than one language. Apart from that, the model doesn’t work well
with negation tweets as it produces a False Positive or False Negative result.
9
After the sentiment of each user tweets is calculated, the depression percentage is then
calculated based from the total positive and total negative tweets. If the users have a
high percentage of positive tweets, it will classify the users as an optimistic person that
implies the user is no depression related. Meanwhile, users that have a high percentage
of negative tweets, it will classify the users as an optimistic person that can implies the
users might be depression related.
7 Conclusion
Social media have gain insight that turn into signals that is tied to mental health issues
which have an increate rate in research interest. However, most of the research is done
in English. Our study demonstrates that a wide data collection is first used in research
that is done on English social media data with commonly used machine learning clas-
sifiers that is adequate in discriminate depressed social media users from a random
group. Furthermore, it demonstrates that this process is at least effective with Malay
data as it proven to be in the past studies with English data. Using a Python script to
bypass the limitations of the Twitter API while still leveraging publicly available data,
the sentiment of each tweets is calculated for each user. Various techniques are used to
calculate the sentiment of each tweets that are Naïve Bayes classifier, Natural Language
Processing and Deep Learning. However, all of the techniques are not further optimized
that could have a higher accuracy for Malay tweets. For future research, Malaysian is
well-known for having more than one language in a tweet which is comfortably called
Manglish which effect the results. Tweets that contain different number of punctuation
marks, words containing all capital letters (e.g. SUKA), words with character flooding
(e.g. sukaaaa), emojis, and negation words may affect the results. Next, more accurate
techniques, such as robust tokenization and stemming methods or any reliable methods
could improve the quality of the input text. Finally, tweets that contain words that have
a negative meaning but brings a positive vibe (e.g. savage, which can be translated as
someone who is unpredictable) to the community should be taken in context as it actu-
ally has a different meaning toward that community
References
1. T. S. Portal Statistics and Studies. (2019). Social Media Usage Worldwide. [Online]. Avail-
able: https://www.statista.com/statistics/272014/global- social-networks- ranked-by-num-
ber-of-users/
2. M. De Choudhury, S. Counts, and E. Horvitz, ‘‘Predicting postpartum changes in emotion
and behavior via social media,’’ in Proc. SIGCHI Conf. Hum. Factors Comput. Syst., Apr.
2013, pp. 3267–3276.
3. G. Coppersmith, M. Dredze, C. Harman, and K. Hollingshead, ‘‘From ADHD to SAD: An-
alyzing the language of mental health on twitter through self-reported diagnoses,’’ in Proc.
2nd Workshop Comput. Linguistics Clin. Psychol. Linguistic Signal Clin. Reality, 2015, pp.
1–10.
4. D. Preotiuc-Pietro et al., ‘‘The role of personality, age, and gender in tweeting about mental
illness,’’ in Proc. 2nd Workshop Comput. Linguistics Clin. Psychol. Linguistic Signal Clin.
Reality, 2015, pp. 21– 30.
10