Depression detection model construction method fusing cognitive distortion and user-level information

By constructing a depression detection model that integrates cognitive distortions and user-level information, using a multi-granularity scene-aware encoder and a post-level distortion perception mechanism, and combining user gender and posting behavior information, the problem of ignoring user-level information in existing methods is solved, achieving more efficient depression detection.

CN120708931APending Publication Date: 2025-09-26SICHUAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510815893.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

Existing depression detection methods ignore users' cognitive distortion information and user-level information, especially gender information and posting behavior information, resulting in poor detection results.

Method used

By constructing a depression detection model that integrates cognitive distortion and user-level information, using a multi-granularity scene-aware cognitive distortion encoder and a post-level distortion perception mechanism, combined with user gender information and posting behavior information, a multi-feature adaptive weighting method is adopted for depression detection.

Benefits of technology

It improves the accuracy and effectiveness of depression detection, can more comprehensively capture cognitive distortion information in user texts, reduce the noise caused by data irregularities, and improve the accuracy of depression detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120708931A_ABST
    Figure CN120708931A_ABST
Patent Text Reader

Abstract

The invention discloses a depression detection model construction method fusing cognitive distortion and user-level information, which comprises the following steps: on one hand, capturing potential multi-granularity cognitive distortion information in a user text through a cognitive distortion encoder trained by a multi-granularity cognitive distortion learning method; meanwhile, a post-level distortion perception mechanism is also provided to identify key cognitive distortion information related to subjective cognition of the user. And on the other hand, the model fully fuses user-level information highly related to depression symptoms, and in addition, key post-level fusion information and various user-level information are dynamically identified for different users through a multi-feature adaptive weighting method, so that the influence of noise caused by data irregularity is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of deep learning technology, and in particular to a method for constructing a depression detection model that integrates cognitive distortions and user-level information. Background Art

[0002] With the rapid development of social media platforms, more and more research has begun to analyze users' social media data to detect their depressive tendencies. However, most existing work has ignored users' cognitive distortions. Since cognitive distortions are widely present in people with depression, analyzing potential cognitive distortions in user posts can help further identify users' depressive tendencies. In addition, most existing work determines whether a single post has depressive tendencies. Although these methods have achieved good results, they are difficult to meet the real needs of real life. Many works have begun to detect depression at the user level. However, these works only focus on the semantic information of user posts and ignore various user-level information related to depression, such as user gender and posting behavior information. This user information is very critical for depression detection. Summary of the Invention

[0003] The present invention provides a method for constructing a depression detection model that integrates cognitive distortion and user-level information, so as to solve the problem that existing depression tendency detection methods ignore the user's authentication distortion information and user-level information related to depression.

[0004] According to the first aspect, an embodiment provides a method for constructing a depression detection model that integrates cognitive distortions and user-level information, the method comprising:

[0005] A cognitive distortion encoder for multi-granularity scene perception was trained based on a cognitive distortion type prediction task and a scene comparison pre-training task.

[0006] The contextual semantic representation and cognitive distortion representation of the post are obtained through the text encoder and cognitive distortion encoder respectively. The enhanced cognitive distortion representation is obtained based on the post-level distortion perception mechanism. The contextual semantic representation and the enhanced cognitive distortion representation are fused to obtain the post-level fused representation.

[0007] The user's gender information and posting behavior information are counted and encoded to obtain a user-level multi-feature representation. The multi-feature adaptive weighting method is used to combine the post-level fusion representation and the user-level multi-feature representation to obtain the final user representation for predicting depression.

[0008] Furthermore, a multi-granularity scene-aware cognitive distortion encoder is trained based on the cognitive distortion type prediction task and the scene comparison pre-training task, specifically including:

[0009] The scene text and the corresponding thought text in each data in the cognitive distortion dataset are spliced ​​as the input text st c , encode the input text using the encoder to be trained to obtain the contextual semantic representation H of the text cdt , and then input it into the softmax layer to get the cognitive distortion type of the text The specific process is expressed as:

[0010] H cdt =EC(st c )

[0011]

[0012] After training on the cognitive distortion type prediction task, the encoder learned the types of cognitive distortions contained in different texts.

[0013] Furthermore, a multi-granularity scene-aware cognitive distortion encoder is trained based on the cognitive distortion type prediction task and the scene comparison pre-training task, specifically including:

[0014] The cross entropy with L2 regularization is used as the loss function for the cognitive distortion type prediction task:

[0015]

[0016] Among them, T i and are the standard and predicted labels of the cognitive distortion type of the i-th text, J is the size of the cognitive distortion dataset, λ is the regularization coefficient, and Θ represents all trainable model parameters.

[0017] Furthermore, a multi-granularity scene-aware cognitive distortion encoder is trained based on the cognitive distortion type prediction task and the scene comparison pre-training task, specifically including:

[0018] The encoder trained on the cognitive distortion type prediction task is further trained through contrastive learning to distinguish texts with different cognitive distortion types in the same scenario, thereby fully capturing fine-grained cognitive distortion information.

[0019] First, build a scene-based positive and negative sample pair set based on the cognitive distortion dataset Positive and negative sample groups Contains learning samples mt l , positive sample mt po And negative samples

