Real-Time Mental Health Detection via Sentiment Analysis: An Ensemble Machine Learning Approach for Social Media Data
摘要
The increased occurrence of mental health challenges including anxiety, depression, and stress gives it a critical imperative to be detected and treated in good time. In this paper, the author suggests a sentiment analysis model on the fly, which uses social media data to identify mental health indicators based on ensemble machine learning. User-generated content is cleaned by using natural language processing (NLP) techniques such as tokenization, lemmatization, and noise removal. The Term Frequency-Inverse Document Frequency (TF-IDF) is used to extract features of text, and Synthetic Minority Over-sampling Technique (SMOTE) is used to deal with the issue of class imbalance. A variety of classifiers, i.e. the Bernoulli Naive Bayes, the Logistic Regression and the Random Forest, are trained and an ensemble Voting Classifier is followed to improve the performance. Random Forest had the highest accuracy (89.17%), whereas the ensemble model also had a strong performance with an accuracy of 87.15% and high precision and recall. Real-time inference is also created using a graphical user interface (GUI) and enables the personal classification of a text that has a connection with mental health. The system proposed proves the feasibility of integrating NLP and machine learning to detect signs of mental illness early on and has the potential of finding its way into the digital health monitoring platforms.