1

Automatic Detection and Classification of Cognitive Distortions in Mental Health Text

Benjamin Shickel, Scott Siegel, Martin Heesacker, Sherry Benton, and Parisa Rashidi

Abstract— In cognitive psychology, automatic and self- patients experiencing symptoms of and [2]. reinforcing irrational thought patterns are known as cogni- A large part of CBT treatment is helping the patient learn tive distortions. Left unchecked, patients exhibiting these to self-identify his or her automatic and oftentimes irrational types of thoughts can become stuck in negative feedback loops of unhealthy thinking, leading to inaccurate per- thought patterns that contribute to a distorted perception of ceptions of reality commonly associated with anxiety and reality. These negative thoughts are referred to as cognitive depression. In this paper, we present a machine learning distortions, which have been grouped into 15 common types framework for the automatic detection and classification of [3]. 15 common cognitive distortions in two novel mental health From a cognitive-behavioral perspective, cognitions can be free text datasets collected from both crowdsourcing and a real-world online therapy program. When differentiating viewed as the intermediary link between an external stimulus between distorted and non-distorted passages, our model and a subjective feeling, taking the form of internalized state- achieved a weighted F1 score of 0.88. For classifying dis- ments a person tells themselves [4]. Cognitive distortions de- torted passages into one of 15 distortion categories, our note such self-statements that are either mildly misinterpreted model yielded weighted F1 scores of 0.68 in the larger or entirely inaccurate, often reflected by logical in crowdsourced dataset and 0.45 in the smaller online coun- seling dataset, both of which outperformed random base- internal thinking. For example, “they didn’t respond to my text line metrics by a large margin. For both tasks, we also iden- message, they must be ignoring me” is a cognitive distortion tified the most discriminative words and phrases between because it makes definitive assumptions about a third party that classes to highlight common thematic elements for improv- is impossible to know with certainty. In this example, a non- ing targeted and therapist-guided mental health treatment. distorted cognition might be “they didn’t respond to my text Furthermore, we performed an exploratory analysis using unsupervised content-based clustering and topic modeling message, maybe they are preoccupied or haven’t seen it yet”. algorithms as first efforts towards a data-driven perspective In many cases, negative subjective feelings such as anxiety are on the thematic relationship between similar cognitive dis- responses to these types of distorted cognitions. Thus, a large tortions traditionally deemed unique. Finally, we highlight focus of cognitive-behavioral therapy involves training patients the difficulties in applying mental health-based machine to identify their own cognitive misjudgments to improve learning in a real-world setting and comment on the im- plications and benefits of our framework for improving overall well-being. A full list of all 15 cognitive distortions automated delivery of therapeutic treatment in conjunction used in our experiments, along with a short description of with traditional cognitive-behavioral therapy. each, can be found in Table. A.I located in the Appendix. In recent years, online therapy programs have been devel- Index Terms— cognitive-behavioral therapy, cognitive distortions, machine learning, mental health, natural lan- oped to supplement or replace traditional cognitive-behavioral guage processing therapy [5]–[12]. Similar to traditional CBT, these online coun- terparts provide guidance and instruction for identifying and challenging cognitive distortions and negative feedback loops. I. INTRODUCTION A key component of these online services is the inclusion of CCORDING to the National Institute of Mental Health, mental health journals and logs, where users describe their anxiety disorders affect more than 18% of the U.S. adult thoughts, , anxiety events, and self-assessment. populationA every year [1]. Additionally, the National Survey In this paper, we develop methods for automatically de- of Drug Use and Health reports that 6.7% of the U.S. adult tecting and classifying cognitive distortions in mental health population experienced at least one major depressive disorder text using machine learning techniques. Such frameworks have episode in the past year [2]. Cognitive-behavioral therapy important implications for the delivery of effective online (CBT) has been shown to have a large positive effect on mental health services. Along with assisting traditional thera- pist intervention, automated distortion assessment can provide This work was supported by NSF-IIP 1631871 from the National instant feedback and guidance to users exhibiting distorted Science Foundation (NSF), Division of Industrial Innovation and Part- nerships (IIP). thinking at any time of day. These frameworks would also B. Shickel, S. Siegel, M. Heesacker, and P. Rashidi are with the Uni- allow for online therapy to scale to an even larger number versity of Florida, Gainesville, FL 32611 USA (e-mail: shickelb@ufl.edu; of users. Additionally, these tools can provide early warning sns08j@ufl.edu; heesack@ufl.edu, parisa.rashidi@ufl.edu). S. Benton is with TAO Connect, Inc., St. Petersburg, FL 33701 USA of more severe mental illness and can potentially be used to (e-mail: [email protected]). monitor social media for ideal candidates for mental health 2 services. at an even distribution of responses per distortion. In total, we Our primary contributions can be summarized by the fol- collected 8,940 text passages from 1,788 unique individuals lowing: from MTurk’s pool of qualified workers. After collection, these To our knowledge, we present the first attempts at detect- responses were manually reviewed for quality and relevance. • ing and classifying a large range of cognitive distortions After removing irrelevant contributions, the final dataset con- (15) from text using machine learning techniques. tained 7,666 text responses across all 15 distortions, with an We collect a novel dataset of real-world cognitive distor- average of 511 responses per distortion. • tion event recollections from crowdsourcing participants. 2) Mental health therapy logs (MH): Our second dataset, We develop a second novel dataset of online mental which we refer to as MH, comes from TAO Connect2, an • health therapy logs annotated by experts for presence of online mental health therapy service aimed at improving cognitive distortions. coping strategies for college students suffering from anxiety We examine a reduced set of clinically recognized cogni- and depression. As part of treatment, patients completed • tive distortions based on unsupervised machine learning regular journals describing their mental state, anxiety events, techniques. specific worries, and progress. We recruited and trained four senior undergraduate psychology students to provide cognitive II. METHODS distortion annotations for these mental health journals. Each annotator was instructed to select one or more cognitive This study was approved by the University of Florida distortions that each journal response exhibited, or to indicate Institutional Review Board IRB 201401089, and all methods that no distortions were exhibited. were performed in accordance with the relevant guidelines From the overall MH dataset, we constructed two subsets and regulations. Informed consent was obtained from subjects for each of our two cognitive distortion tasks. The MH-C before enrollment in the study. dataset was annotated with 15 cognitive distortion labels, and the MH-D dataset was annotated with binary distorted/non- A. Data distorted labels. The MH-C dataset was used in the cognitive Since cognitive distortion detection is a novel machine distortion classification task, thus representing a multi-class learning task, at present time there are no publicly available classification problem. We only kept passages in which a datasets containing text passages with labeled distortions. majority of annotators agreed on which cognitive distortion Such data are necessary for constructing supervised machine was exemplified by the passage. For detecting presence of learning models suitable for predicting and classifying text- distorted text, we assigned a binary label to each passage based distortions. To this end, we collected and annotated indicating whether any cognitive distortion was selected by three novel cognitive distortion datasets, which we describe in the annotators. We only kept passages in which a majority of this section. These datasets are summarized in Table. I. The annotators selected at least one cognitive distortion. CrowdDist and MH-C datasets are labeled with 15 cognitive Below are a few short narratives taken from the MH-D distortions, while MH-D is annotated with binary distortion/no dataset that exemplify the presence or absence of cognitive distortion labels. distortions in these mental health logs: 1) Crowdsourced distortion recollections (CrowdDist): Our first cognitive distortions dataset, which we refer to as Crowd- Examples of non-distorted passages: Dist, comes from the popular crowdsourcing platform Me- “Thinking about life after school whether or not I’ll be • chanical Turk1 (MTurk). For all assignments, we enforced a able to find a job.” minimum quality requirement for MTurk workers of having “I was feeling calm all day, no worries yesterday.” • at least 95% of their previous assignments accepted. Workers “I was told the news that my grandfather had passed • were compensated $1.00 for completing an assignment, which away, I was worried about how my family was going to took 15.3 minutes on average to complete. To reduce anno- cope.” tation , individuals were only permitted to complete one Examples of distorted passages: assignment each. “Exam tomorrow and missing someone thinking that I When MTurk workers agreed to participate in the assign- • ment, they were randomly assigned to one of the three groups, was going to fail and lose that person forever.” “Forgot a meeting with my advisor, inconvenienced him each of which contained a different set of five cognitive • distortions. For each of the five distortions assigned to the – I’m incompetent.” “My friend didn’t sit next to me, I thought I was losing worker, they were first presented with a short description • of the types of thinking that the particular distortion exem- a friend.” plifies. Then, they were asked to tell us about an actual, specific time from their own life in which they exhibited the In the MH-D dataset, there exists a large class imbalance same type of described thinking. Workers were encouraged between distorted and non-distorted text (Table. I). The large to provide approximately 2-3 sentences, but no limit was class skew is a result of the source of our data being a mental enforced. Distortion groups were randomly assigned to arrive health treatment service, and specifically the use of anxiety

