Sentiment Analysis of Mental Health Using Support Vector Machine (SVM) with FastAPI Implementation - Maulyanda Maulyanda; Sri Azizah Nazhifah (Brilliance: Research of Artificial Intelligence, 2025)
Mental health is a vital aspect that contributes significantly to an individual’s productivity, daily activity, and overall quality of life. With the increasing prevalence of mental health issues, early detection and analysis are essential. This study aims to identify mental health conditions using a machine learning approach, specifically the Support Vector Machine (SVM) algorithm. The dataset used consists of 53,043 text-based statements that are classified into seven distinct categories of mental conditions: normal, depression, suicide, anxiety, bipolar, stress, and personality disorders. The preprocessing steps applied to the dataset include text cleaning, tokenization, stopword removal, and lemmatization to standardize the textual input. Following this, 80% of the data is allocated for training the model, while the remaining 20% is reserved for testing purposes. The SVM algorithm is utilized to build a predictive model capable of classifying mental conditions based on text input. Furthermore, this model is deployed through an application interface using the FastAPI framework, enabling integration with digital platforms. The results indicate that the model achieves an accuracy of 79%, a recall of 77%, and an F1-score of 73%. These findings suggest that SVM is a capable and efficient method for analyzing and detecting various mental health conditions. This approach supports early intervention and offers practical implications for digital mental health screening tools.