[0020] For any positive and negative sample group All the texts in it are input into the encoder trained on the cognitive distortion type prediction task to obtain the contextual representation of the text for contrastive learning, which is expressed as d is the dimension;

[0021] The contrast loss on the set of scene-based positive and negative example pairs is defined as:

[0022]

[0023] Among them (h 1 ,h pi ) represents the contextual semantic representation of the learning sample and the positive sample, τ represents the temperature parameter, Indicates h l With h po Most similar possibility;

[0024] After scene contrast pre-training, a cognitive distortion encoder for multi-granularity scene perception is obtained.

[0025] Furthermore, the contextual semantic representation and cognitive distortion representation of the post are obtained through the text encoder and cognitive distortion encoder respectively, including:

[0026] For post p i , first input to the text encoder and perform average pooling to get the post p i Contextual semantic representation of

[0027]

[0028] in d is the dimension;

[0029] By calculating and concatenating n posts in the post set P, we can get the contextual semantic representation of the post set P.

[0030] The n posts in the post set P are sequentially input into the multi-granularity scene-aware cognitive distortion encoder and average pooled, and then cascaded to obtain the cognitive distortion representation of the post set P:

[0031]

[0032] Furthermore, the enhanced cognitive distortion representation based on the post-level distortion perception mechanism includes:

[0033] The context semantics is represented by H cs and cognitive distortions represent H cd Input the same fully connected layer for mapping operation respectively. The specific formula is as follows:

[0034]

[0035] Among them, W cd is the learnable weight, b cd is the bias vector, and d p is the dimension after mapping;

[0036] Based on the self-attention mechanism, the comprehensive semantic representation of the post set P is calculated by the following formula to represent the user's global semantic information:

[0037]

[0038] where σ is the activation function, and The comprehensive cognitive distortion representation of each post is calculated using the following formula:

[0039]

[0040] in and

[0041] In order to capture the key cognitive distortion information related to the user's global semantics, the correlation between the cognitive distortion information of each post and the user's global semantics is calculated to obtain the importance weight of the cognitive distortion information of each post to the user's global semantics. The specific calculation process is as follows:

[0042]

[0043] Where ⊙ represents the Hadamard product operation,

[0044] Multiply the importance weight of each post calculated by the mapped cognitive distortion representation of each post to obtain the enhanced cognitive distortion representation H ecd , the specific calculation process is as follows:

[0045]

[0046] Furthermore, the contextual semantic representation of the post and the enhanced cognitive distortion representation are fused to obtain a post-level fused representation, which specifically includes:

[0047] The mapped context semantics is represented by H cs and enhanced cognitive distortions indicate H ecd Perform concatenation and averaging to obtain the final post-level fusion representation:

[0048]

[0049] Furthermore, the user's gender information and posting behavior information are counted and encoded to obtain a user-level multi-feature representation, specifically including:

[0050] Collect statistics on various user information and construct corresponding information sentences to obtain corresponding representations;

[0051] First, the personal information I of user u u Extract gender information Sex u ∈{male, female}, then construct the gender statement st sex :

[0052] st sex ="The user's gender is Sex u . "

[0053] Then, we collected information on users' posting behaviors that may be highly correlated with depression symptoms, including users' late-night posting behaviors, the proportion of original posts, and the proportion of posts containing images.

[0054] For the proportion of original posts, count the number of original posts in the user post set P, and then obtain the original post proportion rop by dividing the number of original posts by the total number of posts u ∈[0,100], and construct the original proportion statement st rop :

[0055] st rop ="The number of original posts of this user accounts for the percentage of the total number of posts u %. "

[0056] For the proportion of posts containing images, count the number of posts containing images in the user's post set P, and then obtain the original post ratio rim by dividing the number of posts containing images by the total number of posts u ∈[0,100], and construct the image proportion statement st rim :

[0057] st rim ="The number of posts containing images by this user accounts for the percentage of all posts u %. "

[0058] For the user's late-night posting behavior, count the number of late-night posts in the user's post set P that are posted in the preset time period of the night, and then obtain the late-night post ratio rln by dividing the number of late-night posts by the total number of posts. u ∈[0,100], and construct the late night proportion statement st rln :

[0059] st rln ="The number of posts posted by this user late at night accounts for the total number of posts u %. "

[0060] In order to obtain the semantic representation of the user's gender information and posting behavior information, the gender sentence st sex , original proportion statement st rop , image proportion statement st rim and late night proportion statement st rln The pre-trained text encoder is input for encoding, and then the output is average pooled and dimensionality reduced to obtain the user's gender representation. Original proportion Image ratio representation and late night ratio d p is the dimension after mapping.

[0061] Furthermore, a multi-feature adaptive weighting method is used to combine the post-level fusion representation and the user-level multi-feature representation to obtain the final user representation for predicting depression, specifically including:

[0062] First, the user's post-level fusion representation H pf 、Gender indication H sex , the original percentage indicates H rop , image ratio represents H rim and late night ratio indicates H rln Cascade along the first dimension to obtain user-level information representation d p is the dimension after mapping;

[0063] Next, the user-level information is represented by H u Calculate the self-attention score to obtain the contribution of multiple features to the current detection of the user's depressive tendency. The specific process is as follows:

[0064]