1http://mturk.com 2http://taoconnect.org 3

TABLE I SUMMARY STATISTICS FOR CROWDDIST AND MH DATASETS.

CrowdDist MH-C MH-D Task Classification Classification Detection Source Mechanical Turk Mental health logs Mental health logs Guided collection Yes No No Passages, n 7,666 1,164 1,799 Unique labels, n 15 15 2 Median passage length, words 47 43 42 Annotators per passage, n 144 Distortion prevalence, n (%) Distorted 7,666 (100.0) 1,164 (100.0) 1,605 (89.2) Not Distorted 0 (0.0) 0 (0.0) 194 (10.8) Distortion counts, n (%) Being Right 536 (7.0) 0 (0.0) —– Blaming 494 (6.4) 23 (2.0) —– Catastrophizing 545 (7.1) 53 (4.6) —– Control 490 (6.4) 60 (5.2) —– 500 (6.5) 187 (16.1) —– Fallacy of Change 499 (6.5) 0 (0.0) —– Fallacy of Fairness 495 (6.5) 1 (0.1) —– Filtering 545 (7.1) 386 (33.2) —– Global Labeling 493 (6.4) 4 (0.3) —– Heaven’s Reward Fallacy 490 (6.4) 0 (0.0) —– Mind Reading 545 (7.1) 260 (22.3) —– Overgeneralization 546 (7.1) 22 (1.9) —– Personalization 497 (6.5) 25 (2.1) —– Polarized Thinking 497 (6.5) 123 (10.6) —– Should’s 494 (6.4) 20 (1.7) —– monitoring logs. Thus, we fully expect most responses to already known to be distorted. Both tasks are important from a reflect emotional distress and contain some type of cognitive mental health perspective, as once text is determined to contain distortion. some distortion, knowing which distortion is present can guide 3) Preprocessing: For both cognitive distortion tasks, we treatment options for that patient. Because our CrowdDist applied a sequence of common-practice techniques for pro- dataset exclusively contains distorted text, we only report its cessing natural language text before passing to our machine distortion classification results. learning models for prediction. These steps included con- For both classification tasks, we experimented with a variety verting all passages to lowercase, removing punctuation, and of machine learning models including logistic , tokenizing each processed passage based on white space support vector machines (SVM), random forests, gradient delimiting. boosted trees (XGBoost), recurrent neural networks (RNN), We then used the generated word tokens to construct a col- and convolutional neural networks (CNN). For simplicity, we lection of unigrams (single-words) and bigrams (two adjacent only report results for the best-performing model: logistic words) for every textual passage in our datasets. These n-grams regression. In contrast with more recent deep learning models were then transformed into sparse vectors in a bag-of-words in which interpretability is often sacrificed for predictive fashion using these token counts, which we normalized by performance, logistic regression has the added benefit of being term frequency-inverse document frequency (tf-idf), a measure highly transparent, and in our datasets also resulted in superla- that provides information regarding each n-gram’s relevance to tive performance compared with more complex approaches. individual documents compared with the overall corpus. When We hypothesize that logistic regression outperformed deep evaluating our models, we vectorized test data using counts of learning techniques for our particular tasks due to the relatively only the n-grams that occurred in the training data. small size of our datasets, and the tendency of cognitive distortions to present themselves via specific, common emo- B. Model tional expressions that bag-of-words-based models more easily In this section, we report experimental settings and results capture. We also attempted a transfer learning approach by for both the cognitive distortion detection and classification training a model on our CrowdDist dataset and fine-tuning on tasks. the MH-C dataset, but this did not significantly improve results We define cognitive distortion detection as the ability for in either task. a machine learning classifier to distinguish between text We note in passing that aside from logistic regression, the containing a distortion and text that is not distorted, and second-best model for both cognitive distortion tasks was a cognitive distortion classification as the ability for a model to bidirectional recurrent neural network with gated recurrent distinguish between the 15 distortion categories in text that is units (GRU) using pre-trained GloVe word embeddings. We 4 refer interested readers to a more comprehensive overview of TABLE II deep learning and word embedding techniques [13], [14]. COGNITIVE DISTORTION DETECTION RESULTS IN THE MH-D DATASET. We utilized a standard logistic regression model for both Label N Precision Recall F1 tasks: (1) predicting if a given text represents a distorted or Not Distorted 194 0.57 0.29 0.38 non-distorted narrative, and (2) for narratives known to be Distorted 1605 0.92 0.97 0.95 distorted, classifying the text as exhibiting one of 15 potential cognitive distortions. Input features were extracted from the All Examples (Macro) 1799 0.75 0.63 0.66 All Examples (Weighted) 1799 0.88 0.90 0.88 unigrams and bigrams of each narrative via term frequency- inverse document frequency (tf-idf) as outlined in the prepro- cessing section, and a separate logistic regression classifier was constructed for each of our two cognitive distortion distortions that share common traits. For improved visualiza- classification tasks. Optimal hyperparameters were selected tion, we took the sum of all tf-idf representations for each via grid search using a nested cross-validation procedure, of the 15 cognitive distortions, resulting in a single aggregate and included model regularization, length of n-grams, and feature vector per distortion. Clustering was performed with minimum and maximum document frequency thresholds for Ward’s method of decreasing cluster variance using cosine vectorizing words and phrases. similarity as the measure of distance. Similar to linear regression for continuous outputs, logistic 2) Latent Dirichlet allocation: We also used Latent Dirichlet regression uses a sigmoid activation and maximum likelihood Allocation (LDA), a popular unsupervised topic-modeling estimation for categorical output labels to generate continuous algorithm for extracting a set of thematic topics composed scores ranging from 0 to 1, interpreted as the probability of of distributions of words from a corpus of text documents. a narrative belonging to each output class. For classifying It is a probabilistic method which assumes each document is narratives as containing cognitive distortions, a single logistic generated by sampling words from a distribution of topics, regression model was used. For classifying distorted text as where each topic is a distribution over the words in the one of 15 specific distortion labels, a separate logistic regres- corpus. In our experiments, we found n = 25 topics to sion model was trained for all possible labels and aggregated yield the most meaningful topics, and we use this setting in a “one vs. rest” approach. While a full overview of logistic for LDA-based analysis. Once the LDA model was trained regression is beyond the scope of this study, we refer interested on an entire corpus, each document was converted into a readers to Hosmer, et al. for a more detailed overview of its 25-dimensional probability distribution over topics. For each technical aspects [15]. of the 15 cognitive distortions, we took the sum of all topic probabilities from each of the distortion’s passages as the overall LDA representation of the given distortion. We C. Evaluation compared the pairwise cosine similarity between each pair of When evaluating each individual dataset, we report the 5- distortions as a measure of how related two distortions were fold nested cross-validation performance. When possible, we in terms of their thematic content, repeating this process for stratified the folds based on the distribution of distortions every pair of two cognitive distortions. occurring in the dataset. In the MH-C dataset obtained from actual patients, some distortions resulted in very few annotated III. RESULTS instances, so these instances were assigned to folds randomly. In this section, we begin by reporting classification perfor- Since MH-C was annotated by multiple annotators, we only mance for both the cognitive distortion detection and classifi- kept text responses in which the majority of annotators se- cation tasks. We then describe the results of our unsupervised lected the same cognitive distortion, and discarded passages distortion analysis. with no clear majority.

