Skip to content
Open access

Detecting Stress in Social Media Posts: A Comparative Study of Machine Learning Algorithms and GPT-Based Classification

2026 · International journal for advanced research in science & technology · 0 citations

Abstract

Social media platforms have become a rich source of information about users’ mental well-being, including stress. This study compares a fine-tuned GPT-2 classifier with four traditional machine learning (ML) algorithms—Naïve Bayes, Decision Tree, Logistic Regression and Random Forest—for detecting stress in tweets. The experiments used the mental-health-stress Twitter dataset from Kaggle, which contains 20,001 labeled posts. After pre-processing, the posts were classified as stressed or not stressed, and all models were evaluated using accuracy, precision, recall and F1-score. The GPT-2 classifier achieved the highest accuracy (88.7%) and an F1-score of 0.89, compared with 70–78% accuracy for the traditional algorithms. These results indicate that transformer-based language models capture the contextual cues of stress in short, informal text more effectively than frequency-based classifiers. Such models could support scalable, non-invasive screening tools for mental-health monitoring, although the study is limited by its single dataset, undocumented labelling procedure and single train–test split.

Read PDF

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.