[0065] Among them, α i is the weight assigned to feature i; then the weights of each feature are multiplied by it to obtain the adaptively weighted user-level information representation

[0066] Finally, the adaptively weighted user-level information is represented by H awu Perform average pooling operation to obtain the user's final representation And H fin Inputting the softmax layer can obtain the depression state S of user u. The specific process is as follows:

[0067]

[0068] Furthermore, a multi-feature adaptive weighting method is used to combine the post-level fusion representation and the user-level multi-feature representation to obtain the final user representation for predicting depression, specifically including:

[0069] For model training, cross entropy with L2 regularization is used as the final loss function:

[0070]

[0071] Among them, S i and are the standard and predicted labels of the depression status of the i-th user, I is the size of the training dataset, λ is the regularization coefficient, and Θ represents all trainable model parameters.

[0072] According to a second aspect, an embodiment provides a depression detection model construction system that integrates cognitive distortions and user-level information, the system comprising:

[0073] A cognitive distortion learning module is used to train a cognitive distortion encoder for multi-granularity scene perception based on a cognitive distortion type prediction task and a scene comparison pre-training task;

[0074] A post-level information fusion module is used to obtain the post's contextual semantic representation and cognitive distortion representation through a text encoder and a cognitive distortion encoder, respectively, obtain an enhanced cognitive distortion representation based on a post-level distortion perception mechanism, and fuse the post's contextual semantic representation and the enhanced cognitive distortion representation to obtain a post-level fused representation;

[0075] The user-level information fusion module is used to count and encode the user's gender information and posting behavior information to obtain a user-level multi-feature representation. The multi-feature adaptive weighting method is used to combine the post-level fusion representation and the user-level multi-feature representation to obtain the final user representation for predicting depression.

[0076] The present invention provides a method for constructing a depression detection model that integrates cognitive distortion and user-level information, which has the following beneficial effects:

[0077] (1) A novel multi-granularity cognitive distortion learning method is proposed to train a multi-granularity scene-aware cognitive distortion encoder. This method learns comprehensive cognitive distortion information from a multi-granularity perspective through a cognitive distortion type prediction task and a scene comparison pre-training task. This allows the encoder to effectively capture the potential cognitive distortion information in user text. This is the first attempt to apply cognitive distortion information to depression detection.

[0078] (2) In order to make full use of cognitive distortion information, a novel post-level distortion perception mechanism is proposed. This mechanism identifies key cognitive distortion information related to users’ subjective cognition based on the overall semantics of the post.

[0079] (3) We extracted a variety of user information highly correlated with depression and proposed a multi-feature adaptive weighting method. This method can adaptively identify post-level fusion information and multiple user-level information that may be highly correlated with depression symptoms to reduce the noise caused by data irregularities. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] Figure 1 A flowchart of a method for constructing a depression detection model that integrates cognitive distortions and user-level information, provided by one embodiment of the present invention;

[0081] Figure 2 This is a diagram showing the overall architecture of a method for constructing a depression detection model that integrates cognitive distortions and user-level information, provided by one embodiment of the present invention;

[0082] Figure 3 A schematic diagram of the logical structure of a depression detection model construction system that integrates cognitive distortions and user-level information, provided by one embodiment of the present invention. DETAILED DESCRIPTION

[0083] The present invention will be further described in detail below by means of specific embodiments in conjunction with the accompanying drawings. Similar elements in different embodiments are numbered with associated similar elements. In the following embodiments, many detailed descriptions are provided to enable the present invention to be better understood. However, those skilled in the art will readily appreciate that some of the features may be omitted under different circumstances, or may be replaced by other elements, materials, or methods. In some cases, some operations related to the present invention are not shown or described in the specification. This is to avoid the core of the present invention being overwhelmed by excessive descriptions, and for those skilled in the art, it is not necessary to describe these related operations in detail. They can fully understand the related operations based on the description in the specification and the general technical knowledge in the art.

[0084] In addition, the features, operations, or characteristics described in the specification may be combined in any appropriate manner to form various embodiments. Furthermore, the steps or actions in the method description may be reordered or adjusted in a manner readily apparent to those skilled in the art. Therefore, the various sequences in the specification and drawings are provided solely for the purpose of clearly describing a particular embodiment and are not intended to be mandatory, unless otherwise specified.

[0085] like Figure 1As shown, the first embodiment of the present invention provides a method for constructing a depression detection model that integrates cognitive distortion and user-level information. Figure 1 and Figure 2 Provide detailed explanation.

