Sentiment Analysis of Depression Detection on Twitter Social Media Users Using the K-Nearest Neighbor Method

Arianti Primadhani Tirtopangarsa, Warih Maharani


Every day, millions of people suffer from depression and only a small percentage of them receive proper treatment. Depression is one of the most common mental health disorders. Mental health is very important for humans as well as physical health in general. Not infrequently media users often provide information about themselves and the complaints they experience on burdensome social media. At this time the detection can be detected from the activities of social media users themselves. Because, not infrequently Twitter social media users often provide information about themselves and the complaints they are experiencing on Twitter social media which is burdensome. Therefore, social media Twitter is an option to detect the level of mental health that is being experienced by someone. In this study, the author aims to analyze the application of the K-Nearest Neighbor method in detecting depression in Twitter social media users and see the accuracy value. Based on tests on the KNN classification using the stages of the confusion matrix, the accuracy obtained is 78.18%.


depression, sentiment analysis, K-Nearest Neighbor, twitter

Full Text:



P. Antinasari, R. S. Perdana, and M. A. Fauzi, “Analisis Sentimen Tentang Opini Film pada Dokumen Twitter Berbahasa Indonesia Menggunakan Naive Bayes dengan Perbaikan Kata Tidak Baku Human Detection and Tracking View project Smart Mobile Navigation System View project,” no. October, 2017, [Online]. Available:

J. Degenhard, “Forecast of the number of Twitter users in Indonesia from 2017 to 2026,”, 2020.

W. P. Ali, Y. Sibaroni, and S. Si, “Analisis Sentimen Masyarakat Terhadap Kinerja Presiden Indonesia Dalam Aspek Ekonomi , Kesehatan , dan Pembangunan Berdasarkan Opini dari Twitter,” e-Proceeding Eng., vol. 6, no. 2, pp. 8637–8649, 2019.

HIMPSI, “Seri Sumbangan Pemikiran Psikologi untuk Bangsa Ke-5 Kesehatan Jiwa dan Resolusi Pascapandemi di Indonesia,” Himpsi.or.Id, no. September 2019, p. 13, 2020, [Online]. Available: panduan-penulisan-132.

B. Y. Ziwei and H. N. Chua, “An application for classifying depression in tweets,” ACM Int. Conf. Proceeding Ser., pp. 37–41, 2019, doi: 10.1145/3366650.3366653.

John Elflein, “Depression level increases during the COVID-19 pandemic worldwide June 2020, by age,”, 2020. to-covid-by-age-worldwide/.

M. Deshpande and V. Rao, “Depression detection using emotion artificial intelligence,” Proc. Int. Conf. Intell. Sustain. Syst. ICISS 2017, no. Iciss, pp. 858–862, 2018, doi: 10.1109/ISS1.2017.8389299.

R. Wald, T. Khoshgoftaar, and C. Sumner, “Machine prediction of personality from Facebook profiles,” Proc. 2012 IEEE 13th Int. Conf. Inf. Reuse Integr. IRI 2012, vol. 2, pp. 109–115, 2012, doi: 10.1109/IRI.2012.6302998.

Y. Li, B. Hu, X. Zheng, and X. Li, “EEG-Based Mild Depressive Detection Using Differential Evolution,” IEEE Access, vol. 7, pp. 7814–7822, 2019, doi: 10.1109/ACCESS.2018.2883480.

H. Cai et al., “A Pervasive Approach to EEG-Based Depression Detection,” Complexity, vol. 2018, 2018, doi: 10.1155/2018/5238028.

K. Chanda, P. Bhattacharjee, S. Roy, and S. Biswas, “Intelligent Data Prognosis of Recurrent of Depression in Medical Diagnosis,” ICRITO 2020 - IEEE 8th Int. Conf. Reliab. Infocom Technol. Optim. (Trends Futur. Dir., pp. 840–844, 2020, doi: 10.1109/ICRITO48877.2020.9197843.

X. Li, T. Cao, S. Sun, B. Hu, and M. Ratcliffe, “Classification study on eye movement data: Towards a new approach in depression detection,” 2016 IEEE Congr. Evol. Comput. CEC 2016, pp. 1227–1232, 2016, doi: 10.1109/CEC.2016.7743927.

M. S. Saputri, R. Mahendra, and M. Adriani, “Emotion Classification on Indonesian Twitter Dataset,” Proc. 2018 Int. Conf. Asian Lang. Process. IALP 2018, no. November, pp. 90–95, 2019, doi: 10.1109/IALP.2018.8629262.

A. Dirgayunita, “Depresi: Ciri, Penyebab dan Penangannya,” J. An-Nafs Kaji. Penelit. Psikol., vol. 1, no. 1, pp. 1–14, 2016, doi: 10.33367/psi.v1i1.235.

M. F. Muzakki, R. F. Umbara, F. Informatika, and U. Telkom, “Analisis Sentimen Mahasiswa Terhadap Fasilitas Universitas Telkom Menggunakan Metode Jaringan Saraf Tiruan Dan Tf-Idf,” vol. 6, no. 2, pp. 8608–8616, 2019.


  • There are currently no refbacks.