A. Cognitive distortion detection D. Unsupervised exploration Our first task, in which we wish to predict whether a text In this study, we used the set of 15 cognitive distortions passage contains evidence of a cognitive distortion or is non- outlined in recent literature [16]; however, there is still no clear distorted, only applies to our online therapy dataset. In the evidence-based consensus in the mental health and psychology CrowdDist dataset, in which we directly elicited responses communities on the best way to classify cognitive distortions. from participants matching each of the 15 cognitive distor- Various studies argue for lists ranging from five [17] to tions, we do not have text that is labeled as non-distorted. 50 [18] cognitive distortions. In this section, we detail our The 5-fold cross validation classification experiments re- unsupervised exploratory analysis procedure using the text in sulted in a weighted F1 score of 0.88 for all classes (Ta- both of our cognitive distortion datasets. For all unsupervised ble. II), with the weighted precision, recall, and F1 score analysis, we use the tf-idf representations of each passage as for the distorted class (0.92, 0.97, 0.95, respectively) greatly feature vectors. outperforming the same non-distorted classification metrics 1) Hierarchical clustering: We examined both datasets from (0.57, 0.29, 0.38, respectively). Accuracy for this task was a hierarchical clustering perspective, with the hypothesis that 90%, but given the significant class imbalance, we place more there may exist natural and hierarchical groupings of cognitive emphasis on F1 score for our primary classification metric. 5

