Automatic Detection of Depression in Social Media Posts Using Machine Learning Models and Transformer Architecture
摘要
Early detection of depression is a critical challenge for public health systems worldwide. With the exponential growth of social media posts, new opportunities have emerged to identify signs of mental disorders through automated text analysis. This paper presents a comparative approach for detecting depression in Reddit posts, evaluating machine learning models, deep learning models, and transformer-based architectures. The methodology included classical models (Logistic Regression, SVM, Random Forest, and MLP) combined with TF-IDF and fastText representations. In addition, LSTM and transformer-based architectures (BERT, DistilBERT, and RoBERTa) were assessed. Results show that transformer-based models consistently outperform traditional approaches, with RoBERTa achieving the best performance (F1 = 98.52%, AUC ≈ 1.000). Among classical models, SVM with TF-IDF reached an F1-score of 95.03%, while LSTM obtained 92.98% with fastText. These findings highlight the value of a systematic comparison that establishes a strong baseline for future adaptations, particularly in Spanish-language contexts, and reinforce the feasibility of integrating modern AI tools into systems for early depression detection in digital environments.