Analisis Sentimen Kesehatan Mental pada Media Sosial X Menggunakan BERT dengan Pendekatan XAI Berbasis SHAP dan LIME

Authors

  • Annisa Maulana Majid Universitas Pelita Bangsa, Indonesia
  • Ismasari Nawangsih Universitas Pelita Bangsa, Indonesia
  • Karina Imelda Universitas Pelita Bangsa, Indonesia

DOI:

https://doi.org/10.35889/progresif.v22i3.4070

Keywords:

Analisis Sentimen, BERT, XAI, SHAP, LIME

Abstract

Mental health had become an important issue widely discussed on social media, creating the need for an automated method to identify mental health conditions based on textual data. This study aimed to develop a text classification model using Bidirectional Encoder Representations from Transformers and improve the transparency of prediction results through Shapley Additive Explanations and Local Interpretable Model-agnostic Explanations. The dataset consisted of 51,073 text records categorized into seven mental health classes. The research stages included data and text cleaning, label encoding, data splitting, tokenization, model training, evaluation, and result interpretation. The testing results showed that the model achieved an accuracy of 82% and a weighted average F1-score of 0.82. The interpretation results indicated that specific words and phrases contributed to class predictions. The findings demonstrated that the model performed text classification effectively, while both interpretation methods improved the transparency of the model’s decision-making process.

Keywords: Sentiment Analysis; BERT; XAI; SHAP; LIME

 

Abstrak

Kesehatan mental telah menjadi isu penting yang banyak dibahas melalui media sosial sehingga diperlukan metode otomatis untuk mengidentifikasi kategori kondisi kesehatan mental berdasarkan teks. Penelitian ini bertujuan membangun model klasifikasi teks menggunakan Bidirectional Encoder Representations from Transformers (BERT) serta meningkatkan transparansi hasil prediksi melalui Shapley Additive Explanations (SHAP) dan Local Interpretable Model-agnostic Explanations (LIME). Dataset yang digunakan terdiri atas 51.073 teks dalam tujuh kategori kesehatan mental. Tahapan penelitian meliputi pembersihan data dan teks, pengodean label, pembagian data, tokenisasi, pelatihan model, evaluasi, serta interpretasi hasil. Hasil pengujian menunjukkan bahwa model memperoleh akurasi sebesar 82% dan nilai F1-score rata-rata tertimbang sebesar 0,82. Interpretasi menunjukkan bahwa frasa dan kata tertentu memberikan kontribusi terhadap prediksi kelas. Hasil penelitian membuktikan bahwa model mampu melakukan klasifikasi dengan kinerja yang baik, sedangkan kedua metode interpretasi meningkatkan transparansi keputusan model.

Author Biographies

Annisa Maulana Majid, Universitas Pelita Bangsa

Teknik Informatika

Ismasari Nawangsih, Universitas Pelita Bangsa

Teknik Informatika

Karina Imelda, Universitas Pelita Bangsa

Teknik Informatika

References

[1] D. L. Pardede et al., “Kehidupan Sehat Dan Sejahtera : Analisis Peran Kesehatan Mentaldalam Peningkatan Produktivitas Generasi Z,” J. Pengabdi. Kpd. Masy. MAJU UDA Univ., vol. 5, no. 3, pp. 43–52, 2024.

[2] D. K. Ningrum and A. M. Ismawardi, “Efektivitas Algoritma Kecerdasan Buatan Dalam Implementasi Kesehatan Mental : Systematic Literature Review,” J. Mhs. Tek. Inform., vol. 9, no. 1, pp. 689–698, 2025.

[3] Kementrian Kesehatan Republik Indonesia, “Hasil Riskesdas 2013,” Expert Opin. Investig. Drugs, vol. 7, no. 5, pp. 803–809, 2013, doi: 10.1517/13543784.7.5.803.

[4] Kemenkes, “Survei Kesehatan Indonesia 2023 (SKI),” Kemenkes, p. 235, 2023.

[5] K. Rahayu, V. Fitria, D. Septhya, R. Rahmaddeni, and L. Efrizoni, “Klasifikasi Teks untuk Mendeteksi Depresi dan Kecemasan pada Pengguna Twitter Berbasis Machine Learning,” MALCOM Indones. J. Mach. Learn. Comput. Sci., vol. 3, no. 2, pp. 108–114, 2023, doi: 10.57152/malcom.v3i2.780.

