Mental health is an increasingly critical issue, especially among cancer patients who often experience emotional distress due to diagnosis and treatment processes. In the digital era, social media platforms such as Twitter can be utilized as a non-invasive data source to detect symptoms of mental health disorders. This study aims to develop an automated classification system using deep learning models, particularly Long Short-Term Memory (LSTM) and Bidirectional LSTM (Bi-LSTM), to identify mental health conditions such as depression, stress, and anxiety from social media texts. Data were collected from a public dataset on Kaggle and from scraped tweets of users who self-identified as cancer patients. The data underwent several preprocessing steps, including text cleaning, tokenization, and transformation into numerical vectors using Word2Vec. The models were trained and tested using Random Over Sampling for data balancing, and attention mechanisms were also applied.
Experimental results show that the LSTM model with Attention achieved the highest accuracy of 96%, along with high precision, recall, and F1-scores across all classes (Normal, Depression, Stress, and Anxiety). The Bi-LSTM and LSTM without attention models achieved accuracy 94% for Bi-LSTM and 93% for LSTM. These findings indicate that the integration of LSTM enhanced with attention is effective in detecting mental health issues in cancer patients through social media text analysis.
Keywords: LSTM, Bi-LSTM, Attention, Mental Health, Cancer Patients, Social Media