Preprints.org
Distilled Bidirectional Encoder Representations from Transformers (DistilBERT) for Multi-Class Mental Health Detection fromWeb-Scraped Reddit Posts
Par Mildort W et Amuda K.
Contenu en anglais
Résumé
The increasing availability of social media data has created new opportunities for using artificial intelligence (AI) to study and support mental health awareness. This paper presents an offline machine learning framework that leverages natural language processing (NLP) to classify Reddit posts into distinct mental health categories based on linguistic patterns. The dataset was collected using the PRAW API from 26 subreddits on mental health, addiction, and control topics, yielding approximately 80,000 anonymized text samples. A pre-trained DistilBERT-base-uncased transformer model was fine-tuned for multi-class classification across eleven diagnostic categories, including anxiety, depression, stress, and addiction disorders. Texts were preprocessed through normalization, keyword filtering, and category mapping. Model training employed a weighted cross-entropy loss to mitigate class imbalance, with optimization performed using the AdamW algorithm in a fully offline Jupyter Notebook environment. The model achieved an overall accuracy of 77%, a macro-averaged F1 Score of 0.736, and a weighted F1 Score of 0.772. These results indicate that transformer-based NLP models can reliably distinguish between multiple forms of mental health discourse, demonstrating their potential as supportive tools for early detection or population-level analysis. The study underscores the importance of ethical data handling, transparency, and responsible AI design when applying language models to sensitive domains such as mental health.