TABLE III COGNITIVE DISTORTION CLASSIFICATION RESULTS IN CROWDDIST AND MH-C DATASETS.

CrowdDist MH-C Label N Precision Recall F1 N Precision Recall F1 Being Right 536 0.73 0.78 0.75 0 —– —– —– Blaming 494 0.77 0.72 0.74 23 0.00 0.00 0.00 Catastrophizing 545 0.67 0.71 0.69 53 0.50 0.21 0.29 Control Fallacy 490 0.65 0.64 0.64 60 0.28 0.22 0.25 Emotional Reasoning 500 0.55 0.55 0.55 187 0.40 0.40 0.40 Fallacy of Change 499 0.74 0.75 0.75 0 —– —– —– Fallacy of Fairness 495 0.81 0.73 0.77 1 0.00 0.00 0.00 Filtering 545 0.70 0.74 0.72 386 0.52 0.62 0.56 Global Labeling 493 0.61 0.53 0.57 4 0.00 0.00 0.00 Heaven’s Reward Fallacy 490 0.65 0.67 0.66 0 —– —– —– Mind Reading 545 0.61 0.67 0.64 260 0.50 0.60 0.55 Overgeneralization 546 0.64 0.63 0.63 22 0.43 0.14 0.21 Personalization 497 0.68 0.63 0.66 25 0.00 0.00 0.00 Polarized Thinking 497 0.61 0.60 0.61 123 0.39 0.37 0.38 Should’s 494 0.73 0.77 0.75 20 0.50 0.05 0.09 All Examples (Macro) 7666 0.68 0.68 0.68 1164 0.29 0.22 0.23 All Examples (Weighted) 7666 0.68 0.68 0.68 1164 0.44 0.47 0.45

B. Cognitive distortion classification tively suggest the natural number of unique distortions in a Our second task involved the classification of distorted text data-driven manner. For these experiments, we did not assume into the 15 distinct distortion categories shown in Table. I. For any fixed number of cognitive distortions, which is frequently this task, each response is known to contain some unspeci- debated in literature. Instead, we turned to unsupervised fied cognitive distortion, whether by crowdsourced volunteers machine learning techniques to reveal natural cooccurrence (CrowdDist) or annotated as such from online mental health and groupings of related text in both CrowdDist and MH-C journals (MH-C). Our aim is to predict which distortion the passages containing cognitive distortions. For brevity, in this text contains. Specific, fine-grained identification of cognitive section we only show unsupervised analysis of the CrowdDist distortions is important for tailoring mental health treatment dataset, which is larger and more balanced than the MH and providing specific feedback to both patients and therapists. dataset. We note that the distribution of distortion labels is roughly The result of hierarchical clustering on the distorted text balanced in the CrowdDist dataset (Table. I). This is a direct passages from the CrowdDist dataset is shown as a dendro- result of the guided nature of our data collection, where we gram in Fig. 1. The clustering via Ward’s method using cosine intentionally collected a balanced distribution of responses for distance appears to suggest four natural groupings of cognitive each of the 15 cognitive distortion categories. In contrast, distortions. the MH-C dataset comes from real-world patient journals in In Fig. 2, we examine the cosine similarity between every a currently active online mental health therapy service. The pair of our 15 cognitive distortions in the CrowdDist dataset, distribution of distortions in MH-C is much different, with evaluated based on the sum of the LDA topic distribution for some labels receiving zero annotator votes. While CrowdDist each passage of each cognitive distortion. In the CrowdDist can be viewed as the ideal classification setting, MH-C exhibits dataset, the five most similar distortion pairs were Fallacy the difficulties that come with modeling real-world data. of Fairness/Heaven’s Reward Fallacy (0.98), Emotional Rea- Table. III shows the precision, recall, and F1 scores for the soning/Mind Reading (0.98), Emotional Reasoning/Global La- cognitive distortion classification task in both datasets. The beling (0.98), Being Right/Mind Reading (0.98), and Global CrowdDist model yielded 0.68 accuracy and the MH-C model Labeling/Mind Reading (0.95). In the MH-C dataset, the yielded 0.47 accuracy. Given 15 possible distortion labels, the five most similar distortion pairs were Filtering/Polarized accuracy represented by random chance is 0.06. Thinking (0.98), Blaming/Filtering (0.97), Blaming/Emotional After obtaining the best models via 5-fold nested cross- Reasoning (0.97), Catastrophizing/Filtering (0.96), and Blam- validation, we retrained a single model per dataset using the ing/Polarized Thinking (0.96). optimal hyperparameters with all available data. Table. IV shows the ten most discriminative words and phrases for each IV. DISCUSSION of the 15 cognitive distortions in the CrowdDist dataset, found This study details the application of machine learning by taking maximum logistic regression term coefficients. techniques toward detecting, classifying, and understanding the underlying structure of cognitive distortions in short text C. Unsupervised exploration passages. There is a currently a substantial lack of annotated Aside from constructing models to accurately predict and datasets in this domain, and one of our primary contributions classify distorted text passages, we also sought to quantita- is the collection of two novel cognitive distortion datasets 6

Fig. 1. Hierarchical clustering results for the CrowdDist dataset. Feature vectors for each of the 15 cognitive distortions were obtained by taking the sum of the tf-idf representations of passages for each label. Clusters obtained via Ward’s method using cosine similarity as the measure of distance.

Fig. 2. Cosine similarity between the sum of each labeled document’s 25-topic LDA topic distribution in the CrowdDist dataset. Pairs of cognitive distortions that are more similar in thematic content are shown as darker squares. 7

TABLE IV TEN MOST DISCRIMINATIVE WORDS AND PHRASES FOR EACH COGNITIVE DISTORTION CLASS IN THE CROWDDIST DATASET.