[0086] Task definition: Given a post set P of user u = {p1,p2,…,p n} and personal information u , where post p i ={w1,w2,…,w m The goal of depression detection is to analyze the personal information I of user u u and post set P to detect the user's depression state S = {depression, normal}.

[0087] The overall architecture implemented by the method of this embodiment is as follows Figure 2 As shown in Figure 2, it consists of three modules: a cognitive distortion learning module, a post-level information fusion module, and a user-level information fusion module. First, the cognitive distortion learning module trains a text encoder using a multi-granularity cognitive distortion learning approach. This approach learns comprehensive cognitive distortion information from a multi-granularity perspective based on a cognitive distortion type prediction task and a scene contrast pre-training task. First, the encoder is trained using the cognitive distortion type prediction task, enabling it to learn the cognitive distortion types contained in different texts. Next, the scene contrast pre-training task uses different cognitive distortion types in the same scene to construct positive and negative examples. This allows the encoder to further train the encoder through contrastive learning, enabling it to learn fine-grained cognitive distortion representations. The multi-granularity scene-aware cognitive distortion encoder (MSCDE) trained using this method effectively captures the potential multi-granularity cognitive distortion information in user texts. Next, a post-level distortion-aware mechanism is proposed to identify key cognitive distortion information related to users' subjective cognition. This mechanism dynamically assigns higher weights to user-related cognitive distortion representations based on the overall semantics of the post, thereby identifying key cognitive distortion information related to users' subjective cognition. Specifically, the post-level information fusion module first uses a text encoder and MSCDE to obtain a contextual semantic representation and cognitive distortion representation of a post, respectively. This module then leverages a post-level distortion-aware mechanism to automatically assign higher weights to cognitive distortion representations associated with depression, thereby generating a post-level fused representation. The user-level information fusion module then collects and encodes user gender information and posting behavior. Finally, this module utilizes a multi-feature adaptive weighting method to combine the post-level fused representation with the user-level multi-feature representation to derive a final user representation for predicting depression.

[0088] like Figure 1As shown, in step S100, a multi-granularity scene-aware cognitive distortion encoder is trained based on a cognitive distortion type prediction task and a scene comparison pre-training task.

[0089] To better study the impact of cognitive distortions, we categorized them based on scenarios and human thinking, as shown in Table 1. Cognitive distortions can distort an individual's perception of reality and severely impact their thinking patterns. Furthermore, they are particularly pronounced in patients with depression. Therefore, using cognitive distortion information can help the model further identify a user's depressive tendencies. This embodiment proposes a novel multi-granular cognitive distortion learning method. This method includes a cognitive distortion type prediction task and a scenario comparison pre-training task.

[0090] Table 1. Different cognitive distortions and types in different scenarios. These samples are from the C2D2 dataset.

[0091]

[0092] The above steps specifically include:

[0093] 1) Cognitive distortion type prediction:

[0094] Specifically, for the cognitive distortion type prediction task, the scene text and the corresponding thinking text in each data in the C2D2 cognitive distortion dataset are concatenated as the input text st c , encode the input text using the encoder EC to be trained to obtain the contextual semantic representation H of the text cdt , and then input it into the softmax layer to get the cognitive distortion type of the text The specific process is expressed as:

[0095] H cdt =EC(st c )

[0096]

[0097] After training on the cognitive distortion type prediction task, the encoder EC learns the types of cognitive distortions contained in different texts.

[0098] Among them, the cross entropy with L2 regularization is used as the loss function for the cognitive distortion type prediction task:

[0099]

[0100] Among them, T i and are the standard and predicted labels of the cognitive distortion type of the i-th text, J is the size of the cognitive distortion dataset, λ is the regularization coefficient, and Θ represents all trainable model parameters.

[0101] 2) Scene comparison pre-training

[0102] To fully utilize the user's fine-grained cognitive distortion information, this embodiment proposes a scene-contrast pre-training method. This method uses contrastive learning to further train the encoder EC, which has been trained on cognitive distortion type tasks, to distinguish text with different cognitive distortion types within the same scene, thereby fully capturing fine-grained cognitive distortion information. This method specifically consists of the following two steps:

[0103] Step 1: Construct positive and negative samples based on scenarios. In order to obtain the samples required for contrastive learning, this embodiment constructs positive and negative sample pairs based on scenarios based on the C2D2 dataset. C2D2 is an artificially constructed Chinese cognitive distortion dataset, which contains 7,500 cognitively distorted thinking texts from 450 different scenarios. Each text belongs to one of 8 cognitive distortion labels (7 cognitive distortion types and one non-distortion type). First, this embodiment classifies the data by scenario type to construct a thinking text data set under the same scenario type. for This embodiment further classifies these data according to the type of cognitive distortion label to construct a collection of thought texts with the same label type. Note that not all datasets in every scenario satisfy the requirement of all eight labels. Therefore, in order to ensure the balance of data labels, this embodiment only selects scenario data that satisfies all eight labels. Next, this embodiment sequentially extracts data from the eight thought text sets to construct positive and negative example pairs. Specifically, this embodiment uses one label type as a positive example and selects a thought text from the thought text set of this label type as a learning sample mt l , and select another one as the positive sample mt of the learning sample po At the same time, a thought text is selected from each of the other 7 label types of thought text sets as a negative sample. Then, this embodiment forms a positive and negative sample group by combining the learning samples, positive samples and 7 negative samples obtained through the above steps. Finally, repeat the above steps for all scenario types of thought text data sets, and this embodiment can obtain a set of positive and negative sample pairs based on the scenario.

[0104] Step 2: Scene contrast pre-training. This embodiment uses scene contrast pre-training to train the encoder EC, so as to better capture the cognitive distortion information in the text. Specifically, for any positive and negative sample group In this embodiment, all the texts are input into the encoder EC to obtain their context representations for contrastive learning, which is expressed as Therefore, the contrast loss on the set of scene-based positive and negative example pairs is defined as:

[0105]

