Psychological Stress Detection Using Transformer-Based Models

Authors

  • Derwin Suhartono Bina Nusantara University
  • Irfan Fahmi Saputra Bina Nusantara University
  • Andhika Rizki Pratama Bina Nusantara University
  • Gabriel Nathaniel Bina Nusantara University

DOI:

https://doi.org/10.21512/comtech.v15i1.11105

Keywords:

stress detection, transformer-based model, Bidirectional Encoder Representations from Transformers (BERT), Robustly Optimized BERT (RoBERTa)

Abstract

Stress is a significant mental health problem that results in a lack of concentration. It has been more widely identified through social media since people who are under stress usually post about their physical pain and tiredness. However, stress assessment through social media by professionals can be expensive and time-consuming. The research aimed to produce a stress detection system trained using a Twitter dataset to predict stress using the user’s input sentence. The experiments that were done in the research used transformer-based models such as Bidirectional Encoder Representations from Transformers (BERT) and Robustly Optimized BERT (RoBERTa). The research involved data pre-processing, model training, and model evaluation to ensure high-quality train data. Since the data were imbalanced, data trimming was performed in pre-processing to select data randomly until the balance matched. This process ensured the model’s effectiveness in the training and evaluation stages. The features used in these experiments were features from each pre-trained model. In evaluating the model, accuracy, loss, and F1 score were used as metrics. In the result, for BERT, accuracy reaches 0.848 with an F1 score of 0.847. Meanwhile, RoBERTa has an accuracy of 0.837 and 0.834. The results prove that BERT and RoBERTa can be used to classify stress with accuracy and an F1 score above 0.8. The experiment result shows that the BERT deep learning model can detect stress using the Twitter datasets.

Dimensions

Plum Analytics

Author Biographies

Derwin Suhartono, Bina Nusantara University

Computer Science Department, School of Computer Science

Irfan Fahmi Saputra, Bina Nusantara University

Computer Science Department, School of Computer Science

Andhika Rizki Pratama, Bina Nusantara University

Computer Science Department, School of Computer Science

Gabriel Nathaniel, Bina Nusantara University

Computer Science Department, School of Computer Science

References

Aalbers, G., McNally, R. J., Heeren, A., De Wit, S., & Fried, E. I. (2019). Social media and depression symptoms: A network perspective. Journal of Experimental Psychology: General, 148(8), 1454–1462. https://doi.org/10.1037/xge0000528

Areshey, A., & Mathkour, H. (2023). Transfer learning for sentiment classification using Bidirectional Encoder Representations from Transformers (BERT) model. Sensors, 23(11), 1–18. https://doi.org/10.3390/s23115232

American Psychological Association. (2020, October). Stress in America 2020: A national mental health crisis. https://www.apa.org/news/press/releases/stress/2020/report-october

Bhimani, H., Mention, A. L., & Barlatier, P. J. (2019). Social media and innovation: A systematic literature review and future research directions. Technological Forecasting and Social Change, 144, 251–269. https://doi.org/10.1016/j.techfore.2018.10.007

Birjali, M., Kasri, M., & Beni-Hssane, A. (2021). A comprehensive survey on sentiment analysis: Approaches, challenges and trends. Knowledge-Based Systems, 226. https://doi.org/10.1016/j.knosys.2021.107134

García, V., Sánchez, J. S., Marqués, A. I., Florencia, R., & Rivera, G. (2020). Understanding the apparent superiority of over-sampling through an analysis of local information for class-imbalanced data. Expert Systems with Applications, 158. https://doi.org/10.1016/j.eswa.2019.113026

Gedam, S., & Paul, S. (2021). A review on mental stress detection using wearable sensors and machine learning techniques. IEEE Access, 9, 84045–84066. https://doi.org/10.1109/ACCESS.2021.3085502

Guntuku, S. C., Buffone, A., Jaidka, K., Eichstaedt, J. C., & Ungar, L. H. (2019). Understanding and measuring psychological stress using social media. In Proceedings of the International AAAI Conference on Web and Social Media (Vol. 13, pp. 214–225). https://doi.org/10.1609/icwsm.v13i01.3223