Being Right Blaming Catastrophizing Control Fallacy Emotional Reasoning right what if control feel was right blamed started responsible felt correct blaming worry responsible for invited wrong blame my die help me prove fault panicked of control invite explain my will felt guilty point blamed my worried to help emotions to prove for not what feel responsible go feelings for panic feel but arguing because going to advice feeling Fallacy of Change Fallacy of Fairness Filtering Global Labeling Heaven’s Reward Fallacy change unfair negative internal cheated happy fair great external worked to change unfair that positive met hard relationship resentful good concluded bitter be happy fair that said concluded that shocked if was unfair on loser deserved happiness pulled but women put would got comment people that if him people focus men rewarded happier ticket nice decided sacrifice Mind Reading Overgeneralization Personalization Polarized Thinking Should’s assume never happy for failure should assumed again compare either people should convinced always jealous perfect that should response would never why if should be reply will my friend failed people she ever friend or rules respond will always friend got score should always at me now compared or nothing believe they because compare myself perfectly believed read i’ll never myself goal college coming from both crowdsourcing volunteers (CrowdDist) and the CrowdDist dataset with a weighted F1 score across all real mental health patients (MH). passages of 0.68 (Table. III), representing a clear improvement In our cognitive distortion detection task, we developed over the random-chance baseline of 0.06 given the 15 possible a logistic regression model to predict whether text passages prediction classes. F1 scores for individual distortions ranged from mental health self-monitoring logs contained evidence from 0.55 (Emotional Reasoning) to 0.77 (Fallacy of Fairness). of at least one cognitive distortion. Our model performed Each distortion was characterized by specific themes and generally well with a weighted F1 score of 0.88 across all word choices, demonstrated by the top word coefficients of passages (Table. II). However, while the classifier was fully the logistic regression model. We believe the identification capable of correctly identifying distorted text (0.92 precision, of these discriminative words can have positive impact on 0.97 recall, 0.95 F1), it struggled with non-distorted passages the implementation of existing online therapeutic treatment from the same domain (0.57 precision, 0.29 recall, 0.38 F1 by serving as either early warning signs for particular cog- score). One rationale for poor performance in non-distorted nitive distortions, or by drawing increased attention from text is the class imbalance in the MH-D dataset: only 10.8% human therapists to direct a more personalized treatment plan. of all text passages contained zero cognitive distortions. Since While classification performance was overall satisfactory in MH-D comes from a real-world mental health service, it is the CrowdDist dataset, we believe that the short nature of the a logical expectation that most user journals will involve passages and the potential presence of multiple distortions had some type of distorted thinking. Furthermore, the relatively a negative impact on classification. Since distortions are known small size of MH-D (1,799 passages) would limit the ability to cooccur and several distortions are similar in thematic of fully developing a domain-dependent language model and content, our unsupervised analysis was designed to provide differentiating between text of each distortion class with very justification for reducing the number of cognitive distortions. high accuracy. Distortion classification performance in the MH-C dataset When classifying the primary cognitive distortion of text was fair, with an overall weighted F1 score across all passages already known to be distorted, our model performed well in of 0.45 (Table. III), ranging from 0 (Blaming, Fallacy of 8

Fairness, Global Labeling, Personalization) to 0.56 (Filtering). on there being no clear majority in annotator votes. While Again, the baseline accuracy for classifying 15 class labels simplifying the tasks, we are potentially missing out on valu- by a random-chance classifier is 0.06. The primary difficulty able distortion information, especially when several cognitive in MH-C was the lack of annotation quantity for five distor- distortions are co-occurring. tions (Being Right, Fallacy of Change, Fallacy of Fairness, Finally, the size of our real-world mental health dataset Global Labeling, Heaven’s Reward Fallacy). Given the small (MH) is less than ideal. It is difficult to draw definitive dataset size and these underrepresented distortions, the 15- conclusions when not all distortions were equally represented class classification problem proved especially difficult in the in the data, and future work in this area should primarily focus mental health domain. While psychologists and other mental on robust data collection. health experts have identified 15 distinct cognitive distortions, our results indicate that some distortions occur much more B. Comparison with prior work frequently than others in a real-world setting. Combined with While machine learning and deep learning methods have our unsupervised analysis of distortion similarity, we feel it been successfully applied to many natural language processing is important to revisit these distortion categories for possible classification tasks in other domains, relatively few works have adjustment based on real patient data. explored these techniques in the context of mental health. Our unsupervised analysis provided three perspectives on Within this space, researchers have focused on tasks such as distortion similarity that represent the first steps toward a emotional valence prediction in mental health journals [19], data-driven rationale for revisiting the distinction between identifying characteristic language indicators of mental health distortions, and for possible reduction in their overall number. in social media [20]–[22], sentiment analysis of suicide notes When performing hierarchical clustering on both datasets [23], [24], early warning indicators for poor mental health in (CrowdDist shown in Fig. 1), each experiment produced differ- online forums [25], and detecting and phenotyping lifelong ent domain-dependent groupings of distortions. A qualitative disorders like dementia and autism [26], [27]. Less attention analysis of these results would indicate four inherent clusters has been paid to applying machine learning techniques from a in the CrowdDist dataset and just two in the MH-C dataset. cognitive-behavioral perspective as we have done in this paper. There was no trend in the groupings of specific distortions Cognitive distortion detection and classification share sim- between datasets, suggesting that thematic content in each ilarities with the task of text-based recognition [17], domain played a large role in the way each distortion was [28]–[30]. To our knowledge, only [17] has explicitly dealt exemplified. with the classification of cognitive distortions. However, [17] We compared the cosine similarity between topic distribu- used a list of five distortions, compared with our expanded tions using latent Dirichlet allocation in an attempt to quantify list of 15. Furthermore, they worked exclusively with crowd- the relatedness between each distortion pair’s thematic content sourced data. To our knowledge we are the first to classify (Fig. 2). Each domain produced different thematic similarity cognitive distortions using real-world, unscripted mental health between distortions, but here we note some patterns between text from online therapy programs. domains; for example, in both datasets, Polarized Thinking is highly similar to Should’s, and Emotional Reasoning is highly dissimilar to Fallacy of Change. C. Conclusions Above all, both supervised and unsupervised experiments Cognitive distortions put people at significant risk for en- involving cognitive distortions highlight the importance of gaging in and sustaining dysfunctional behaviors, and for pro- source domain when dealing with free text passages. We ducing needlessly dysphoric affective reactions to experiences. have showed that distorted text takes on different forms So, a machine learning tool for detecting cognitive distortions when coming from third-party individuals (CrowdDist) or from research participant responses and, more importantly, real patients currently experiencing distorted thinking (MH). patient responses represent a critically important advance in These experiments indicate the nature of cognitive distortions computer-assisted healthcare delivery. This tool can be used themselves: what is clear to healthy individuals may be more to alert clinicians about the presence and frequency of distorted difficult to understand for patients affected by certain types of thinking exhibited in clients’ verbal behavior, whether that distorted thinking. verbal behavior is text or voice-to-text. Clinicians can use this tool to assess whether distorted thinking is initially a feature of clients’ presenting concerns and if so, focus treatment to- A. Limitations ward changing distorted cognitions. Over time, assessment of One potential limitation of our crowdsourced CrowdDist distorted cognitions can provide clinicians with important data dataset is the fact that we prompted volunteers with specific regarding whether treatment is producing desired results and descriptions of distortions. It is possible that the types of whether over time clients who may not have initially presented responses we gathered based on these scripted prompts do with cognitive distortions start to reveal distorted thinking in not accurately represent the types of mental health text found their verbal behavior as the therapeutic alliance is developed “in the wild”. This bias was exemplified by the comparatively and strengthened. One of the most useful features of this tool lower classification performance in the MH-C dataset. is that it is noninvasive. That is, clients simply engage in the Additionally, we discarded several examples of distorted normal verbal behavior associated with treatment, whether that mental health text for the distortion classification task based is computer assisted or traditional treatment, and the machine 9 learning tool assesses for distortions without any additional REFERENCES assessment or intervention. A closely-related useful feature is [1] R. C. Kessler, W. T. Chiu, O. Demler, and E. E. Walters, “Prevalence, that client verbal behavior is occurring as part of the natural Severity, and Comorbidity of Twelve-month DSM-IV Disorders in course of treatment, which provides increased confidence that the National Comorbidity Survey Replication (NCS- R),” Archives of General Psychiatry, vol. 62, no. 6, pp. 617–627, 2005. what clients are writing or saying may be a reasonably accurate [2] S. G. Hofmann, A. Asnaani, I. J. J. Vonk, A. T. Sawyer, and A. Fang, rendition of the covert verbal behavior in which they engage “The Efficacy of Cognitive Behavioral Therapy: A Review of Meta- when not in therapy. analyses.” [3] A. T. Beck, and the emotional disorders. New York: Because all client verbal behavior in therapy can be re- Meridian, 1976. viewed using this tool, therapists can be alerted to changes [4] ——, “Cognitive Therapy: Nature and Relation to Behavior Therapy,” in distorted thinking exhibited from one session to the next Behavior Therapy, vol. 1, no. 2, pp. 184–200, 1970. [5] J. R. Alleman, “Online counseling: The Internet and mental health treat- or across multiple sessions. If distorted thinking steadily ment.” Psychotherapy: Theory, Research, Practice, Training, vol. 39, increases over time, alerting the therapist can allow for a no. 2, pp. 199–209, 2002. refocusing of treatment or the use of different therapeutic in- [6] M. Wells, K. J. Mitchell, D. Finkelhor, and K. A. Becker-Blease, “Online Mental Health Treatment: Concerns and Considerations,” CyberPsychol- terventions to address cognitive distortions. If distorted think- ogy and Behavior, vol. 10, no. 3, pp. 453–459, 2007. ing steadily decreases over time, therapists can reasonably [7] S. H. Spence, C. L. Donovan, S. March, A. Gamble, R. Anderson, assume that treatment is working effectively in this domain S. Prosser, A. Kercher, and J. Kenardy, “Online CBT in the Treatment of Child and Adolescent Anxiety Disorders: Issues in the Development and may wish to celebrate that progress with the patient. of BRAVE–ONLINE and Two Case Illustrations,” Behavioural and If the frequency of distorted thinking drops to the level of Cognitive Psychotherapy, vol. 36, no. 04, pp. 411–430, 2008. rarely occurring, therapists can shift the focus from treatment [8] B. Klein, J. Mitchell, J. Abbott, K. Shandley, D. Austin, K. Gilson, L. Kiropoulos, G. Cannard, and T. Redman, “A therapist-assisted to maintenance of treatment gains and if other aspects of cognitive behavior therapy internet intervention for posttraumatic stress the client’s functioning warrant it, the conclusion of formal disorder: Pre-, post- and 3-month follow-up results from an open trial,” treatment. Journal of Anxiety Disorders, vol. 24, no. 6, pp. 635–644, 2010. [9] S. L. Currie, P. J. Mcgrath, and V. Day, “Development and usability of Accurately typing specific cognitive distortions and de- an online CBT program for symptoms of moderate depression, anxiety, termining how many discrete distortions are present in a and stress in post-secondary students,” Computers in Human Behavior, vol. 26, no. 6, pp. 1419–1426, 2010. particular piece of client verbal behavior remain challenges. [10] J. Ruwaard, A. Lange, B. Schrieken, C. V. Dolan, and P. Emmelkamp, What we noticed in patient data that was absent in research “The effectiveness of online cognitive behavioral treatment in routine participant data (as a direct result of the instructions to research clinical practice,” PLoS ONE, vol. 7, no. 7, 2012. [11] M. F. Travers and S. A. Benton, “The Acceptability of Therapist- participants) were cascades of cognitive distortions, which are Assisted, Internet-Delivered Treatment for College Students,” Journal cases where two, three, four or more cases of distorted thinking of College Student Psychotherapy, vol. 28, no. 1, pp. 35–46, 2014. were exhibited in a single verbal response. Disentangling the [12] S. A. Benton, M. Heesacker, S. J. Snowden, and G. Lee, “Therapist- assisted, online (TAO) intervention for anxiety in college students: TAO pieces of these cascades is challenging. We hope to improve outperformed treatment as usual.” Professional Psychology: Research on the tool’s ability to do that in the future. A closely related and Practice, vol. 47, no. 5, pp. 363–371, 2016. challenge involves improving on the accuracy of distortion [13] I. Goodfellow, Y. Bengio, and A. Courville, Deep Learning. MIT Press, 2016. typology. Some scholars have identified 10 distinct distortions, [14] J. Pennington, R. Socher, and C. D. Manning, “GloVe: Global vectors others 15, and some others have provided other estimates. for word representation,” in Proceedings of the Empiricial Methods in Comparison of these lists reveals both the expected overlap be- Natural Language Processing, 2014, pp. 1532–1543. [15] D. W. Hosmer Jr, S. Lemeshow, and R. X. Sturdivant, Applied logistic tween lists, but also often overlap within lists. Some elements regression. John Wiley & Sons, 2013. on some lists appear to represent superordinate categories [16] J. M. Grohol, “15 Common Cognitive Distor- while what appear to be subordinate elements appear as other tions,” 2018. [Online]. Available: https://psychcentral.com/lib/ elements in the same list. All of this suggests that in the future, 15-common-cognitive-distortions/ [17] R. Morris and R. Picard, “Crowdsourcing collective emotional intelli- factor analytic and other statistical techniques for grouping gence,” Collective Intelligence Conference, pp. 1–8, 2012. distortions need to be employed to provide empirical clar- [18] A. Boyes, “50 Common Cognitive Distortions.” [Online]. ity regarding the number of independent (or interdependent) Available: https://www.psychologytoday.com/blog/in-practice/201301/ 50-common-cognitive-distortions dimensions of distortion that most accurately characterizes [19] B. Shickel, M. Heesacker, S. Benton, A. Ebadi, P. Nickerson, and clients’ cognitively distorted verbal behavior. This work will P. Rashidi, “Self-Reflective Sentiment Analysis,” in Proceedings of the also result in more clarity about features that define any given Third Workshop on Computational Linguistics and Clinical Psychology, 2016, pp. 23–32. cognitive distortion. [20] J. D. Hwang and K. Hollingshead, “Crazy Mad Nutters: The Language of Mental Health,” in Proceedings of the Third Workshop on Computational Lingusitics and Clinical Psychology. San Diego, CA, USA: Association for Computational Linguistics, jun 2016, pp. 52–62. ACKNOWLEDGMENT [Online]. Available: http://www.aclweb.org/anthology/W16-0306 [21] G. Gkotsis, A. Oellrich, T. Hubbard, R. Dobson, M. Liakata, S. Velupillai, and R. Dutta, “The language of mental health problems in Research supported by NSF-IIP 1631871 from the National social media,” in Proceedings of the Third Workshop on Computational Lingusitics and Clinical Psychology. San Diego, CA, USA: Association Science Foundation (NSF), Division of Industrial Innovation for Computational Linguistics, jun 2016, pp. 63–73. [Online]. Available: and Partnerships (IIP). We thank TAO Connect for access http://www.aclweb.org/anthology/W16-0307 and assistance with retrieving online therapy logs. The Titan [22] M. Tanana, A. Dembe, C. S. Soma, Z. Imel, D. Atkins, and V. Srikumar, “Is Sentiment in Movies the Same as Sentiment in Psychotherapy? X Pascal used for this work was donated by the NVIDIA Comparisons Using a New Psychotherapy Sentiment Database,” in Corporation through the GPU Grant Program. Proceedings of the Third Workshop on Computational Lingusitics 10