[6] Y. Jumaryadi, R. Fajriah, U. Salamah, B. Priambodo, and A. Lystha, “Machine Learning Approaches to Sentiment Analysis of Mental Health Discussions on Platform X,” PIKSEL Penelit. Ilmu Komput. Sist. Embed. Log., vol. 13, no. 2, pp. 43–54, 2025, doi: 10.33558/piksel.v13i2.11350.

[7] A. Rehman, M. Ahmed, H. U. Khan, A. Bukhari, A. Daud, and H. Dawood, “Mental Health Sentiment Analysis: Exploring an Optimized BERT with Deep Encodings,” Eng. Technol. Appl. Sci. Res., vol. 15, no. 5, pp. 26242–26248, 2025, doi: 10.48084/etasr.10469.

[8] A. Subakti, H. Murfi, and N. Hariadi, “The performance of BERT as data representation of text clustering,” J. Big Data, vol. 9, no. 1, pp. 1–21, 2022, doi: 10.1186/s40537-022-00564-9.

[9] V. Hassija et al., “Interpreting Black-Box Models: A Review on Explainable Artificial Intelligence,” Cognit. Comput., vol. 16, no. 1, pp. 45–74, 2024, doi: 10.1007/s12559-023-10179-8.

[10] M. D. Salman, N. R. Pratama, and M. N. F. A, “Comparison of K-Means and K-Medoids Clustering Algorithm Performance in Grouping Schools in Riau Province Based on Availability of Facilities and Infrastructure Perbandingan Kinerja Algoritma Clustering K-Means dan K-Medoids dalam Pengelompokan Sekolah di,” Malcom, vol. 5, no. 3, pp. 797–806, 2025, [Online]. Available: https://www.journal.irpi.or.id/index.php/malcom/article/view/1950

[11] A. A. Bastian, H. H. Handayani, D. Wahiddin, and T. Rohana, “Implementasi Algoritma Support Vector Regression dan Linear Regression Untuk Prediksi Harga Rumah,” Progresif J. Ilm. Komput., vol. 20, no. 2, p. 961, 2024, doi: 10.35889/progresif.v20i2.2191.

[12] A. F. Y. Khainur, T. Yuares, M. H. Fathurrohman, Widianingsih, and C. Rozikin, “Analisis Komparatif Efektivitas Pipeline Data Cleaning Berbasis Aturan Dan Lemmatisasi Untuk Klasifikasi Sentimen,” J. TIMES, vol. 14, no. 2, pp. 141–149, 2025, doi: 10.51351/jtm.14.2.2025890.

[13] L. Denna, H. Monasari, and N. Pratiwi, “Klasifikasi Stunting Pada Balita Menggunakan Algoritma Decision Tree Pada Machine Learning,” Decod. Pendidik. Teknol. Inf., vol. 5, no. 2, pp. 416–428, 2025.

[14] N. Karimah, “Multi-Aspect Sentiment Analysis Pada Review Film Menggunakan Metode Bidirectional Encoder Representations From Transformers (BERT),” Komputika J. Sist. Komput., vol. 13, no. 1, pp. 63–72, 2024, doi: 10.34010/komputika.v13i1.11098.

[15] A. O. Ibitoye, O. O. Oladimeji, I. O. Olaleye, and O. N. Emuoyibofarhe, “A context-aware BERT framework for detecting and modeling the mental health impact of online toxic language,” Data Sci. Manag., vol. 9, no. 2, p. 100175, 2026, doi: 10.1016/j.dsm.2025.12.002.

[16] S. L. Mirtaheri, A. Pugliese, N. Movahed, and R. Shahbazian, “A comparative analysis on using GPT and BERT for automated vulnerability scoring,” Intell. Syst. with Appl., vol. 26, no. 0, p. 200515, 2025, doi: 10.1016/j.iswa.2025.200515.

[17] P. W. Cahyo, U. S. Aesyi, W. A. Setianto, and T. Sulaiman, “A Novel Named Entity Recognition approach of Indonesian fake news using part of speech and BERT model on presidential election,” Int. J. Inf. Manag. Data Insights, vol. 5, no. 2, p. 100354, 2025, doi: 10.1016/j.jjimei.2025.100354.

[18] D. Chi, T. Huang, Z. Jia, and S. Zhang, “Research on sentiment analysis of hotel review text based on BERT-TCN-BiLSTM-attention model,” Array, vol. 25, no. 0, p. 100378, 2025, doi: 10.1016/j.array.2025.100378.

[19] A. R. Hanum et al., “ANALISIS KINERJA ALGORITMA KLASIFIKASI TEKS BERT DALAM MENDETEKSI BERITA HOAKS,” J. Teknol. dan Ilmu Komput., vol. 11, no. 3, pp. 537–546, 2024, doi: 10.25126/jtiik2024118093.

