Detecting Depression in T hai Blog Posts: a Dataset and a Baseline (2021)

Abstract: We present the first openly available corpus for detecting depression in Thai. Our corpus is compiled by expert verified cases of depression in several online blogs. We experiment with two different LSTM based models and two different BERT based models. We achieve a 77.53% accuracy with a Thai BERT model in detecting depression. This establishes a good baseline for future researcher on the same corpus. Furthermore, we identify a need for Thai embeddings that have been trained on a more varied corpus than Wikipedia. Our corpus, code and trained models have been released openly on Zenodo.

## introduction depression is a significant public-health problem and one of the leading causes of disease burden worldwide. in 2010, depression was ranked as the sixth leading causes of disabilityadjusted life years in south-east asia @xcite . globally, more than 264 million people were affected @xcite . depression affects 86 million people in south-east asia region. at its most severe, depression can lead to suicide, which is the second highest cause of death among 15-29 years old in the region @xcite . depression is a growing problem in thailand as the country has a globally high depression rate reaching to 1.7 million people (see @xcite . at the same time, people dealing with depression struggle to find help (see @xcite , or worse yet, they might receive insufficient treatment @xcite . a worst-case scenario, depression can lead to suicide. depression is one of the leading causes of suicide in thai adolescents @xcite . in 2019, suicide rate of thai people aged between 20-29 was 667 persons and aged between 30-39 was 959 persons which was the highest numbers of all aged groups 1 . while thai is not what we would call lowresourced (see @xcite , there are currently no datasets available for detecting depression in the thai language. we present a new dataset based on blog posts and verified cases of depressed bloggers. furthermore, we establish a baseline for further research on the topic in the thai language. we have published the dataset, code and models presented in this paper openly on zenodo 2 . ## related work in this section we present some of the recent related work in more detail. while there have been several digital humanities driven research efforts in better understanding depression in text @xcite @xcite , we only focus on work that has been conducted on depression detection. there are also several approaches to depression detection in other languages @xcite @xcite ). an onset of major depression can be characterized and detected by investigating social media data such as twitter @xcite . by exploring a large corpus of twitter posting by using crowd-sourcing methodology. an svm classifier was built by divesting a variety of social media measures such as social activity, egonetwork, style, user engagement, emotion, and language. the classifier model predicted with high accuracy (70% and 73 % respectively) predicting ahead of the reported onset of depression and whether or not a post on twitter could be depressiveindicative postings. depression levels is detected by a proposed social media depression index. computerized analysis of various kind of texts related to depression reveals signals of psychiatric disorders. depression is measured by self-reported symptoms @xcite , by clinical interview @xcite . the scrambled sentences test (sst) @xcite was used to measure of cognitive processing bias of a large sample of college students. negative cognitive processing biases in resolving ambiguous verbal information can predict depression and subsequent depression symptoms. depression has been detected automatically before in thai facebook users @xcite . the authors train several models on rapidminer. the models rely on metadata for activity on facebook such as the number of posts posted on a given week day, the number of day-time and night-time posts and the number of shared posts. the authors did not train the models on text, but rather used numerical features extracted from facebook posts such as the number of first person pronouns and number of positive words. a screening text-based classification model was also applied to thai facebook posts to detect depressive disorder @xcite . similarly to the previous approach, the authors apply several traditional machine learning techniques to thai social media text with pre-extracted features. kumnunt and sornil, 2020 present a cnn (convolutional neural network) based approach to depression detection in thai social media posts. the authors crawl posts tagged with a depression hashtag to build their dataset. contrary to any of the current work on thai depression detection, our approach does not deal with social media posts but lengthier blog posts. we also make our dataset available unlike the existing work. ## data our data was taken from blogs or weblogs. as defined by @xcite , blogs are personal, highly opinionated logs, available publicly, with a subjective writing style, and the use of non-content features such as emotions. blogs can be used as data sources to predict the most likely state of mind with which the post was written: whether the blogger was depressed, cheerful or bored. blogs prompt many bloggers to indicate their mood at the time of posting @xcite . we have obtained post data from two main platforms: the weblog entitled "storylog" and personal blogs posted via two blog platforms "bloggang.com" and "blogspot.com". storylog is a social writing platform in thai language. it was launched in 2014 ( https://storylog.co ). its philosophy is "everyone has something to tell." stories shared on it are text-based articles about life experiences, opinions, ideas, as well as inspirations. posts are organized by the bloggers' areas of interest experience, emotion, inspiration, and short story. towards the other end of communication, blog readers can comment on the given post. we use these platforms to collect a corpus of posts that are written by depressed individuals. only posts, not user comments, are analyzed in this study. criteria for data collection included: through manual analysis and verification, we reach to 400 depressed posts published on storylog between 2015-2019, and 72 personal blogs posts published during the same time period. in total, our corpus contains 472 verified depressed blog posts. to make the corpus viable for machine learning, we further crawl an additional 472 blog posts that do not exhibit depression from the storylog platform. in total, our dataset has 472 depressed and 472 non-depressed blog posts. we shuffle the data on a sentence level and split it to 75% training, 10 % validation and 15 % testing. the splits are shared across all the models. we do these tokenizations by using pythainlp @xcite . ## detecting depression in this section, we describe the four different models we use to automatically detect depression in our dataset. following @xcite , two of the models are based on lstm (long short-term memory) models and two on transfer learning on pretrained bert models @xcite . we train our first model using a bidirectional lstm based model @xcite using opennmt @xcite with the default settings except for the encoder where we use a brnn (bidirectional recurrent neural network) (schuster and paliwal, 1997) instead of the default rnn (recurrent neural network). we use the default of two layers for both the encoder and the decoder and the default attention model, which is the general global attention presented by @xcite . the model is trained for the default 100,000 steps. the model is trained with tokenized sentences as its source and the depression label as its target. we train an additional lstm model with the same configuration and the same random seed (3435) with the only difference being that we use pretrained word2vec embeddings for the encoder. we use the thai2vec embeddings provided as a part of pythainlp foot_0 . the vector size is 300 and the model has been trained on thai wikipedia. in addition, we train two different bert based sequence classification models based on the thai bert model foot_1 and multilingual bert @xcite , which has been trained on multiple languages, thai being one of the latest additions to the cased model. we use the transformers package @xcite to conduct the fine tuning with our dataset. the models are fine tuned to predict the depression label from a tokenized sentence. for the multilingual bert model, we use the same tokenization as for the other models, but for the thai bert model, we run the model's own tokenizier on an untokenized input. as hyperparameters for the fine tuning, we use 3 epochs with 500 warm-up steps for the learning rate scheduler and 0.01 as the strength of the weight decay. this setup takes into account the current state of the art at the field, and uses recently created resources such as thai bert model, with our own custom made dataset. everything is set up in an easily replicable manner, which ensures that our experiments and results can be used in further work on this important topic. ## results in this section, we show and discuss the results obtained with our 4 different models: 2 lstm based models and 2 bert based ones. the results of the models can be seen in ## discussion and conclusions in this paper, we have presented a new expert curated dataset for depression detection in thai blog posts. our sentence level results are promising and we are sure we can use our models to snowball more depressed blog posts from platforms such as storylog for further linguistic analysis as a part of our interdisciplinary research project. based on our results, we can identify one easy future direction for enhancing the results obtained by our models. currently, all freely available pretrained thai embbeddings have been trained on wikipedia. this is not optimal for several reasons, one being the encyclopedic genre of wikipedia, the other being the fact that while wikipedia is written in formal "correct" thai, blog posts are written in a more colloquial language variety. this means that the vocabulary coverage of wikipedia data is poor when compared to blog posts. our blog corpus consists of 21,002 unique tokens while the word2vec model trained on wikipedia has embeddings for 51,358 words. the blog corpus (training, testing and validation combined) contains 6,488 words that are not present in the word2vec model, this means that around 31% of the words present in our blog depression corpus are simply not in a wikipedia based model. in the future, it is clear that thai language calls for openly available models that are trained on a larger and more varied internet corpus than solely on wikipedia.