and Clinical Psychology. San Diego, CA, USA: Association for Computational Linguistics, jun 2016, pp. 33–41. [Online]. Available: http://www.aclweb.org/anthology/W16-0304 [23] J. Pestian, P. Matykiewicz, Brett South, Ozlem Uzuner, and John Hurdle, “Sentiment analysis of suicide notes: A shared task,” Biomedical Informatics Insights, vol. 5, no. 1, pp. 3–16, 2012. [24] G. Coppersmith, K. Ngo, R. Leary, and A. Wood, “Exploratory Analysis of Social Media Prior to a Suicide Attempt,” in Proceedings of the Third Workshop on Computational Lingusitics and Clinical Psychology. San Diego, CA, USA: Association for Computational Linguistics, jun 2016, pp. 106–117. [Online]. Available: http: //www.aclweb.org/anthology/W16-0311 [25] B. Shickel and P. Rashidi, “Automatic Triage of Mental Health Forum Posts,” in Proceedings of the Third Workshop on Computational Lin- guistics and Clinical Psychology, 2016, pp. 188–192. [26] J. Bullard, C. Ovesdotter Alm, X. Liu, Q. Yu, and R. Proano,˜ “Towards Early Dementia Detection: Fusing Linguistic and Non- Linguistic Clinical Data,” in Proceedings of the Third Workshop on Computational Lingusitics and Clinical Psychology. San Diego, CA, USA: Association for Computational Linguistics, jun 2016, pp. 12–22. [Online]. Available: http://www.aclweb.org/anthology/W16-0302 [27] J. Parish-Morris, M. Liberman, N. Ryant, C. Cieri, L. Bateman, E. Ferguson, and R. Schultz, “Exploring Autism Spectrum Disorders Using HLT,” in Proceedings of the Third Workshop on Computational Lingusitics and Clinical Psychology. San Diego, CA, USA: Association for Computational Linguistics, jun 2016, pp. 74–84. [Online]. Available: http://www.aclweb.org/anthology/W16-0308 [28] C. Strapparava and R. Mihalcea, “Learning to identify emotions in text,” Proceedings of the 2008 ACM symposium on Applied computing - SAC ’08, p. 1556, 2008. [29] H. Lee, Y. S. Choi, S. Lee, and I. P. Park, “Towards unobtrusive emotion recognition for affective social communication,” 2012 IEEE Consumer Communications and Networking Conference, CCNC’2012, pp. 260– 264, 2012. [30] Y. R. Tausczik and J. W. Pennebaker, “The Psychological Meaning of Words: LIWC and Computerized Text Analysis Methods,” Journal of Language and Social Psychology, vol. 29, no. 1, pp. 24–54, 2010. 11

