Fika Apriliani
Warih Maharani



Depression is a serious mental illness. Depression is usually characterized by feelings of sadness, hopelessness, anxiety, restlessness, and even loss of life. However, not everyone who experiences depression can get professional treatment. If depression is left unchecked, it can worsen the mental health conditions experienced by a person. Social media, one of which is the increasingly popular twitter can be utilized to help deal with the problem of undetected mental illness. Based on tweets made by a person twitter social media can be one of the sources to detect depression using the XLNet method. XLNet is one of the NLP (Natural Language Processing) techniques based on machine learning models on text. Based on several tests that have been carried out during the research such as testing various tuning hyper-parameters with different values on the XLNet model, it achieves a good performance value with an average accuracy value of 93.33%.


Depression; Social Media; Twitter; XLNET; NLP

Full Text:


Article Metrics :


World Health Organization (WHO), "World Health Organization (WHO) : Depression," 13 September 2021. [Online]. Available: [Accessed 28 October 2021].

K. Ho, "YouGov : A quarter of Indonesians have experienced suicidal thoughts," 26 June 2019. [Online]. Available: [Accessed 28 October 2021].

D. Ridge and S. Ziebland, The old me could never have done that: How people give meaning to recovery following depression, Quali-tative Health Research, vol. 16, no. 8, pp. 10381053, Oct. 2006, doi: 10.1177/1049732306292132.

S. C. Guntuku, D. B. Yaden, M. L. Kern, L. H. Ungar, and J. C. Eichstaedt, Detecting depression and mental illness on social media: an integrative review, Current Opinion in Behavioral Sciences, vol. 18. Elsevier Ltd, pp. 4349, Dec. 01, 2017. doi: 10.1016/j.cobeha.2017.07.005.

S. KEMP, "DIGITAL 2022: GLOBAL OVERVIEW REPORT," Data Reportal, 26 January 2022. [Online]. Available: [Accessed 26 August 2022].

"SPECIAL REPORT DIGITAL 2021," We Are Social, January 2021. [Online]. Available: [Accessed 26 August 2022].

Statista, "Statista : Leading countries based on number of Twitter users as of October 2021," October 2021. [Online]. Available: [Accessed 28 October 2021].

A. Priya, S. Garg, and N. P. Tigga, Predicting Anxiety, Depression and Stress in Modern Life using Machine Learning Algorithms, in Procedia Computer Science, 2020, vol. 167, pp. 12581267. doi: 10.1016/j.procs.2020.03.442.

A. H. Orabi, P. Buddhitha, M. H. Orabi, and D. Inkpen, Deep Learning for Depression Detection of Twitter Users, 2018.

Y. Zhang, H. Lyu, Y. Liu, X. Zhang, Y. Wang, and J. Luo, Monitoring Depression Trend on Twitter during the COVID-19 Pandemic, Jul. 2020, [Online]. Available:

X. Wang et al., Depression risk prediction for chinese microblogs via deep-learning methods: Content analysis, JMIR Medical Informat-ics, vol. 8, no. 7, Jul. 2020, doi: 10.2196/17958.

Y. Wang, J. Zheng, Q. Li, C. Wang, H. Zhang, and J. Gong, Xlnet-caps: Personality classification from textual posts, Electron., vol. 10, no. 11, pp. 116, 2021, doi: 10.3390/electronics10111360.

A. Alshahrani, M. Ghaffari, K. Amirizirtol, and X. Liu, Identifying Optimism and Pessimism in Twitter Messages Using XLNet and Deep Consensus, Proc. Int. Jt. Conf. Neural Networks, 2020, doi: 10.1109/IJCNN48605.2020.9206948.

N. Bilgel and N. Bayram, Depresyon anksiyete stres leginin (DASS-42) Trkeye uyarlanmis seklinin psikometrik zellikleri, Norop-sikiyatri Arsivi, vol. 47, no. 2, pp. 118126, 2010, doi: 10.4274/npa.5344

N. Syafitri, Y. Arta, A. Siswanto, and S. P. Rizki, Expert System to Detect Early Depression in Adolescents using DASS 42, Oct. 2020, pp. 211218. doi: 10.5220/0009158202110218.

M. M. Antony, B. J. Cox, M. W. Enns, P. J. Bieling, and R. P. Swinson, Psychometric properties of the 42-item and 21-item versions of the Depression Anxiety Stress Scales in clinical groups and a community sample, Psychol. Assess., vol. 10, no. 2, pp. 176181, 1998, doi: 10.1037/1040-3590.10.2.176.

A. W. Pradana and M. Hayaty, The Effect of Stemming and Removal of Stopwords on the Accuracy of Sentiment Analysis on Indonesian-language Texts, Kinet. Game Technol. Inf. Syst. Comput. Network, Comput. Electron. Control, vol. 4, no. 3, pp. 375380, 2019, doi: 10.22219/kinetik.v4i4.912.

G. Singh, B. Kumar, L. Gaur, and A. Tyagi, Comparison between Multinomial and Bernoulli Nave Bayes for Text Classification, 2019 Int. Conf. Autom. Comput. Technol. Manag. ICACTM 2019, pp. 593596, 2019, doi: 10.1109/ICACTM.2019.8776800.

Z. Yang, Z. Dai, Y. Yang, J. Carbonell, R. Salakhutdinov, and Q. v. Le, XLNet: Generalized Autoregressive Pretraining for Language Understanding, Jun. 2019, [Online]. Available:

X. Deng, Q. Liu, Y. Deng, and S. Mahadevan, An improved method to construct basic probability assignment based on the confusion matrix for classification problem, Information Sciences, vol. 340341, pp. 250261, May 2016, doi: 10.1016/j.ins.2016.01.033.

S. Wagner, Association for Computing Machinery, and ACM Digital Library., PROMISE?: 8th International Conference on Predictive Models in Software Engineering?: Lund, Sweden, Sept 21-22, 2012?: co-located with ESEM 2012.

R. Mohammed, J. Rawashdeh, and M. Abdullah, Machine Learning with Oversampling and Undersampling Techniques: Overview Study and Experimental Results, 2020 11th Int. Conf. Inf. Commun. Syst. ICICS 2020, no. May, pp. 243248, 2020, doi: 10.1109/ICICS49469.2020.239556.

I. Kandel and M. Castelli, The effect of batch size on the generalizability of the convolutional neural networks on a histopathology dataset, ICT Express, vol. 6, no. 4, pp. 312315, 2020, doi: 10.1016/j.icte.2020.04.010.