Mental Health Diseases Analysis on Twitter using Machine Learning


  • Mehak Faryal University of Engineering and Technology, Taxila
  • Munwar Iqbal
  • Hifsa Tahreem


Mental health; ethics; machine learning; algorithms; social media


Twitter is a cutting-edge platform among social networks. It allows microblogging of up to 140 characters for a single post. Due to this feature, it is popular among users. People tweet on a variety of topics, from everyday events to major accidents. Twitter Attitude Analysis gives organizations the ability to screen audiences' behaviour concerning related products and events in real-time. The first step in attitude analysis is the processing of Twitter data before the text. It uses a Twitter dataset that makes NLTK resources available to the public. Most of the existing research on Twitter attitude analysis focuses on removing mood traits. However, the pre-treatment method is used for selection. This study discussed the effect of the word processing method on mood classification. The performance measured in two types of classification activities and summarized. The classification performance of pre-processing methods using different attributes and classifiers in the Twitter dataset retrieved from Twitter Application Programming Interface API. The pre-processing used to remove URL’s removing meaningless numbers or words. Therefore, Twitter data is extracted, and the mood is calculated for tweets on a particular topic. It focuses on tweets about mental health problems caused by the use of social media platforms. We calculate and analyze attitudes from tweets using machine learning algorithms. We implement the machine learning algorithms, including Naive Bayes, Random Forest, Regression, and support vector machine. The results show that classification accuracy improves Twitter F1 ranking while using pre-processing methods to expand acronyms and replace negligence. The function extraction methods are combined with Machine Learning algorithms were found to have the highest accuracy of 92%.

Author Biographies

Mehak Faryal, University of Engineering and Technology, Taxila



Munwar Iqbal



Hifsa Tahreem






How to Cite

Faryal, M. ., Iqbal, M. ., & Tahreem, H. (2021). Mental Health Diseases Analysis on Twitter using Machine Learning. IKSP Journal of Computer Science and Engineering, 1(2), 16-25. Retrieved from