APPENDIX

TABLE A.I DESCRIPTIONS OF THE 15 COGNITIVE DISTORTIONS USED IN OUR EXPERIMENTS. COPYRIGHT 2018 PSYCHCENTRAL.COM.ALL RIGHTS RESERVED.REPRINTED HERE WITH PERMISSION.[16]

Distortion Description Being Right We are continually on trial to prove that our opinions and actions are correct. Being wrong is unthinkable and we will go to any length to demonstrate our rightness. For example, “I don’t care how badly arguing with me makes you feel, I’m going to win this argument no matter what because I’m right.” Being right often is more important than the feelings of others around a person who engages in this cognitive distortion, even loved ones. Blaming We hold other people responsible for our pain, or take the other track and blame ourselves for every problem. For example, “Stop making me feel bad about myself!” Nobody can “make” us feel any particular way — only we have control over our own emotions and emotional reactions. Catastrophizing We expect disaster to strike, no matter what. This is also referred to as “magnifying or minimizing.” We hear about a problem and use what if questions (e.g., “What if tragedy strikes?” “What if it happens to me?”). For example, a person might exaggerate the importance of insignificant events (such as their mistake, or someone else’s achievement). Or they may inappropriately shrink the magnitude of significant events until they appear tiny (for example, a person’s own desirable qualities or someone else’s imperfections). Control Fallacy If we feel externally controlled, we see ourselves as helpless a victim of fate. For example, “I can’t help it if the quality of the work is poor, my boss demanded I work overtime on it.” The fallacy of internal control has us assuming responsibility for the pain and happiness of everyone around us. For example, “Why aren’t you happy? Is it because of something I did?” Emotional Reasoning We believe that what we feel must be true automatically. If we feel stupid and boring, then we must be stupid and boring. You assume that your unhealthy emotions reflect he way things really are — “I feel it, therefore it must be true.” Fallacy of Change We expect that other people will change to suit us if we just pressure or cajole them enough. We need to change people because our hopes for happiness seem to depend entirely on them. Fallacy of Fairness We feel resentful because we think we know what is fair, but other people won’t agree with us. As our parents tell us when we’re growing up and something doesn’t go our way, “Life isn’t always fair.” People who go through life applying a measuring ruler against every situation judging its “fairness” will often feel badly and negative because of it. Because life isn’t “fair” — things will not always work out in your favor, even when you think they should. Filtering We take the negative details and magnify them while filtering out all positive aspects of a situation. For instance, a person may pick out a single, unpleasant detail and dwell on it exclusively so that their vision of reality becomes darkened or distorted. Continued on next page 12

