Detecting the Impact of Social Media on Users' Mental Health Using Machine Learning and XAI
DOI:
https://doi.org/10.24002/jbi.v17i1.13409Keywords:
Machine Learning, Social Media, Mental Health, Explainable AI, XGBoostAbstract
This research develops a machine learning-based predictive system to detect potential depression due to social media use, and compares the performance of algorithms such as Random Forest, XGBoost, and Naïve Bayes. Survey data, including age, gender, relationship status, daily usage duration, and social media platform, were used to build the model, with accuracy, precision, recall, and F1-score evaluated. XGBoost showed the best performance with 90% accuracy and a high F1-score. The main features that affect depression prediction include duration of social media use, age, and platforms. Explainable AI (XAI) techniques with LIME increase the transparency of the model, provide relevant explanations for individuals, and strengthen confidence in the predictions. This research emphasizes the importance of transparency in model implementation in the mental health field and offers a flexible solution that can be adopted for digital applications such as chatbots or real-time mental health monitoring dashboards.
Penelitian ini mengembangkan sistem prediktif berbasis machine learning untuk mendeteksi potensi depresi akibat penggunaan media sosial, serta membandingkan kinerja algoritma seperti Random Forest, XGBoost, dan Naïve Bayes. Data survei yang meliputi usia, jenis kelamin, status hubungan, durasi penggunaan harian, dan platform media sosial digunakan untuk membangun model dengan evaluasi akurasi, precision, recall, dan F1-score. XGBoost menunjukkan kinerja terbaik dengan akurasi 90% dan F1-score tinggi. Fitur utama yang memengaruhi prediksi depresi meliputi durasi penggunaan media sosial, usia, dan platform. Teknik Explainable AI (XAI) dengan LIME meningkatkan transparansi model, memberikan penjelasan yang relevan untuk individu, dan memperkuat kepercayaan terhadap prediksi. Penelitian ini menekankan pentingnya transparansi dalam penerapan model di bidang kesehatan mental dan menawarkan solusi fleksibel yang dapat diadopsi untuk aplikasi digital seperti chatbot atau dashboard pemantauan kesehatan mental real-time.
References
[1] C. Cheng, Y. C. Lau, L. Chan, and J. W. Luk, "Prevalence of social media addiction across 32 nations: Meta-analysis with subgroup analysis of classification schemes and cultural values," Addict. Behav., vol. 117, Art. no. 106845, 2021, doi: 10.1016/j.addbeh.2021.106845.
[2] Y. Sun and Y. Zhang, "A review of theories and models applied in studies of social media addiction and implications for future research," Addict. Behav., vol. 114, Art. no. 106699, 2021, doi: 10.1016/j.addbeh.2020.106699.
[3] M. Schredl, "Continuity Between Waking Life and Dreaming: A Research Note and Study in Adolescents," Imagination, Cognition and Personality, vol. 44, no. 1, pp. 104–116, 2024, doi: 10.1177/02762366241254818.
[4] B. Sheaves, S. Rek, and D. Freeman, "Nightmares and psychiatric symptoms: a systematic review of longitudinal, experimental, and clinical trial studies," Clin. Psychol. Rev., vol. 100, Art. no. 102241, 2023, doi: 10.1016/j.cpr.2022.102241.
[5] C. Montag and S. Hegelich, "On the Psychology of TikTok Use: A First Glimpse From Empirical Findings," Front. Public Health, vol. 9, Art. no. 641673, 2021, doi: 10.3389/fpubh.2021.641673.
[6] H. C. Woods and H. Scott, "Sleepyteens: Social media use in adolescence is associated with poor sleep quality, anxiety, depression and low self-esteem," J. Adolesc., vol. 51, pp. 41–49, 2016, doi: 10.1016/j.adolescence.2016.05.008.
[7] T. F. Kurnaz, C. Erden, U. Dağdeviren, et al., "Comparison of machine learning algorithms for slope stability prediction using an automated machine learning approach," Nat. Hazards, vol. 120, no. 8, pp. 6991–7014, 2024, doi: 10.1007/s11069-024-06490-8.
[8] R. Geetha, S. Gunanandhini, G. Umarani Srikanth, and V. Sujatha, "Human Stress Detection in and Through Sleep Patterns Using Machine Learning Algorithms," J. Inst. Eng. India Ser. B, vol. 105, no. 6, pp. 1691–1713, 2024, doi: 10.1007/s40031-024-01079-y.
[9] D. Agarwal, V. Singh, A. K. Singh, and P. Madan, "Stacked ensemble model for analyzing mental health disorder from social media data," Multimedia Tools Appl., vol. 83, pp. 53923–53948, 2023, doi: 10.1007/s11042-023-17395-2.
[10] D. J. Yu, Y. K. Wing, T. M. H. Li, and N. Y. Chan, "The Impact of Social Media Use on Sleep and Mental Health in Youth: A Scoping Review," Curr. Psychiatry Rep., vol. 26, pp. 104–119, 2024, doi: 10.1007/s11920-024-01481-9.
[11] Y. Ibrahimov, T. Anwar, and T. Yuan, "Explainable AI for Mental Disorder Detection via Social Media: A Survey and Outlook," arXiv preprint arXiv:2406.05984, 2024.
[12] Z. Bao, A. Pérez, and J. Parapar, "Explainable depression symptom detection in social media," Health Inf. Sci. Syst., vol. 12, Art. no. 47, 2024, doi: 10.1007/s13755-024-00303-9.
[13] H. Zogan, I. Razzak, X. Wang, S. Jameel, and G. Xu, "Explainable depression detection with multi-modalities using a hybrid deep learning model on social media," World Wide Web, vol. 25, no. 1, pp. 1–25, 2022, doi: 10.1007/s11280-021-00992-2.
[14] J. Meynadier, J. M. Malouff, N. S. Schutte, N. M. Loi, and M. D. Griffiths, "Relationships Between Social Media Addiction, Social Media Use Metacognitions, Depression, Anxiety, Fear of Missing Out, Loneliness, and Mindfulness," Int. J. Ment. Health Addict., 2025, doi: 10.1007/s11469-024-01440-8.
[15] T. Xiao, M. Pan, X. Xiao, and Y. Liu, "The Relationship Between Physical Activity and Sleep Disorders in Adolescents: A Chain-Mediated Model of Anxiety and Mobile Phone Dependence," BMC Psychol., vol. 12, Art. no. 751, 2024, doi: 10.1186/s40359-024-02237-z.
[16] T. S. Alshammari, "Applying Machine Learning Algorithms for the Classification of Sleep Disorders," IEEE Access, vol. 12, pp. 36110–36125, 2024, doi: 10.1109/ACCESS.2024.3374408.
[17] N. C. Ramadhan, H. Hikmayanti, T. Rohana, and A. M. Siregar, "Optimasi Algoritma Machine Learning Menggunakan Seleksi Fitur XGBoost Untuk Klasifikasi Kanker Payudara," TIN: Terapan Informatika Nusantara, vol. 5, no. 2, pp. 162–171, 2024, doi: 10.47065/tin.v5i2.5408
[18] Vincent and N. Rachmat, “Penerapan Algoritma Gradient Boosting dalam Mendiagnosa Penyakit Kucing dan Anjing,” Jurnal Buana Informatika, vol. 16, no. 2, pp. 134–143, Oct. 2025.
[19] N. Rohmah, E. A. Safitri, C. Alinta, Y. Oktalina, and W. Setiawan, "Perbandingan Akurasi Metode Naive Bayes dan Metode Random Forest dalam Mendiagnostik Penyakit Kanker Payudara," DoubleClick: J. Comput. Inf. Technol., vol. 8, no. 2, pp. 109–118, 2025, doi: 10.25273/doubleclick.v8i2.20383.
[20] D. Kurniasari, R. N. Hidayah, N. Notiragayu, W. Warsono, and R. K. Nisa, "Classification Models for Academic Performance: A Comparative Study of Naïve Bayes and Random Forest Algorithms in Analyzing University of Lampung Student Grades," Jurnal Teknik Informatika (JUTIF), vol. 5, no. 5, pp. 1267–1276, Oct. 2024, doi: 10.52436/1.jutif.2024.5.5.2066.
[21] B. Keles, N. McCrae, and A. Grealish, "A systematic review: the influence of social media on depression, anxiety and psychological distress in adolescents," Int. J. Adolesc. Youth, vol. 25, no. 1, pp. 79–93, 2020, doi: 10.1080/02673843.2019.1590851.
[22] M. G. Hunt, R. Marx, C. Lipson, and J. Young, "No more FOMO: Limiting social media decreases loneliness and depression," J. Soc. Clin. Psychol., vol. 37, no. 10, pp. 751-768, 2018, doi: 10.1521/jscp.2018.37.10.751
[23] J. M. Twenge, T. E. Joiner, M. L. Rogers, and G. N. Martin, "Increases in depressive symptoms, suicide-related outcomes, and suicide rates among U.S. adolescents after 2010 and links to increased new media screen time," Clin. Psychol. Sci., vol. 6, no. 1, pp. 3–17, 2018, doi: 10.1177/2167702617723376.
Downloads
Published
Issue
Section
License

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Copyright of this journal is assigned to Jurnal Buana Informatika as the journal publisher by the knowledge of author, whilst the moral right of the publication belongs to author. Every printed and electronic publications are open access for educational purposes, research, and library. The editorial board is not responsible for copyright violation to the other than them aims mentioned before. The reproduction of any part of this journal (printed or online) will be allowed only with a written permission from Jurnal Buana Informatika.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.