[0106] Among them (h l ,h po ) represents the contextual semantic representation of the learning sample and the positive sample, τ represents the temperature parameter, Indicates h l With h po Finally, after the above scene comparison pre-training, this embodiment can obtain a multi-granularity scene-aware cognitive distortion encoder MSCDE.

[0107] like Figure 1 As shown, in step S200, the contextual semantic representation and cognitive distortion representation of the post are obtained respectively by the text encoder and the cognitive distortion encoder, the enhanced cognitive distortion representation is obtained based on the post-level distortion perception mechanism, and the contextual semantic representation of the post and the enhanced cognitive distortion representation are fused to obtain the post-level fused representation.

[0108] The above steps specifically include:

[0109] In order to obtain the contextual semantic representation of all posts of a user, the post-level information fusion module inputs all posts into the pre-trained language model (PLM) for encoding. Specifically, for post p i , first input to the text encoder PLM and perform average pooling to get the post p i Contextual semantic representation of

[0110]

[0111] in d is the dimension;

[0112] By calculating and concatenating n posts in the post set P, we can get the contextual semantic representation of the post set P.

[0113] The n posts in the post set P are sequentially input into the multi-granularity scene-aware cognitive distortion encoder and average pooled, and then cascaded to obtain the cognitive distortion representation of the post set P:

[0114]

[0115] Due to the diversity of text in social media, its text types also include forwarded text and implicit text, which leads to the fact that some texts with cognitive distortion information are usually not fully expressed based on the user's subjective cognition. Therefore, in order to obtain key cognitive distortion information related to the user's subjective cognition, this embodiment proposes a post-level distortion perception mechanism. Specifically, since the contextual semantic representation H of the post set P is cs and cognitive distortions represent H cd is obtained by two different encoders, and they need to be mapped to the same semantic space for better calculation. Here, the context semantics is represented by H cs and cognitive distortions represent H cd Input the same fully connected layer for mapping operation respectively. The specific formula is as follows:

[0116]

[0117] Among them, W cd is the learnable weight, b cd is the bias vector, and d p is the dimension after mapping;

[0118] Based on a method similar to the self-attention mechanism, the comprehensive semantic representation of the post set P is calculated by the following formula to represent the user's global semantic information:

[0119]

[0120] where σ is the activation function, and The comprehensive cognitive distortion representation of each post is calculated using the following formula:

[0121]

[0122] in and

[0123] In order to capture the key cognitive distortion information related to the user's global semantics, the correlation between the cognitive distortion information of each post and the user's global semantics is calculated to obtain the importance weight of the cognitive distortion information of each post to the user's global semantics. The specific calculation process is as follows:

[0124]

[0125] Where ⊙ represents the Hadamard product operation,

[0126] Multiply the importance weight of each post calculated by the mapped cognitive distortion representation of each post to obtain the enhanced cognitive distortion representation H ecd , the specific calculation process is as follows:

[0127]

[0128] The mapped context semantics is represented by H cs and enhanced cognitive distortions indicate H ecd Perform concatenation and averaging to obtain the final post-level fusion representation:

[0129]

[0130] like Figure 1 As shown, in step S300, the user's gender information and posting behavior information are counted and encoded to obtain a user-level multi-feature representation, and the multi-feature adaptive weighting method is used to combine the post-level fusion representation and the user-level multi-feature representation to obtain the user's final representation for predicting depression.

[0131] The above steps specifically include:

[0132] 1) User-level information

[0133] Existing research has shown that diverse user information, such as gender and posting behavior, is effective for depression detection. However, most existing work focuses primarily on user post collections, overlooking this crucial user information. Therefore, this work focuses on the diverse and available user information that is highly relevant to depression. Specifically, to better align with post-level representations, we first collect statistics on various user information and construct corresponding information sentences to obtain a corresponding representation.

[0134] First, the personal information I of user u u Extract gender information Sex u ∈{male, female}, then construct the gender statement st sex :

[0135] st sex ="The user's gender is Sex u . "

[0136] We then collected information on users' posting behavior that may be highly correlated with depression symptoms, such as late-night posting, the proportion of original posts, and the proportion of posts containing images. This is because multiple studies have shown that compared to healthy users, depressed users are more likely to post late at night, their posts are more likely to be original, and most of them do not contain images.

[0137] For the proportion of original posts, count the number of original posts in the user post set P, and then obtain the original post proportion rop by dividing the number of original posts by the total number of posts u ∈[0,100], and construct the original proportion statement st rop :

[0138] st rop ="The number of original posts of this user accounts for the percentage of the total number of posts u %. "

[0139] For the proportion of posts containing images, count the number of posts containing images in the user's post set P, and then obtain the original post ratio rim by dividing the number of posts containing images by the total number of posts u ∈[0,100], and construct the image proportion statement st rim :

[0140] st rim ="The number of posts containing images by this user accounts for the percentage of all posts u %. "

[0141] For the user's late-night posting behavior, count the number of late-night posts in the user's post set P that are posted between 23:00 on the same day and 6:00 the next day, and then divide the number of late-night posts by the total number of posts to obtain the late-night post ratio rln u ∈[0,100], and construct the late night proportion statement st rln :

[0142] st rln ="The number of posts posted by this user late at night accounts for the total number of posts u %. "