Distortion Description Global Labeling We generalize one or two qualities into a negative global judgment. These are extreme forms of generalizing, and are also referred to as “labeling” and “mislabeling.” Instead of describing an error in context of a specific situation, a person will attach an unhealthy label to themselves. For example, they may say, “I’m a loser” in a situation where they failed at a specific task. When someone else’s behavior rubs a person the wrong way, they may attach an unhealthy label to him, such as “He’s a real jerk.” Mislabeling involves describing an event with language that is highly colored and emotionally loaded. For example, instead of saying someone drops her children off at daycare every day, a person who is mislabeling might say that “she abandons her children to strangers.” Heaven’s Reward Fallacy We expect our sacrifice and self- to pay off, as if someone is keeping score. We feel bitter when the reward doesn’t come. Mind Reading Without individuals saying so, we know what they are feeling and why they act the way they do. In particular, we are able to determine how people are feeling toward us. For example, a person may conclude that someone is reacting negatively toward them but doesn’t actually bother to find out if they are correct. Another example is a person may anticipate that things will turn out badly, and will feel convinced that their prediction is already an established fact. Overgeneralization In this cognitive distortion, we come to a general conclusion based on a single incident or a single piece of evidence. If something bad happens only once, we expect it to happen over and over again. A person may see a single, unpleasant event as part of a never-ending pattern of defeat. Personalization Personalization is a distortion where a person believes that everything others do or say is some kind of direct, personal reaction to the person. We also compare ourselves to others trying to determine who is smarter, better looking, etc. A person engaging in personalization may also see themselves as the cause of some unhealthy external event that they were not responsible for. For example, “We were late to the dinner party and caused the hostess to overcook the meal. If I had only pushed my husband to leave on time, this wouldn’t have happened.” Polarized Thinking In polarized thinking, things are either “black-or-white.” We have to be perfect or we’re a failure — there is no middle ground. You place people or situations in “either/or” categories, with no shades of gray or allowing for the complexity of most people and situations. If your performance falls short of perfect, you see yourself as a total failure. Should’s We have a list of ironclad rules about how others and we should behave. People who break the rules make us angry, and we feel guilty when we violate these rules. A person may often believe they are trying to motivate themselves with shoulds and shouldn’ts, as if they have to be punished before they can do anything. For example, “I really should exercise. I shouldn’t be so lazy.” Musts and oughts are also offenders. The emotional consequence is . When a person directs should statements toward others, they often feel anger, and resentment.