A machine learning approach for text pattern diagnosis in mental health consultations
Online health consultation services are crucial for mental health support, particularly in densely populated areas. However, the heavy reliance on human expertise often leads to delays, necessitating more efficient and automated solutions. This study developed a machine learning framework to automate doctor response patterns for mental health questions — focusing on anxiety, depression, and stress — using clinically validated data from an Indonesian Online health consultation platform. We performed comprehensive text preprocessing, including duplicate removal, special character elimination, case folding, stopword removal, tokenization, lemmatization, and part-of-speech tagging, and evaluated four feature extraction methods: Word2Vec, Bag-of-Words, N-Gram, and Global Vectors for Word Representation. Five machine learning algorithms — Naïve Bayes, K-Nearest Neighbors, Random Forest, Neural Network, and Gradient Boosting — were tested, along with hybrid models combining Bagging Classifier or Genetic Algorithm. The results showed that Gradient Boosting achieved the highest accuracy (0.842) among standalone models, with high precision (0.858) and F1-score (0.864) for depression prediction, and recall (0.850) and F1-score (0.856) for stress prediction. The Gradient Boosting-Bagging Classifier hybrid matched this accuracy (0.842), while the Gradient Boosting-Genetic Algorithm hybrid showed superior performance for anxiety prediction (precision: 0.888, recall: 0.816). N-Gram and Bag-of-Words methods and the 90:10 and 70:30 train–test splits consistently produced optimal results. This work demonstrates that machine learning can automate mental health responses at scale, with Gradient Boosting balancing accuracy and efficiency. Future research will explore transformer-based models and multilingual validation to improve broader implementation. • Develop a machine learning framework to classify mental health topics in doctor responses. • Evaluate feature extraction methods to optimize text pattern recognition. • Identify Gradient Boosting as the most effective standalone model. • Demonstrate that hybrid models enhance precision and recall for anxiety prediction. • Recommend advanced embeddings for improved contextual understanding in responses.
Authors
- Mauridhi Hery Purnomo (ORCID: https://orcid.org/0000-0002-6221-7382)
- Mohammad Syafrullah (ORCID: https://orcid.org/0000-0001-6683-4014)
- Wiwik Anggraeni (ORCID: https://orcid.org/0000-0003-3010-3062)
- Safitri Juanita (ORCID: https://orcid.org/0000-0002-7787-7623)
- Anisah Hasratniwati Daeli
Institutions
- Sepuluh Nopember Institute of Technology (ID)
- Universitas Budi Luhur (ID)
Publication Details
- Journal
- Decision Analytics Journal
- Published
- 2025-04-15
- DOI
- https://doi.org/10.1016/j.dajour.2025.100572
- Citations
- 4
- Primary Topic
- Mental Health via Writing
- Type
- article
- Field-Weighted Citation Impact
- 9.75