[0143] In order to obtain the semantic representation of the user's gender information and posting behavior information, the gender sentence st sex , original proportion statement st rop , image proportion statement st rim and late night proportion statement st rln The pre-trained text encoder is input for encoding, and then the output is average pooled and dimensionality reduced to obtain the user's gender representation. Original proportion Image ratio representation and late night ratio d p is the dimension after mapping.

[0144] 2) Multi-feature adaptive weighting method

[0145] While some current work has recognized the importance of user information, most approaches to integrating this information involve directly fusing encoded features with other representations, which can introduce some noise. This is because social media data is diverse and irregular; not all depressed users display all behaviors and symptoms consistent with depression on social media. Therefore, this embodiment proposes a multi-feature adaptive weighting method. This method can capture key user information features related to depression and reduce the impact of noise introduced by data irregularities.

[0146] Specifically, firstly the user's post-level fusion representation H pf 、Gender indication H sex , the original percentage indicates H rop , image ratio represents H rim and late night ratio indicates H rln Cascade along the first dimension to obtain user-level information representation d p is the dimension after mapping;

[0147] Next, the user-level information is represented by H u Calculate the self-attention score to obtain the contribution of multiple features to the current detection of the user's depressive tendency. The specific process is as follows:

[0148]

[0149] Among them, α i is the weight assigned to feature i; then the weights of each feature are multiplied by it to obtain the adaptively weighted user-level information representation

[0150] Finally, the adaptively weighted user-level information is represented by H awu Perform average pooling operation to obtain the user's final representation And H fin Inputting the softmax layer can obtain the depression state S of user u. The specific process is as follows:

[0151]

[0152] For model training, cross entropy with L2 regularization is used as the final loss function:

[0153]

[0154] Among them, S i and are the standard and predicted labels of the depression status of the i-th user, I is the size of the training dataset, λ is the regularization coefficient, and Θ represents all trainable model parameters.

[0155] Test example:

[0156] In order to evaluate the performance of the method of this embodiment for detecting the depressive state of users, this embodiment conducts experiments on the SWDD dataset. To facilitate the experiment, the posts of users in the dataset are first rearranged in chronological order, and then two datasets SWDD-1 and SWDD-2 are constructed from the dataset with sizes of 3600 and 7400 respectively. During construction, the training set and test set are divided into 8:2 ratios, and the ratio of depressed users to normal users is kept at 1:1. In these datasets, each user's data contains the user's gender information and multiple published posts. In addition, the accuracy and macro-F1 indicators are used as evaluation indicators to evaluate the performance of DM-CDUI and other baseline models (BERT, BiLSTM, BiLSTM+Att, etc.).

[0157] For the post text, this embodiment uses the SpaCy parsing tool to perform syntactic parsing to obtain word segmentation and part of speech. In addition, this embodiment uses bert-chinese as the basic pre-training model for cognitive distortion learning. The contrastive learning temperature is 0.07. The DM-CDUI proposed in this embodiment is implemented using the Pytorch framework and trained on a Tesla V100. Its weight matrix is ​​initialized using Xavier and the Adam optimizer is used with a 1×10 -7 The training is performed with a learning rate of 2×10 -6 BERT is fine-tuned on SWDD with a learning rate of 1×10. The batch size is 2. Similarly, for cognitive distortion type prediction, this example uses the Adam optimizer for bert-chinese with a learning rate of 1×10 -6 For scene comparison pre-training, this embodiment trains the model trained on the cognitive distortion type prediction task at a learning rate of 1×10 -7 The training is performed at a learning rate of 50, with a training epoch of 50 and a batch size of 9. For the results of LLMs, this embodiment randomly samples 100 data from the test set and inputs them into LLMs for prediction.

[0158] After extensive experiments and analysis on public datasets, the results demonstrated the effectiveness and state-of-the-art performance of the depression detection model construction method proposed in this embodiment that integrates cognitive distortions and user-level information.

[0159] Corresponding to the above-disclosed method for constructing a depression detection model integrating cognitive distortion and user-level information, an embodiment of the present invention further discloses a system for constructing a depression detection model integrating cognitive distortion and user-level information, such as Figure 3 As shown, it specifically includes:

[0160] A cognitive distortion learning module is used to train a cognitive distortion encoder for multi-granularity scene perception based on a cognitive distortion type prediction task and a scene comparison pre-training task;

[0161] A post-level information fusion module is used to obtain the post's contextual semantic representation and cognitive distortion representation through a text encoder and a cognitive distortion encoder, respectively, obtain an enhanced cognitive distortion representation based on a post-level distortion perception mechanism, and fuse the post's contextual semantic representation and the enhanced cognitive distortion representation to obtain a post-level fused representation;

[0162] The user-level information fusion module is used to count and encode the user's gender information and posting behavior information to obtain a user-level multi-feature representation. The multi-feature adaptive weighting method is used to combine the post-level fusion representation and the user-level multi-feature representation to obtain the final user representation for predicting depression.

[0163] It should be noted that for a detailed description of a depression detection model construction system that integrates cognitive distortions and user-level information provided in an embodiment of the present invention, reference can be made to the relevant description of a depression detection model construction method that integrates cognitive distortions and user-level information provided in an embodiment of the present invention, which will not be repeated here.

