QBERT-LSTM: Quantum Intelligence-Based Mental Health Sentiment Analysis Using Web Scraping
Abstract
Social media has become a significant resource for evaluating public attitudes regarding mental health, as individuals may express their thoughts through postings, comments, and conversations. Sentiment analysis is a promising method for studying emotional patterns expressed in mental-health-related text. Traditional machine learning for sentiment analysis faces challenges like transparency, scarce labeled data, and language limitations. This paper presents a sentiment classification (positive, negative, neutral) framework applied to mental-health-related Reddit posts. Repeated emotional patterns can offer helpful insights into sentiment trends in mental health discussions, but they shouldn’t be seen as proof of clinical disorders. In this paper, we propose a hybrid framework for sentiment classification from text, termed QBERT-LSTM, which integrates quantum-enhanced bidirectional encoder representations from transformers (QBERT) with long short-term memory (LSTM) networks. In the proposed approach, transformer models excel at capturing global context, while the LSTM enhances sequential patterns and temporal features. The quantum component uses a parameterized circuit with angle encoding and variational gates to perform nonlinear transformations on a quantum simulator (PennyLane). Subsequently, the model is tested on more intricate circuits comprising 2, 4, 6, 8, 10, and 12 qubits to assess its consistency. A novel Reddit dataset of mental health-related subreddits (anxiety, panic attacks, and depression) is constructed, with sentiment labels derived from the VADER sentiment analyzer. We thoroughly assessed the performance of our proposed model against deep learning models and cutting-edge transformer architectures, achieving up to 98% accuracy in the best-performing configuration on the generated dataset (mean accuracy $0.97~\pm ~0.0059$ across five random seeds).