Retrieve
Retrieve
Index Terms— Twitter, Machine Learning, Natural Language Processing (NLP), TFIDF, SVM,
Naïve Bayes, Gaussian Bayes, Random Forest Technique.
I. INTRODUCTION
Worldwide, mental illness is the main cause of disability. Depression has become a serious health concern
globally in the wake of the Covid 19 epidemic, with 322 million people suffering from it worldwide. The
Western Pacific and Southeast Asian areas account for around half of these sad persons [2].
India has one of the world's highest rates of mental illness. According to a 2016 National Mental Health Survey,
over 14% of India's population requires active mental health treatment. However, in the early phases of
depression, 70% of individuals would not seek medical help, potentially advancing their disease.
Even though 87% of governments around the planet offer few basic health management duties to combat
emotional disorders, 30% do not have a program, and 28% do not have a loyal budget. For insane energy
(Detels, 2009). There has been a shift in the use of public news actual data for recognizing and forecasting
variations in depression incidence recently. Early recognition of attraction syndromes and their situation
according to the schedule [11] may prevent the onset of a large gloomy scene. De Choudhury and others [15]
616
who have been diagnosed with clinical depression using a conventional psychometric instrument. They evaluate
behavioral traits linked to social engagement, emotion, language and linguistic styles, ego network, and mentions
of antidepressant drugs through their social media postings over a year before the development of depression.
The authors of the study [15] look at a variety of language signals that might assist in detecting emotion cause
events, such as the location of the cause event and the experiencer about the emotion keyword: emotional
processes such as positive emotion, negative emotion, sorrow, rage, and anxiety.
III. METHODOLOGY
Nowadays, on practically every trendy issue, people express their feelings through judgment, reviews, and
opinions. Because individuals are so open about their emotions on social media sites, a machine learning method
may be utilized to detect depression. We present an overview of several technological techniques for detecting
depression and mental diseases using Natural Language Processing (NLP) and text classification algorithms in
this work. Following the machine learning classifiers, the framework includes data pretreatment and feature
extraction.
A. Dataset
The tweets in this dataset were obtained using the Twitter API (elevated). For the train and test datasets for our
model, we collected over 20,000 tweets that were based on the following keywords: 'Diagnosed with depression,'
'I am depressed,' 'Depressed,' Suicidal'. To avoid overfitting, we'll use 10-fold cross-validation.
B. System Architecture
A study was conducted to build and analyze a variety of machine learning classification models in order to
determine if a Twitter user's tweets are focused on depression or mental illness. To ensure accuracy and avoid
overfitting, the model is trained using cross-validation.
To begin, tweets are obtained using various keywords, and also user accounts and relevant details such as the
number of followers and friends, via the Twitter API. Before being combined into a single document, tweets and
user activity data are preprocessed separately.
C. Data Preprocessing
We have two categories of data in our dataset: text and numerical. Text data is pre-processed using natural
language processing, while numerical data is pre-processed using normalization.
Data Cleaning
First, we tokenize and partition the tweets to remove any noisy data. URLs, hashtags, mentions, punctuation, and
stopwords are all removed using regular expressions. Emojis and emoticons are not removed since they might
carry vital information about the sentiment. Then we use stemming to break the words to their root kind and
group related terms together.
Normalization: To prepare the data for our machine learning model, we performed normalization on the user
activity data, as well as the number of friends and followers. The data is normalized using RobustScaler, which
uses the first and third quartiles.
617
Feature Extraction
The fundamental disadvantage of language processing is that machine learning algorithms can't handle raw text
as an input. As a result, we employ feature extraction software that extracts essential textual features and
converts them into numerical vectors.
Bag-Of-Words is the feature extraction technique we're using here.
Bag-Of-Words:- A bag-of-words tool extracts information from text for modeling purposes and is widely used in
NLP machine learning algorithms. A vocabulary of unique words is built after preprocessing and formatting the
text input in lowercase letters. After that, a feature matrix is built by assigning a column to each phrase or word
and a row to each sentiment. Each entry in the matrix represents the existence of a word in the emotion.
To minimize overfitting, we picked terms from the lexicon that appear in more than 5 phrases and in less than
90% of the phrases.
D. ML Classification Techniques
Support Vector Machine
The SVM algorithm's purpose is to find the optimum decision boundary for partitioning n-dimensional space
into classes so that we can simply move fresh data points into the appropriate category. The hyperplane refers to
the optimal choice boundary. SVM chooses the extreme points that will aid in the formation of the hyperplane.
Support vectors represent extreme examples, which is why the technique is named a support vector machine. We
utilize SVM for text classification because it can manage the large number of characteristics that text
classification generates. The number of features has no effect on SVM since it implements the margin through
data separation rather than the number of features. This suggests that if our data can be separated by a large
margin using functions from the hypothesis space, SVM will perform well efficiently. It is unaffected by
mislabeled data, which is common with textual data.
Naïve Bayes
The Naive Bayes algorithm is a straightforward classification method that relies on event probability. It's based
on Bayes' theorem, which asserts that characteristics have no association. When compared to other text
classifiers, Naive Bayes models let each feature participate in the final decision equally and independently from
other features, making them more computationally.
618
B. Results
Cross-validation and other categorization methods are used to test every conceivable combination of input data
(SVM-linear, Random Forest, and Naive Bayes). Depressed/not depressed is the anticipated label for every
training/testing sample. According to Word Cloud, "Love" and "life" are the most often used positive terms.
"Depressed," "panic attack," and "suicide" are the most common negative terms. Figure 2 indicates that all the
recommended classification algorithms worked admirably on our data. SVM-F1 Linear's measure for test data is
0.994, whereas the random forest's F1 measure is 0.995, this shows abnormally high-test results. Even with
varied vectorizer and feature settings, SVM-Linear surpasses all other classifiers. Both Naive bayes classifiers
show reasonable results with F1-scores of 0.84 and 0.94.
Table I illustrates the relative importance of the top ten characteristics in our classifiers. The top three attributes
are all positive terms, indicating that positive words are given greater weight than negative phrases. The recall
score of several classifiers may be used to confirm our hypothesis. Table 2 shows different recall scores of the
classifiers used.
Table 2 demonstrates that recall is smaller than precision, proving our previous premise. It also demonstrates that
the Gaussian Naive Bayes classifier is more sensitive to feature vector strength.
Min_df is a TF-IDF vectorizer hyperparameter that sets a lower constraint on the frequency of words in the
corpus. Outliers and redundant characteristics are extremely sensitive to the Naive Bayes classification method.
619
Table III demonstrates how varying lower constraints on word frequency affect the performance of Naive Bayes
classifiers. NB performance converges at a min df of 15, removing words that appear less than 15 times in our
dataset.
Min_df 1 5 15
Accuracy 0.92 0.93 0.95
Precision 0.95 0.94 0.96
Recall 0.89 0.92 0.94
F1_Score 0.92 0.93 0.95
V. CONCLUSIONS
The system gathers information from social media and analyzes the user's mood. We can access a number of
candidates by keeping an eye on their social media accounts because practically everyone nowadays utilizes
social media platforms to describe their life experiences. The tweets are computed using a natural language
processing algorithm. Support Vector Machines (SVM), Naive Bayes (Gaussian Naive Bayes, Multinomial
Naive Bayes), and Random Forest are used in this technique. The system can identify mental states such as
happiness, anxiety, melancholy, pleasure, anxiety, and so on. The system collects tweets written by a Twitter
user and classifies the kind of depression using the Twitter API. As a result, it also conveys the intensity of
depression. Psychiatrists, NGOs, and other charitable organizations can utilize this technique to keep track of
their patients' or applicants' emotions.
REFERENCES
[1] Machine Learning Based On Approach For Detection Of Depression Using Social Media Using Sentiment Analysis
Geeta Tiwari1 , Gaurav Das 2 Assistant Professor, Department of CSE Compucom Institute of Technology and
Management , Jaipur Volume 6 Issue 3 March 2021.
[2] Current Research in Behavioral Sciences. An in-depth analysis of machine learning approaches to predict depression
2021 Md.Sabab Zulfike rNasrin Kabir Al Amin Biswas Tahmina Nazneen Mohammad Shorif Uddin.
[3] International Journal of Pharma Medicine and Biological Sciences Vol. 10, No. 1, January 2021. An EEG-Based
Depression Detection Method Using Machine Learning Model Ran Bai1 , Yu Guo2 , Xianwu Tan1 Lei Feng3,4,5, and
Haiyong Xie5,1 1National Engineering Laboratory for Public Safety Risk Perception and Control by Big Data (NEL-
PSRPC), Beijing, China. Journal of personalized medicine.
[4] Review Machine Learning-Based Behavioral Diagnostic Tools for uuDepression: Advances, Challenges, and Future
Directions Thalia Richter 1,*,Barak Fishbain 2 , Gal Richter-Levin 1 and Hadas Okon-Singer.
[5] Journal of trends in Computer Science and Smart technology (TCSST) (2021) Vol.03/ No. 01 Pages: 24-39
https://www.irojournals.com/tcsst/ DOI:
[6] Detecting depression using an ensemble classifier based on Quality of Life scales Xiaohui Tao1* ,Oliver Chi2 , Patrick
J. Delaney1 , Lin Li3 and Jiajin Huang4.
[7] Depression Detection using Machine Learning K. Sudha , S. Sreemathi , B. Nathiya , D. Rahini Priya Associate
Professor, CSE Department, Muthayammal Engineering College, Tamil Nadu 2020.
620
[8] A Weakly Supervised Learning Framework for Detecting Social Anxiety and Depression. Proc. ACM Interact. Mob.
Wearable Ubiquitous Technol., Vol. 2, No. 2, Article 81. Publication date: June 2018.
[9] Machine Learning-based Approach for Depression Detection in Twitter Using Content and Activity Features Hatoon
AlSagri 1,2 Mourad Ykhlef
[10] A.H. Yazdavar, H.S. Al-Olimat, T. Banerjee, K. Thirunarayan, and A.P. Sheth, “Analyzing clinical depressive
symptoms in twitter”,2016.
[11] M. Nadeem, “Identifying depression on twitter,” arXiv preprint arXiv:1607.07384, 2016.
[12] G. Harman and M.H. Dredze, “Measuring post-traumatic stress disorder in twitter,” ICWSM, 2014. G. Coppersmith, M.
Dredze, and C. Harman.
[13] “Quantifying mental health signals in twitter,” Proceedings of the workshop on computational linguistics and clinical
psychology: From linguistic signal to clinical reality, pp.51–60, 2014. G. Coppersmith, M. Dredze, and C. Harman.
[14] De Choudhury, M., Gamon, M., Counts, S., & Horvitz, E. Predicting depression via social media. ICWSM. 13, 1-10
(2013).
[15] Depression detection from social network data using machine learning techniques Md. Rafiqul Islam, 1 Muhammad
Ashad Kabir,2 Ashir Ahmed,3 Abu Raihan M. Kamal,1 Hua Wang,4 and Anwaar Ulhaq5.
621
Copyright of Grenze International Journal of Engineering & Technology (GIJET) is the
property of GRENZE Scientific Society and its content may not be copied or emailed to
multiple sites or posted to a listserv without the copyright holder's express written permission.
However, users may print, download, or email articles for individual use.