Analysis of Public Sentiment Toward Mental Health on Social Media Using Naïve Bayes

Authors

  • Wiji Lestari Sitorus Universitas Muhammadiyah Sumatera Utara, Medan, Indonesia
  • Zuli Agustina Gultom Universitas Muhammadiyah Sumatera Utara, Medan, Indonesia

DOI:

https://doi.org/10.35335/jict.v17i1.333

Keywords:

Mental health, Sentimen Analysis, X(twitter), Multinomial Naive Bayes, TF-IDF, Explainibility

Abstract

Mental health is a global issue that has garnered significant public attention on social media. The platform X (formerly Twitter) is widely used by the public to openly express emotional conditions, yielding vast amounts of unstructured textual data. This research aims to analyze public sentiment regarding mental health issues on social media X using the Multinomial Naïve Bayes algorithm combined with Term Frequency-Inverse Document Frequency (TF-IDF) word weighting. The dataset consists of 9,000 tweets written in Indonesian, collected between February 15 and 27, 2025, using the keywords kesehatan_mental (mental health), stress (stress), kecemasan (anxiety), and depresi (depression). To enhance data quality, a comprehensive text preprocessing pipeline was implemented, including cleaning, case folding, word normalization (using a 59-entry mapping dictionary), tokenizing, stopword removal, and stemming. The performance of the classification model was evaluated using a confusion matrix on 1,800 test data. The results demonstrate that the Multinomial Naïve Bayes model achieved a high accuracy of 90.78% and a macro average F1-score of 90.75%. Specifically, the positive sentiment class yielded a precision of 96.22% and a recall of 84.89%, while the negative sentiment class achieved a precision of 86.48% and a recall of 96.67%. Furthermore, this study integrates the classification model into a web-based system equipped with an explainability feature that visualizes word contributions to the sentiment outcomes. This research contributes an interpretative, informative, and efficient computational approach for monitoring public sentiment trends toward mental health issues on Indonesian social media.

References

Ainnur Rafli, & K. (2024). Indonesian Journal of Computer Science. 13(1), 1038–1049.

Arfan, I. S., Fauziah, S., & Nawangsih, I. (2024). Sentiment Analyst of Cyber Bullying in X Using Naïve Bayes Algorithm Analisa Sentimen Terhadap Cyber Bullying di X Menggunakan Algoritma Naïve Bayes. 4(October), 1411–1419.

Aulia, K., Amelia, L., & Mental, K. (2020). ANALISIS SENTIMEN TWITTER PADA ISU MENTAL HEALTH DENGAN ALGORITMA KLASIFIKASI NAIVE BAYES. 6(2), 60–65.

Dwiatmoko & Imelda, 2025. (2025). ANALISIS SENTIMEN KESEHATAN MENTAL DI TWITTER MENGGUNAKAN NAIVE BAYES CLASSIFIER DAN K- NEAREST NEIGHBOR. 6(1), 1–9.

Fattah & Purnawansyah, 2022. (2022). Analisis sentimen terhadap body shaming pada twitter menggunakan metode Naïve Bayes Classifier. 3(2), 61–71.

Mailo, F. F., Lazuardi, L., Manajemen, D., Fakultas, K., Masyarakat, K., & Mada, U. G. (2020). Analisis Sentimen Data Twitter Menggunakan Metode Text Mining Tentang Masalah Obesitas di Indonesia. 4(1).

Mohammed, I., & Hassani, H. (2025). Mining Mental Health Signals: A Comparative Study of Four Machine Learning Methods for Depression Detection from Social Media Posts in Sorani Kurdish. 1–13.

Sativa, O., & Silaen, D. (2022). Analisis Sentimen Mengenai Gangguan Bipolar Pada Twitter Menggunakan Algoritma Naïve Bayes. 6(2), 63–73.

Syahputra, P., & Kurniawan, R. (2024). Analisis Sentimen Terhadap Kesehatan Mental Remaja Menggunakan Metode Naive Bayes. 5(4), 1216–1224. https://doi.org/10.47065/josh.v5i4.5644

Wicaksono, M. L., & Apriana, D. (2022). ANALISIS SENTIMEN KESEHATAN MENTAL MENGGUNAKAN K-NEAREST NEIGHBORS PADA SOSIAL MEDIA TWITTER SENTIMENT ANALYSIS OF MENTAL HEALTH USING K-NEAREST NEIGHBORS ON SOCIAL MEDIA TWITTER. 19(2), 98–103.

Downloads

Published

2026-04-30

How to Cite

Sitorus, W. L. ., & Gultom, Z. A. . (2026). Analysis of Public Sentiment Toward Mental Health on Social Media Using Naïve Bayes. Jurnal ICT : Information and Communication Technologies, 17(1), 98–108. https://doi.org/10.35335/jict.v17i1.333