[0164] In addition, an embodiment of the present invention also provides an electronic device, comprising: a processor and a memory; the memory is used to store one or more program instructions; the processor is used to run one or more program instructions to execute the steps of a method for constructing a depression detection model that integrates cognitive distortions and user-level information as described in any of the above items.

[0165] It should be noted that for a detailed description of an electronic device provided in an embodiment of the present invention, reference can be made to the relevant description of a method for constructing a depression detection model that integrates cognitive distortion and user-level information provided in an embodiment of the present application, which will not be repeated here.

[0166] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of a method for constructing a depression detection model that integrates cognitive distortions and user-level information as described in any of the above items are implemented.

[0167] It should be noted that for a detailed description of a computer-readable storage medium provided in an embodiment of the present invention, reference can be made to the relevant description of a method for constructing a depression detection model that integrates cognitive distortion and user-level information provided in an embodiment of the present application, which will not be repeated here.

[0168] Those skilled in the art will appreciate that all or part of the functions of the various methods in the above embodiments can be implemented by hardware or by computer program. When all or part of the functions in the above embodiments are implemented by computer program, the program can be stored in a computer-readable storage medium, and the storage medium can include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to implement the above functions. For example, the program is stored in the memory of the device, and when the program in the memory is executed by the processor, all or part of the above functions can be implemented. In addition, when all or part of the functions in the above embodiments are implemented by computer program, the program can also be stored in a storage medium such as a server, another computer, disk, optical disk, flash disk or mobile hard disk, and saved in the memory of the local device by downloading or copying, or the system of the local device is updated. When the program in the memory is executed by the processor, all or part of the functions in the above embodiments can be implemented.

[0169] The above examples are used to illustrate the present invention, which are only used to help understand the present invention and are not intended to limit the present invention. Those skilled in the art can make several simple deductions, modifications or substitutions based on the concept of the present invention.

Claims

1. A method for constructing a depression detection model that integrates cognitive distortions and user-level information, characterized in that: The method comprises: A cognitive distortion encoder for multi-granularity scene perception was trained based on a cognitive distortion type prediction task and a scene comparison pre-training task. The contextual semantic representation and cognitive distortion representation of the post are obtained through the text encoder and cognitive distortion encoder respectively. The enhanced cognitive distortion representation is obtained based on the post-level distortion perception mechanism. The contextual semantic representation and the enhanced cognitive distortion representation are fused to obtain the post-level fused representation. The user's gender information and posting behavior information are counted and encoded to obtain a user-level multi-feature representation. The multi-feature adaptive weighting method is used to combine the post-level fusion representation and the user-level multi-feature representation to obtain the final user representation for predicting depression.

2. The method for constructing a depression detection model integrating cognitive distortion and user-level information according to claim 1, characterized in that: Based on the cognitive distortion type prediction task and the scene comparison pre-training task, a multi-granularity scene-aware cognitive distortion encoder is trained, specifically including: The scene text and the corresponding thought text in each data in the cognitive distortion dataset are spliced ​​as the input text st c , encode the input text using the encoder to be trained to obtain the contextual semantic representation H of the text cdt , and then input it into the softmax layer to get the cognitive distortion type of the text The specific process is expressed as: H cdt =EC(st c ) After training on the cognitive distortion type prediction task, the encoder learned the types of cognitive distortions contained in different texts.

3. The method for constructing a depression detection model integrating cognitive distortion and user-level information according to claim 2, characterized in that: Based on the cognitive distortion type prediction task and the scene comparison pre-training task, a multi-granularity scene-aware cognitive distortion encoder is trained, specifically including: The cross entropy with L2 regularization is used as the loss function for the cognitive distortion type prediction task: Among them, T i and are the standard and predicted labels of the cognitive distortion type of the i-th text, J is the size of the cognitive distortion dataset, λ is the regularization coefficient, and Θ represents all trainable model parameters.

4. The method for constructing a depression detection model integrating cognitive distortion and user-level information according to claim 2, wherein: Based on the cognitive distortion type prediction task and the scene comparison pre-training task, a multi-granularity scene-aware cognitive distortion encoder is trained, specifically including: The encoder trained on the cognitive distortion type prediction task is further trained through contrastive learning to distinguish texts with different cognitive distortion types in the same scenario, thereby fully capturing fine-grained cognitive distortion information. First, build a scene-based positive and negative sample pair set based on the cognitive distortion dataset Positive and negative sample groups Contains learning samples mt l , positive sample mt po And negative samples For any positive and negative sample group All the texts in it are input into the encoder trained on the cognitive distortion type prediction task to obtain the contextual representation of the text for contrastive learning, which is expressed as d is the dimension; The contrast loss on the set of scene-based positive and negative example pairs is defined as: Among them (h l ,h po ) represents the contextual semantic representation of the learning sample and the positive sample, τ represents the temperature parameter, Indicates h l With h po Most similar possibility; After scene contrast pre-training, a cognitive distortion encoder for multi-granularity scene perception is obtained.

