{'fraction_non_alphanumeric': 0.03152832950031361, 'fraction_numerical': 0.013213464352916579, 'mean_word_length': 4.924201139459995, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
SERCNN: Stacked Embedding Recurrent Convolutional Neural Network in Detecting Depression on Twitter

Conventional approaches to identify depression are not scalable, and the public has limited awareness of mental health, especially in developing countries. As evident by recent studies, social media has the potential to complement mental health screening on a greater scale. The vast amount of first-person narrative posts in chronological order can provide insights into one's thoughts, feelings, behavior, or mood for some time, enabling a better understanding of depression symptoms reflected in the online space. In this paper, we propose SERCNN, which improves the user representation by (1) stacking two pretrained embeddings from different domains and (2) reintroducing the embedding context to the MLP classifier. Our SERCNN shows great performance over state-of-the-art and other baselines, achieving 93.7% accuracy in a 5-fold cross-validation setting. Since not all users share the same level of online activity, we introduced the concept of a fixed observation window that quantifies the observation period in a predefined number of posts. With as minimal as 10 posts per user, SERCNN performed exceptionally well with an 87% accuracy, which is on par with the BERT model, while having 98% less in the number of parameters. Our findings open up a promising direction for detecting depression on social media with a smaller number of posts for inference, towards creating solutions for a cost-effective and timely intervention. We hope that our work can bring this research area closer to real-world adoption in existing clinical practice.


Introduction
Depression is a serious, yet common mental disorder that affects more than 264 million people worldwide. The number is projected to grow amid the war against the pandemic of COVID-19. Unlike the usual mood fluctuations and emotional responses, long-lasting sadness, emptiness, or irritation in one's day-to-day life is usually accompanied by somatic and cognitive changes that heavily disrupt an individual's functioning capacity. Hence, depression is often associated with suicide at its worst. In the latest Word Health Statistics 2021 [25], there is a 28% increase in the suicide rate in the United States in this period.
Often, people who suffer from depression tend to be unaware of their mental condition, as there is no specific feedback from the body, like common physical injuries do. Furthermore, existing depression screening approaches through self-reporting questionnaires and clinical interviews are expensive and not scalable. Currently, many countries, especially developing countries, are suffering from a shortage of provisions and services to identify, support, and treat mental health issues. Therefore, there is a dire need to promote mental health awareness and create technologies to help complement existing screening or diagnosis approaches to help reach a wider community. Patients are required to disclose truthful information during clinical interviews [1]. Until now, global provision and services to identify, support, and treat mental health problems are insufficient despite the disruption of essential health services, community mistrust, and fears of COVID-19 infections.
Meanwhile, social media has become part and parcel of everyday life. The availability of a large volume of data has motivated research to utilize social media data for depression detection. Social media data can serve as a life log that records user activities in text, image, audio, or video. In addition, the enormous amount of first-person narrative posts can provide insight into one's thoughts, behavior, or mood in the temporal dimension.
Previous studies have demonstrated the great potential of social media posts in detecting mental disorders, such as depression [4,11,16], anxiety [7,10], and eating disorders [26]. In existing depression diagnostics using DSM-5 [1], a 14-day observation period is required. However, using machine learning-based models, Hu et al. [12] and Tsugawa et al. [22] have suggested that two months of posting data are used to detect depression. Lately, Shen et al. [20] have constructed a depression dataset from users' one-month posting history. Shen et al. [20] and Gui et al. [8,9] have demonstrated that a single month of posting history is sufficient to classify depression online. However, there is still a lack of evidence on the number of posts required for efficient and cost-effective detection in the online space.
In this paper, we propose SERCNN -Stacked Embedding Recurrent Convolutional Neural Network, to perform early depression detection based on their one-month social media posts. Our SERCNN improves the overall user representations in two ways: (1) stacking representation vectors from pretrained embeddings from both the general and social media domains and (2) allowing the MLP classifier to exploit the context by co-learning the CNN context with the recurrence of the embedding context. We also trained SERCNN on different lengths of posting history measured in the number of posts (fixed observation windows) to offer a unique perspective on optimizing the amount of data required for early depression detection. We further assessed the robustness of the observation window by comparing the performance differences trained on the subsets extracted from the earliest (head) and latest (tail) of a user-posting history. Despite having a fraction of the BERT [5] classifier's size (in terms of the number of parameters), SERCNN is on par, if not better than our BERT baseline, confirming that depression can be identified even if we have only 10 posts for a given user. This discovery sheds light on the adoption of social media analytics to complement existing clinical screening practices without a substantial investment in computational resources.
The contributions of this paper can be summarized below: 1. We show that it is possible to improve the feature representation of social media text by stacking features from two low-dimensional pretrained embeddings. As a result, the number of feature dimensions is also reduced. 2. We propose the concept of a fixed observation window that quantifies the observation period in a predefined number of posts and provide insights into the potential for early depression detection using the observation window with SERCNN. 3. We highlight the performance and advantage of SERCNN over the fine-tuned BERT classifier in early depression detection for its fraction of BERT's size in terms of number of parameters.
The rest of the paper is organized as follows: Section 2 covers the related work in this domain and Section 3 describes the problem statement and motivation of this research. The dataset used in the experiments is elaborated in Section 4 and the proposed method is discussed in Section 5. In Section 6, we present the experiment settings and discuss the experimental results in Section 7. Finally, Section 8 summarizes the main findings of this work and some perspectives for future research.

Related Work
Various natural language processing (NLP) techniques have been applied to extract relevant features from social media data. Modeling feature representations is a crucial task in machine learning; features that are not discriminative will result in poor and faulty model performance. Hence, earlier research works are mainly focused on feature extraction techniques. Choudhury et al. [3] and Tsugawa et al. [22] have found that depressed users tend to be emotional. [23] have found that using sentiment analysis in depression detection can achieve about 80% accuracy. Resnik et al. [18] extracted topics distribution with Latent Dirichlet Allocation (LDA) [2] to differentiate depressed individuals from the healthy controls. Researchers have also extracted features based on the industry standard, the Diagnostic and Statistical Manual of Mental Disorders (DSM), such as the insomnia index derived from the user posting time [20]. Linguistic Inquiry and Word Count (LIWC) [21] is a widely used word matching-based feature extraction tool that builds on top of previous findings [6,19] discovered decades ago. Both Choudhury et al. [3] and [20] found that depressed users tend to have a high focus on self-attention, increased medical concerns, and increased expression of religious thoughts. These findings are consistent with previous work [19], in which depressive indicators are identifiable from human-generated content.
Furthermore, Shen et al. [20] have also attempted to identify sparse features of their multimodal handcrafted features with dictionary learning. Their studies have discovered that depressed users tend to post tweets at midnight, which could be a result of insomnia. Furthermore, depressed users tend to use emotional words and depression-related terms (antidepressants and symptoms) more often than the controls.
However, the aforementioned feature extraction approaches are often ineffective due to the nature of noisy and unstructured social media text. An extensive data cleaning and preprocessing are required for the feature extraction to work as intended. Recent advancements in deep learning have shown its robustness without needing manual annotation and label supervision. Word embedding approaches are introduced to learn disentangled representations by learning a mapping function that takes all the embeddings as input and outputs a compact representation of the words. Deep neural networks, such as the recurrent neural network (RNN) and convolutional neural network (CNN) [13], can further leverage and exploit these disentangled text representations to reach to state-ofthe-art performance. The learned representation can be used as a discriminative classifier for downstream tasks. With the policy gradient agent implemented alongside, authors in [8] have leveraged word embedding learned from the depression dataset and deep learning models (RNN and CNN) to achieve state-ofthe-art depression detection results. These works have shown that deep learning models can outperform shallow models in accuracy and sensitivity with minimal preprocessing effort.

Problem Statement and Motivation
Depression in developing countries has always been under-addressed. Many NGOs, local governments, and clinics in these countries do not have ample computing power resources to train and deploy a fully automated screening model that utilizes cutting-edge deep learning, such as BERT. Therefore, there is a dire need for a cost-effective, efficient, and robust early depression detection solution.

Depression Dataset
We train and evaluate our proposed method using the Shen Depression Dataset [20], D, which comprises two labeled user groups: (D 1 ) self-declared depressed users and (D 2 ) controls. We formed a balanced dataset by drawing 1,401 samples from D 1 and D 2 , resulting in 2,802 samples and 1.35 million posts made within a month to eliminate bias in our results which may be caused by an imbalanced dataset. On average, a depressed user tends to post lesser at 165 posts as compared to 799 posts for the control user. An overview of the dataset is presented in Table 1.
We have also performed a statistical analysis on the dataset to better understand how the majority of the users behave online in terms of the posting frequency, which is displayed in Table 2. We can observe that 75% of the users in the dataset have at least 34 posts (first quartile) and a midspread of more than 400 posts (interquartile range). The dataset also has users with only one post; the longest posting history is 11,127.

Background
Given that our dataset, D, consists of N 1 number of social media users u, where each user's N 2 number of social media posts, p, within a month were collected, and each post has N 3 words, w, we denote the dataset as D = {(u 1 , y 1 ), ..., (u N1 , y N1 )}, where y ∈ [0, 1] is the label in which 0 represents the control user and 1 for the depressed user. For a random social media user u i , it can be formulated as u i = {p i 1 , ..., p i N2 }, and a random social media post as p j = {w j 1 , ..., w j N3 }.

SERCNN
We propose a Stacked Embedding Recurrent Convolutional Neural Network (SERCNN), which is made up of a stacked embedding (SE) and recurrent convolutional neural network (RCNN) [15]. The overall architecture of SERCNN is simple, consisting of a SE layer, TextCNN [13], a mean-pooling layer, and two fully connected layers, with the latter one being as an output layer with Softmax function, as visualized in Fig. 1.
For the input of the SERCNN, we model our user representation by first concatenating N 2 social media posts in chronological order. For a random user where ⊕ is the concatenation operator.
The concatenated text can be viewed as a single unique "monthly diary", journal, or large document that characterizes the user. By concatenating the user-generated text, it allows the deep learning model to take advantage of the context across different time frames (global context) without losing much information throughout the time span.
Then, we extract the distributed text representation of each word with Stacked Embedding (SE); an ensemble embedding technique commonly falls under the category of Meta-embedding. The concept of Meta-embedding was first introduced by [28] to utilize and learn the meta of existing well-trained pretrained embeddings and extend the vocabulary. Meta-embedding formed from pre-trained embeddings trained on heterogeneous datasets allows for an improved vocabulary coverage and reduces out-of-vocabulary words. As the name suggests, SE is formed by stacking a collection of dense vectors (pretrained weights) E = {E 1 , ... , E N4 } extracted from N 4 number of pretrained embeddings trained on heterogeneous datasets. SE can be formulated with: where the embedding context, c SE , of a given user u can be obtained via: The vocabulary of the stacked embedding, V SE , is now considered as the union of the N 4 pretrained embeddings' vocabularies, resulting in an extensive vocabulary than a single domain embedding as shown in formula 5.
In this study, the following pre-trained embeddings are used: 1. Glove Twitter (100 dimensions) is trained using global word co-occurrences information by Pennington et al. [17] under an uncased setting, using 2 billion tweets, with 27 billion tokens. The resulting vector consists of 1.2 million vocabularies learned from the corpus. 2. Glove Wikipedia 2014 + Gigaword 5 (100 dimensions), similarly, Pennington et al. [17] have pretrained a word embedding from the corpus made up of Wikipedia 2014 and Gigaword 5 datasets using their proposed global word co-occurrences information. The embedding covers approximately 400 thousand words.
The recurrent neural network (RNN) is capable of capturing contextual information over a long sequence. However, the RNN model favors the latter words over words in the earlier sequence. Since we are interested in identifying words that associate with depression throughout the posting history, therefore, the bidirectional Long Short Term Memory (BiLSTM) of the original RCNN [15] implementation is replaced with Kim's [13] TextCNN. The TextCNN is implemented to learn the context representation from the stacked embedding vector, c SE . The formulation of the CNN includes the convolution operation of a filter, which is applied to a window of N 5 words to produce a new feature.
We have defined three filters w = {1, 2, 3} ∈ R, which are used to extract N 5 ∈ {unigram, bigram, and trigram} of feature maps. A max-pooling layer is then applied to capture the most significant features from the generated feature maps, resulting in context c CNN .
Here, the context of the stacked embedding is reintroduced in the form of mean pooled, c SE mean = mean{c SE } and is then concatenated with the c CNN , forming a rich SERCNN context c SERCNN as shown in Formula 8.
c SERCNN is then fed to two fully connected layers that have the following formulation, where W is the trainable weight and b is the bias term. The final outputŷ presents as the classification output in probabilities using softmax: where o 2 is the output of the second fully connected layer.

Early Depression Detection
From the statistics of our dataset (as tabulated in Table 2), we found that not all users are active on social media. There are 75% of users who have at least 49 posts, and the median of the dataset is 154 posts. This indicates that more than 50% of the users have at least 154 posts (refer to Table 2). Here, we propose to look into the viability of utilizing fixed observation windows, which are measured in the number of posts, to detect depression on social media. In this study, three observation windows: {10, 30, 100} posts are evaluated. Since Shen et al.'s [20] dataset consists of a single month of posts before the ground truth tweet, we further assess the robustness of our proposed observation windows by training our model on two subsets of the posting history, denoted by a suffix of -E and -L. Given that the number k is one of the observation windows we experimented with, the model with the suffix -E is trained with the k number of posts retrieved from the earliest k posts. Similarly, models with the suffix -L are trained with the k number of posts from the latest k posts. An example is presented on Fig. 2. Do note that for some users with k number of posts or less, the earliest k th and latest k th posts are the same, but this happens for several users only, as 75% of the users have at least 49 posts and a median of 154 posts (refer to Table 2).

Preprocessing
To ensure a fair comparison with previous papers, we do not expand the dataset and use the data included in the dataset only. The following preprocessing steps have been applied: 1. removes ground truth (anchor tweet), 2. lowercasing, 3. removes URL, 4. ensures only English healthy controls are included.

Experiment settings
We trained our model using the PyTorch library. All models are implemented with a cross-entropy function as the loss function and the overall objective function is optimized with the Adam [14] optimizer. Hyperparameters including learning rate, number of vocabulary, dropout, max training epochs, early stopping criteria, and batch size are reported in Table 3. SERCNN and baseline models are evaluated using 5-fold cross-validation, with each fold of the train and test ratio being 4:1 and the train and validation ratio of 9:1.

Results and Analysis
We benchmark our SERCNN with our baseline models, as well as previous work that was trained on the same dataset [8,9,20]. Specifically, we compare SERCNN with LSTM, Hierarchical Attention Network [27], Multimodal Dictionary Learning (MDL) and Multiple Social Networking Learning (MSNL) by [20] (which is trained with handcrafted features), CNN and LSTM with Policy Gradient Agent (PGA) by [8], and Gated Recurrent Unit + VGG-Net + Cooperative Misoperation Multi-Agent (GVCOMMA) policy gradients by [9]. The performance of the models is evaluated with precision, macroaverage precision, macroaverage recall, and macroaverage F1 measure, which are tabulated in Table 4. From Table 4, we can observe that the SERCNN outperformed all baseline models and previous works [8,9,20]. Overall, we have the following observations: 1. The baseline LSTM model has better performance than Gui et al.'s LSTM variant [8], which suggests that using pretrained embedding for depression detection on social media is an effective method for mitigating the effects of over-fitting using embedding trained from the dataset. 2. The performance of the baseline LSTM and HAN models is about the same indicating the hierarchical representation of the data does not necessarily represent the intrinsic structure of the data. 3. SERCNN outperforms other models, which can be due to the richer and more robust representation generated from the stacked embedding and the reintroduction of the embedding context, allowing the model to have a second chance to understand the context better.
For early depression detection using our proposed observation windows, we have also trained a classifier with the pretrained bert-base-uncased model (Bert-ForSequenceClassification) from Hugging Face 1 [24] as a baseline, since the concatenated text is much shorter now. The performance is presented in Table 5. Based on the results shown in Table 5, we observed that the BERT-E models for all observation windows performed better than their BERT-L, while the discrepancies between the SERCNNs are less than 1% for all measured metrics. Comparing the performance of SERCNN with BERT, our proposed model shows competitive performance if not better than the finetuned BERT model despite using about a fraction of the number of parameters (about 2%) as shown in Table 6.
In addition, these models also outperformed previous work that used the entire posting history. These findings suggest that depression symptoms are reflected in social media data throughout the month, which is consistent with the depression criteria stated in DSM-5 [1] where symptoms persist over time. Therefore, our empirical results indicate that not all posts in the user history are required to predict depression online.

Conclusion
Empirical results have suggested that SERCNN has the advantage of achieving state-of-the-art accuracy and, at the same time, requires less computational cost and, most importantly, fewer posts for depression detection. This is crucial as different users may have different posting behaviors, ranging from less active to more active users. Concatenating social media posts into a single diary (document) allows the deep learning model to take advantage of the relationship of words in a different time frame, resulting in a generalized global context for a user. Adopting embeddings from general and social media domains allows better vocabulary coverage, thus reducing the out-of-vocabulary words for much more robust classification. Taking advantage of the rich representation, SERCNN achieved 93.7% accuracy, outperforming previous works and baselines. Besides that, our experiment demonstrates that SERCNN can achieve 86.6% accuracy using 10 posts only and 92.2% accuracy using only 100 posts, instead of utilizing the whole dataset. We also show that SERCNN is neck-and-neck with fine-tuned BERT classifier across the three different observation window settings while having only 2% of the BERT size in terms of parameter numbers. For our future work, we plan to explore incorporating transformer models into the architecture and looking into the transferability of the models on different datasets.

Acknowledgment
This work was carried out within the framework of the research project FRGS/1/2020/ICT02/MUSM/03/5 under the Fundamental Research Grant Scheme provided by the Ministry of Higher Education, Malaysia.

Ethics Statement
Early screening of depression can significantly increase the discoverability of depression symptoms, allowing timely intervention to reduce symptoms. Our work provides novel insight into the potential of using a lesser number of posts that simulate the existing screening observation window of 14 days and reduce the cost of acquiring and storing data despite the limited number of real patient data and privacy concerns. However, our subjects are often sensitive and vulnerable; hence, additional measures have been taken to preserve their privacy. This study has received ethics approval from the Institutional Review Board with review reference number: 2020-22906-40238. Essential measures have been taken to exclude identifiable information from the data before it is used in this study. In addition, datasets obtained from their respective authors are stored in an encrypted repository. None of the users in the datasets is contacted throughout the study.