Sentiment Analysis of Mental Health Using Support Vector Machine (SVM) with FastAPI Implementation

Authors

  • Maulyanda Maulyanda Universitas Syiah Kuala, Indonesia
  • Sri Azizah Nazhifah Universitas Syiah Kuala

DOI:

https://doi.org/10.47709/brilliance.v5i1.6580

Keywords:

Support Vector Machine, Sentiment Analysis, Mental Health, FastAPI

Abstract

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.

References

Abdusyukur, F. (2023). Penerapan Algoritma Support Vector Machine (Svm) Untuk Klasifikasi Pencemaran Nama Baik Di Media Sosial Twitter. Komputa: Jurnal Ilmiah Komputer Dan Informatika, 12(1), 73–82.

Albab, M. U., Fawaiq, M. N., & others. (2023). Optimization of the Stemming Technique on Text preprocessing President 3 Periods Topic. Jurnal Transformatika, 20(2), 1–12.

Alexandridis, G., Varlamis, I., Korovesis, K., Caridakis, G., & Tsantilas, P. (2021). A survey on sentiment analysis and opinion mining in greek social media. Information, 12(8), 331.

Ardiani, L., Sujaini, H., & Tursina, T. (2020). Implementasi sentiment analysis tanggapan masyarakat terhadap pembangunan di Kota Pontianak. JUSTIN (Jurnal Sistem Dan Teknologi Informasi), 8(2), 183–190.

Azhari, R. Y. (2022). Web Service Framework: flask dan fastAPI. Technology and Informatics Insight Journal, 1(1), 80–87.

Darman, R. (2023). Analisis Sentimen Respons Twitter terhadap Persyaratan Badan Penyelenggara Jaminan Sosial (BPJS) di Kantor Pertanahan. Widya Bhumi, 3(2), 113–136.

Gaye, B., Zhang, D., & Wulamu, A. (2021). Improvement of support vector machine algorithm in big data background. Mathematical Problems in Engineering, 2021(1), 5594899.

Kanna, P. R., & Pandiaraja, P. (2019). An efficient sentiment analysis approach for product review using turney algorithm. Procedia Computer Science, 165, 356–362.

Pavlova, A., & Berkers, P. (2022). “Mental health” as defined by Twitter: Frames, emotions, stigma. Health Communication, 37(5), 637–647.

Rahanto, F. F., & Kharisudin, I. (2021). Analisis sentimen data ulasan menggunakan metode naive bayes studi kasus the Wujil Resort & Conventions pada situs tripadvisor. Unnes Journal of Mathematics, 55–62.

Rozali, Y. A., Sitasari, N. W., Lenggogeni, A., Psikologi, F., Esa, U., Arjuna, J., … Kebon, T. (2021). Meningkatkan kesehatan mental di masa pandemic. Jurnal Pengabdian Masyarakat AbdiMas, 7(2), 109–113.

Sarkar, S. (2025). Sentiment Analysis for Mental Health.

Supini, P., Gandakusumah, A. R. P., Asyifa, N., Auliya, Z. N., & Ismail, D. R. (2024). Faktor-faktor yang mempengaruhi kesehatan mental pada remaja. Journal of Education Religion Humanities and Multidiciplinary, 2(1), 166–172.

Suryotomo, A. P., Akbar, B. M., & Husaini, R. (2024). Performance Analysis of FastAPI Framework on Lost Circulation Handling Management Application in Oil Well Drilling. Telematika: Jurnal Informatika Dan Teknologi Informasi, 21(1), 110–121.

Tadesse, M. M., Lin, H., Xu, B., & Yang, L. (2019). Detection of depression-related posts in reddit social media forum. Ieee Access, 7, 44883–44893.

Downloads

Published

2025-07-24

How to Cite

Maulyanda, M., & Sri Azizah Nazhifah. (2025). Sentiment Analysis of Mental Health Using Support Vector Machine (SVM) with FastAPI Implementation. Brilliance: Research of Artificial Intelligence, 5(1), 568–575. https://doi.org/10.47709/brilliance.v5i1.6580

Similar Articles

1 2 3 4 5 6 7 8 9 10 > >> 

You may also start an advanced similarity search for this article.