5. The method for constructing a depression detection model integrating cognitive distortion and user-level information according to claim 1, wherein: The contextual semantic representation and cognitive distortion representation of the post are obtained through the text encoder and cognitive distortion encoder respectively, including: For post p i , first input to the text encoder and perform average pooling to get the post p i Contextual semantic representation of in d is the dimension; By calculating and concatenating n posts in the post set P, we can get the contextual semantic representation of the post set P. The n posts in the post set P are sequentially input into the multi-granularity scene-aware cognitive distortion encoder and average pooled, and then cascaded to obtain the cognitive distortion representation of the post set P:

6. The method for constructing a depression detection model integrating cognitive distortion and user-level information according to claim 5, characterized in that: The enhanced cognitive distortion representation based on the post-level distortion perception mechanism includes: The context semantics is represented by H cs and cognitive distortions represent H cd Input the same fully connected layer for mapping operation respectively. The specific formula is as follows: Among them, W cd is the learnable weight, b cd is the bias vector, and d p is the dimension after mapping; Based on the self-attention mechanism, the comprehensive semantic representation of the post set P is calculated by the following formula to represent the user's global semantic information: where σ is the activation function, and The comprehensive cognitive distortion representation of each post is calculated using the following formula: in and In order to capture the key cognitive distortion information related to the user's global semantics, the correlation between the cognitive distortion information of each post and the user's global semantics is calculated to obtain the importance weight of the cognitive distortion information of each post to the user's global semantics. The specific calculation process is as follows: Where ⊙ represents the Hadamard product operation, Multiply the importance weight of each post calculated by the mapped cognitive distortion representation of each post to obtain the enhanced cognitive distortion representation H ecd , the specific calculation process is as follows:

7. The method for constructing a depression detection model integrating cognitive distortion and user-level information according to claim 6, characterized in that: The contextual semantic representation of the post and the enhanced cognitive distortion representation are fused to obtain the post-level fused representation, which specifically includes: The mapped context semantics is represented by H cs and enhanced cognitive distortions indicate H ecd Perform concatenation and averaging to obtain the final post-level fusion representation:

8. The method for constructing a depression detection model integrating cognitive distortion and user-level information according to claim 1, wherein: The user's gender information and posting behavior information are counted and encoded to obtain a user-level multi-feature representation, including: Collect statistics on various user information and construct corresponding information sentences to obtain corresponding representations; First, the personal information I of user u u Extract gender information Sex u ∈{male, female}, then construct the gender statement st sex : st sex ="The user's gender is Sex u . " Then, we collected information on users' posting behaviors that may be highly correlated with depression symptoms, including users' late-night posting behaviors, the proportion of original posts, and the proportion of posts containing images. For the proportion of original posts, count the number of original posts in the user post set P, and then obtain the original post proportion rop by dividing the number of original posts by the total number of posts u ∈[0,100], and construct the original proportion statement st rop : st rop ="The number of original posts of this user accounts for the percentage of the total number of posts u %. " For the proportion of posts containing images, count the number of posts containing images in the user's post set P, and then obtain the original post ratio rim by dividing the number of posts containing images by the total number of posts u ∈[0,100], and construct the image proportion statement st rim : st rim ="The number of posts containing images by this user accounts for the percentage of all posts u %. " For the user's late-night posting behavior, count the number of late-night posts in the user's post set P that are posted in the preset time period of the night, and then obtain the late-night post ratio rln by dividing the number of late-night posts by the total number of posts. u ∈[0,100], and construct the late night proportion statement st rln : st rln ="The number of posts posted by this user late at night accounts for the total number of posts u %. " In order to obtain the semantic representation of the user's gender information and posting behavior information, the gender sentence st sex , original proportion statement st rop , image proportion statement st rim and late night proportion statement st rln The pre-trained text encoder is input for encoding, and then the output is average pooled and dimensionality reduced to obtain the user's gender representation. Original proportion Image ratio representation and late night ratio d p is the dimension after mapping.

9. The method for constructing a depression detection model integrating cognitive distortion and user-level information according to claim 7, wherein: The final user representation is obtained by combining the post-level fusion representation and the user-level multi-feature representation using a multi-feature adaptive weighting method to predict depression. Specifically, the following are included: First, the user's post-level fusion representation H pf 、Gender indication H sex , the original proportion indicates H rop , image ratio represents H rim and late night ratio indicates H rln Cascade along the first dimension to obtain user-level information representation d p is the dimension after mapping; Next, the user-level information is represented by H u Calculate the self-attention score to obtain the contribution of multiple features to the current detection of the user's depressive tendency. The specific process is as follows: Among them, α i is the weight assigned to feature i; then the weights of each feature are multiplied by it to obtain the adaptively weighted user-level information representation Finally, the adaptively weighted user-level information is represented by H awu Perform average pooling operation to obtain the user's final representation And H fin Inputting the softmax layer can obtain the depression state S of user u. The specific process is as follows: H fin =AveragePooling(H awu ) 10. The method for constructing a depression detection model integrating cognitive distortion and user-level information according to claim 9, characterized in that: The final user representation is obtained by combining the post-level fusion representation and the user-level multi-feature representation using a multi-feature adaptive weighting method to predict depression. Specifically, the following are included: For model training, cross entropy with L2 regularization is used as the final loss function: Among them, S i and are the standard and predicted labels of the depression status of the i-th user, I is the size of the training dataset, λ is the regularization coefficient, and Θ represents all trainable model parameters.