[20] A. Ripa’i, F. Santoso, and F. Lazim, “Deteksi Berita Hoax dengan Perbandingan Website Menggunakan Pendekatan Deep Learning Algoritma BERT Asep,” vol. 8, no. 3, pp. 1749–1758, 2024.

[21] N. Al-Ansari, D. Al-Thani, and M. Bahameish, “Explaining in context: Perceived informativeness of Explainable Artificial Intelligence (XAI) in Arabic hate speech detection,” Comput. Hum. Behav. Reports, vol. 22, no. 0, p. 101083, 2026, doi: 10.1016/j.chbr.2026.101083.

[22] U. Lagap, S. Ghaffarian, S. Gelinas-Gagne, J. Jilma, Z. Liu, and Z. Luo, “Towards reliable deep learning for post-disaster damage Assessment: An XAI-based evaluation,” Int. J. Disaster Risk Reduct., vol. 130, no. 0, p. 105839, 2025, doi: 10.1016/j.ijdrr.2025.105839.

[23] A. Budhkar, Q. Song, J. Su, and X. Zhang, “Demystifying the black box: A survey on explainable artificial intelligence (XAI) in bioinformatics,” Comput. Struct. Biotechnol. J., vol. 27, no. 0, pp. 346–359, 2025, doi: 10.1016/j.csbj.2024.12.027.

[24] S. Deng, C. Aldrich, X. Liu, and F. Zhang, “Explainability in Reservoir Well-logging Evaluation: Comparison of Variable Importance Analysis with Shapley Value Regression, SHAP and LIME,” IFAC-PapersOnLine, vol. 58, no. 22, pp. 66–71, 2024, doi: 10.1016/j.ifacol.2024.09.292.

[25] H. A. P. Mitchella Sinta Larasati, Suryasatriya Trihandaru, “Sistem Otomatis Klasifikasi Bukti Pembayaran Menggunakan Ocr Dan Embedding Bert Dengan Pendekatan Multi-Model Pembelajaran Mesin”, Pendas: Jurnal Ilmiah Pendidikan Dasar, vol. 11, no. 01, pp. 94–106, 2026.

[26] C. Sintiya, G. H. Hutagaol, D. Bate`e, and S. Irviantina, “Evaluasi Teknik Resampling untuk Class Balancing dalam Analisis Sentimen Kesehatan Mental Berbasis Bi-LSTM,” J. Sifo Mikroskil, vol. 26, no. 2, pp. 257–274, 2025, doi: 10.55601/jsm.v26i2.1799.

[27] D. Phiri, F. Makowa, V. L. Amelia, Y. V. A. Phiri, L. P. Dlamini, and M. H. Chung, “Text-Based Depression Prediction on Social Media Using Machine Learning: Systematic Review and Meta-Analysis,” J. Med. Internet Res., vol. 27, no. 0, pp. 1–17, 2025, doi: 10.2196/59002.

[28] İ. Baydili, B. Tasci, and G. Tasci, “Deep Learning-Based Detection of Depression and Suicidal Tendencies in Social Media Data with Feature Selection,” Behav. Sci. (Basel)., vol. 15, no. 3, p. 352, 2025, doi: 10.3390/bs15030352.

[29] F. A. Wagay and Jahiruddin, “An efficient approach to detecting mental illness on online social media platforms by using multidimensional textual features,” Acta Psychol. (Amst)., vol. 262, no. 0, p. 106191, 2026, doi: 10.1016/j.actpsy.2025.106191.

[30] T. Shaik, X. Tao, H. Xie, L. Li, N. Higgins, and J. D. Velásquez, “Towards Transparent Deep Learning in Medicine: Feature Contribution and Attention Mechanism-Based Explainability,” Human-Centric Intell. Syst., vol. 5, no. 2, pp. 209–229, 2025, doi: 10.1007/s44230-025-00104-7.

Downloads

Published

2026-07-15

How to Cite

Maulana Majid, A., Nawangsih, I., & Imelda, K. (2026). Analisis Sentimen Kesehatan Mental pada Media Sosial X Menggunakan BERT dengan Pendekatan XAI Berbasis SHAP dan LIME. Progresif: Jurnal Ilmiah Komputer, 22(3), 893–909. https://doi.org/10.35889/progresif.v22i3.4070

Issue

Section

Articles

Citation Check

Similar Articles

<< < 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 > >> 

You may also start an advanced similarity search for this article.