Understanding linguistic patterns of depression and anxiety in Indonesian social media text using machine learning classification and topic modeling - Dita Pramesti; Hilda Nuraliza (Institut Teknologi Sepuluh Nopember, 2026)
The increasing prevalence of mental health disorders such as depression and anxiety calls for effective approaches to analyze psychological expressions in textual data. This study explores the linguistic markers of depression and anxiety in Indonesian social media text through an integrated model of machine learning classification and topic modeling. In contrast to earlier work primarily centered on classification performance, this work emphasizes interpretability through comparative machine learning analysis and LDA-based thematic analysis. Classification determines the expressed condition, LDA determines thematic structures that account for distinguishing patterns beyond accuracy metrics alone. The dataset consisted of 17,096 records collected from Facebook groups, reduced to 7,199 instances after removing neutral labels. TF-IDF-based feature extraction was applied using unigram and bigram representations with a maximum of 5,000 features. A comparative analysis was conducted using six classification algorithms: K-Nearest Neighbor (KNN), Support Vector Machine (SVM), Random Forest, Decision Tree, XGBoost, and Naïve Bayes, evaluated under three train-test split scenarios (70:30, 80:20, and 90:10). SMOTE was applied to the training data to address class imbalance. SVM achieved the best performance with an F1-score of 0.903 under an 80:20 split, followed by Naïve Bayes and XGBoost, while KNN performed lowest consistently. LDA topic modeling revealed that depression-related texts were dominated by internal emotional expression, social isolation, and suicidal ideation, whereas anxiety-related texts were characterized by sudden fear, somatic physical symptoms, and social anxiety. These findings suggest that combining classification with topic modeling offers a practical foundation for developing early detection tools and Indonesian-language NLP resources for mental health discourse analysis.