BERT-Based Depressive Sentiment Analysis and Explainability for Chinese Texts

Han YuApplied and Computational Engineering 2025

Abstract

The extensive application of NLP technologies has greatly increased in recent years, for instance, in translation, text classification, and text generation. With the advancement of technology, models have become more complex, which raises the difficulty of model explanation. The paper explores sentiment analysis classification for identifying depressive text using the BERT model and demonstrates the explanation of model outputs through explainable artificial intelligence (XAI) technology. The pre-trained BERT model was fine-tuned by using a Chinese text dataset, which consists of Chinese texts with depression labels obtained from social media like Weibo, REDnote, and Twitter. The paper reveals that the deep learning model, leveraging contextual information and interpretability techniques, effectively analyzes depressive sentiment, and has endowed the model with certain interpretability.

Introduction

Depression affects approximately 3.8% of the global population, and social media has become a primary outlet for individuals to express their mental states. While Natural Language Processing (NLP) offers a way to automate the detection of depressive tendencies, two major hurdles remain:

  1. Linguistic Complexity: Chinese social media is rife with slang, homophones, and polysemous words that traditional machine learning models (like Naive Bayes or Random Forests) struggle to interpret accurately.
  2. The Black-Box Effect: Deep learning models like BERT are highly accurate but notoriously opaque. In sensitive fields like mental health, clinicians and users need to understand why a model flagged a specific text to establish trust and ensure transparency.

Methodology

The research employs a two-pronged technical approach combining state-of-the-art transformer models with explainability frameworks.

Model Architecture and Training

The core of the system is the BERT-base-Chinese model (12 layers, 1024 hidden dimensions). Unlike older unidirectional models, BERT’s bidirectional training allows it to understand the context of a word based on its surrounding text. The model was fine-tuned for 5 epochs with a low learning rate to optimize performance while preventing overfitting.

Explainability with SHAP

To address the black-box nature of the transformer, the author integrated SHAP (SHapley Additive exPlanations). Based on cooperative game theory, SHAP assigns an "importance value" to each feature (each word). Specifically, Kernel SHAP was utilized to provide local explanations, highlighting which specific tokens contributed most to a "depressive" classification for individual samples.

Dataset

The study utilized a dataset from the Kaggle data repository, consisting of approximately 10,000 Chinese reviews and posts scraped from Weibo, REDnote (Xiaohongshu), and Twitter. The original five-level depression scale (0–4) was simplified into a binary classification task: Level 0 (non-depression) versus Levels 1–4 (depression).

Results and Discussion

The fine-tuned BERT model achieved high performance across all standard evaluation metrics, demonstrating the effectiveness of the transformer architecture for this domain.

Performance metrics of the fine-tuned BERT model for depressive sentiment classification.

Contextual Superiority and Explainability

The results highlight that BERT’s self-attention mechanism is significantly more effective at capturing the emotional depth of Chinese social media than traditional feature engineering methods like TF-IDF. By applying SHAP, the research confirmed that the model identifies psychologically relevant markers. Words such as "restlessness" (不安), "loneliness" (孤独), and "gloom" (忧郁) were statistically shown to have the highest probability of triggering a depressive classification. This integration of XAI is presented as a requirement for deploying AI in mental health contexts where "human-in-the-loop" verification is essential.

Conclusion

While the model shows promise, several limitations remain. The dataset imbalance (2:1 ratio) may bias the model, and BERT's 512-token limit restricts the analysis of long-form content. Furthermore, the computational cost of SHAP remains high for real-time applications. Future work will focus on multimodal monitoring—combining text with images or video—and developing cross-platform systems to track emotional shifts over time.

Summary updated

BibTeX
@inproceedings{yu2025bert,
  author = {Han Yu},
  title = {{BERT-Based Depressive Sentiment Analysis and Explainability for Chinese Texts}},
  booktitle = {Applied and Computational Engineering},
  year = {2025},
  doi = {10.54254/2755-2721/2025.bj25787},
}
Figure