Hampton, K. N., Rainie, L., Lu, W., Dwyer, M., Shin, I., & Purcell, K. (2014, August 26). Social media and the spiral of silence. PewResearchCenter. https://www.pewresearch.org/internet/2014/08/26/social-media-and-the-spiral-of-silence/

Hasan, M. R., Maliha, M., & Arifuzzaman, M. (2019). Sentiment analysis with NLP on Twitter data. In 2019 International Conference on Computer, Communication, Chemical, Materials and Electronic Engineering (IC4ME2) (pp. 1–4). IEEE. https://doi.org/https://doi.org/10.1109/IC4ME247184.2019.9036670

Hawk, S. T., Van Den Eijnden, R. J., Van Lissa, C. J., & Ter Bogt, T. F. (2019). Narcissistic adolescents' attention-seeking following social rejection: Links with social media disclosure, problematic social media use, and smartphone stress. Computers in Human Behavior, 92, 65–75. https://doi.org/10.1016/j.chb.2018.10.032

Inamdar, S., Chapekar, R., Gite, S., & Pradhan, B. (2023). Machine learning driven mental stress detection on Reddit posts using natural language processing. Human-Centric Intelligent Systems, 3(2), 80–91. https://doi.org/10.1007/s44230-023-00020-8

Joshy, A., & Sundar, S. (2022). Analyzing the performance of sentiment analysis using BERT, DistilBERT, and RoBERTa. In 2022 IEEE International Power and Renewable Energy Conference (IPRECON) (pp. 1–6). IEEE. https://doi.org/10.1109/IPRECON55716.2022.10059542

Maslej-Krešňáková, V., Sarnovský, M., Butka, P., & Machová, K. (2020). Comparison of deep learning models and various text pre-processing techniques for the toxic comments classification. Applied Sciences, 10(23), 1–26. https://doi.org/10.3390/app10238631

Oryngozha, N., Shamoi, P., & Igali, A. (2024). Detection and analysis of stress-related posts in Reddit’s acamedic communities. IEEE Access, 12, 14932–14948. https://doi.org/10.1109/ACCESS.2024.3357662

Rastogi, A., Liu, Q., & Cambria, E. (2022). Stress detection from social media articles: New dataset benchmark and analytical study. In 2022 International Joint Conference on Neural Networks (IJCNN) (pp. 1–8). IEEE. https://doi.org/10.1109/IJCNN55064.2022.9892889

Ríssola, E. A., Losada, D. E., & Crestani, F. (2021). A survey of computational methods for online mental state assessment on social media. ACM Transactions on Computing for Healthcare, 2(2), 1–31. https://doi.org/10.1145/3437259

Samele, C., Lees-Manning, H., Zamperoni, V., Goldie, I., Thorpe, L., Wooster, E., ... & Rowland, M. (2018). Stress: Are we coping. Mental Health Foundation.

Wang, W., Chen, L., Thirunarayan, K., & Sheth, A. P. (2012). Harnessing Twitter “big data” for automatic emotion identification. In 2012 International Conference on Privacy, Security, Risk and Trust and 2012 International Confernece on Social Computing (pp. 587–592). IEEE. https://doi.org/10.1109/SocialCom-PASSAT.2012.119

Winata, G. I., Kampman, O. P., & Fung, P. (2018). Attention-based LSTM for psychological stress detection from spoken language using distant supervision. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP) (pp. 6204–6208). IEEE. https://doi.org/10.1109/ICASSP.2018.8461990

Yogish, D., Manjunath, T. N., & Hegadi, R. S. (2019). Review on natural language processing trends and techniques using NLTK. In Recent Trends in Image Processing and Pattern Recognition: Second International Conference, RTIP2R 2018 (pp. 589-606). Springer Singapore. https://doi.org/10.1007/978-981-13-9187-3_53

Downloads

Published

2024-06-22

Issue

Section

Articles
Abstract 296  .
PDF downloaded 243  .