A method for detecting depression tendency of social users based on heterogeneous graph attention network

Through the detection method of social users' depression tendency based on the heterogeneous graph attention network, the problem of large-sample mental health status detection in the existing technology is solved, and more accurate mental status judgment and online detection of depression are achieved. Through the heterogeneous graph neural network Process social network data, reduce information interference and improve detection efficiency.

CN114628008BActive Publication Date: 2024-09-20GUANGDONG UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210281309.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-22
Publication Date
2024-09-20
Estimated Expiration
2042-03-22

AI Technical Summary

Technical Problem

Existing technology is difficult to effectively detect and track mental health status in large samples. Traditional diagnostic methods require face-to-face communication, which limits the possibility of identifying potential patients. Social media data analysis is not mature enough in mental health diagnosis.

Method used

A method for detecting depression tendency of social users based on heterogeneous graph attention network is adopted. By collecting social network data, a heterogeneous information network is constructed to perform entity linking, entity embedding and feature extraction, using heterogeneous graph convolution and double-layer attention mechanism. , construct a heterogeneous graph neural network for training and testing, and predict whether the user has depression tendencies.

Benefits of technology

It effectively reduces information interference, improves model efficiency and accuracy, captures the importance of different types of nodes, and achieves more accurate mental state judgment. For the first time, heterogeneous graph neural networks are applied to online detection of depression.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114628008B
    Figure CN114628008B
Patent Text Reader

Abstract

The present invention discloses a method for detecting depression tendency of social users based on heterogeneous graph attention network, including the following steps: collecting data on user social network platform, performing text summarization for short text of user generated content, and performing statistical calculation for user behavior data and user portrait data; constructing a flexible heterogeneous information network framework to model short text, user behavior data and user portrait data, performing entity linking, entity embedding and feature extraction for processed short text, and performing topic analysis on features; using heterogeneous graph convolution for the heterogeneity of different types of information; establishing a double-layer attention mechanism based on type level and node level for the importance of different adjacent nodes and the importance of different node types to specific nodes; constructing a heterogeneous graph neural network based on attention mechanism, training and testing the network, predicting labels, thereby completing the classification task of judging whether the user has depression tendency. The present invention can model social media data into heterogeneous graph structure in combination with multiple information dimensions, and construct heterogeneous graph attention network for semi-supervised classification, judging whether the user has depression tendency, which is conducive to helping improve the effectiveness of diagnosis, thereby assisting clinical diagnosis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of natural language processing and graph neural networks, and in particular to a method for detecting depression tendency of social users based on heterogeneous graph attention networks. Background Art

[0002] Currently, there are about 300 million people suffering from depression in the world, and the number of people suffering from mental health problems such as depression and stress is getting younger and younger. Mental health not only affects a person's ability to live, work, and learn, but is also a major factor in global burden and public health. Traditional mental health diagnosis and treatment methods require face-to-face communication with doctors. This contact method limits the possibility of identifying potential patients. And given the economic level, lack of resources, social discrimination, privacy protection and other issues, even if you realize that you may have a mental health disease, you will not go to the hospital or clinic for identification. Therefore, previous studies often find it difficult to detect and track people's psychological or mental states in large sample situations.

[0003] The prosperity of social networks has enabled massive amounts of social media data to capture people's true thoughts, emotions, communications, and other information, which have become very important in public health monitoring. Although, like traditional diagnostic methods, not everyone will post information on social networks, non-contact detection methods based on social media data analysis can provide new resources and perspectives for mental health diagnosis. Compared with traditional diagnostic methods such as physiological indicators and psychological tests, social network analysis started late, so the method of using social media data for mental health diagnosis is not mature enough and has not yet been used as a clinical diagnosis standard. However, effective models can detect potential mental states earlier, assist mental health experts in conducting more thorough assessments of depression and other mental health diseases, and provide support for treatment. Therefore, social media data can be used as an auxiliary resource and research object in the field of psychology.

[0004] In summary, the research on the method of detecting depression tendency of social users based on heterogeneous graph attention network not only helps to improve the intelligent processing capabilities in application fields such as diagnosis and treatment of mental health, intervention and construction of public health, but also provides important theoretical methods for the research of related tasks such as social network analysis and graph models. In view of the new characteristics of social network data, we grasp the key mental health problem of depression, construct social media data into heterogeneous graph structure, conduct diagnosis research on mental health, and study the detection of depression tendency of social users based on heterogeneous graph attention network, which has important theoretical significance and application value. Summary of the invention

[0005] The purpose of the present invention is to overcome the shortcomings and deficiencies in the prior art and provide a method for detecting depression tendency of social users based on heterogeneous graph attention network, which can effectively determine whether social users have depression tendency.

[0006] To achieve the above objectives, the present invention adopts the following technical solutions:

[0007] A method for detecting depression tendency of social users based on heterogeneous graph attention network includes the following steps:

[0008] S1. Collect data on user social network platforms, perform text summarization on short texts of user-generated content, and perform statistical calculations on user behavior data and user portrait data;

[0009] S2. Build a flexible heterogeneous information network framework to model short texts, user behavior data, and user portrait data, perform entity linking, entity embedding, and feature extraction on the processed short texts, and perform topic analysis on the features;

[0010] S3. For the heterogeneity of different types of information, use heterogeneous graph convolution;

[0011] S4. For the importance of different adjacent nodes and the importance of different node types to specific nodes, a two-layer attention mechanism based on type level and node level is established;

[0012] S5. Build a heterogeneous graph neural network based on the attention mechanism, train and test the network, predict labels, and thus complete the classification task of determining whether the user has a tendency to depression.

[0013] As a preferred technical solution, in step S1, the text summarization of user-generated content refers to the use of the Bert model for text embedding and Kmeans clustering to identify sentences close to the centroid for automatic summary selection for a large amount of text data sent by users on social networking platforms. The purpose is to automatically filter out important sentences from a large amount of social texts of users, which can better solve the problems of information fragmentation and useless information interference, and improve the efficiency and accuracy of the model.

[0014] As a preferred technical solution, in step S1, the statistical calculation of user behavior data refers to the statistical calculation of the time when users send information on the social platform to form a sending time distribution. These statistical information may distinguish the depression state of the user and help to judge the psychological state of the user. The prepared functions are used for collection and calculation and used as heterogeneous graph node information.

[0015] As a preferred technical solution, in step S1, the statistical calculation of the user portrait data refers to the statistical calculation of the proportion of positive and negative expressions used by users, the statistical calculation of the proportion of positive and negative words used by users, the statistical calculation of the proportion of first-person singular and plural forms used by users, the statistical calculation of the number of followers and the number of followers of user accounts, etc., to construct a user portrait. These statistical information may distinguish the depression state of the user, which is helpful for judging the psychological state of the user. The user portrait is collected and calculated using the prepared function and used as the node information of the heterogeneous graph.

[0016] As a preferred technical solution, the specific process of step S2 is:

[0017] S21. In order to solve the semantic sparsity problem of short texts, we use a flexible heterogeneous information network (HIN) framework to model short texts, which can integrate any type of additional information and capture the relationship between them to enrich the semantics of short texts. For additional information, in addition to topics and entities, we also use the user behavior data and user portrait data calculated in step S1, such as the distribution of sending time, statistics on the proportion of positive and negative words used by users, etc. Construct a graph G = (V, ε), where V and ε are node sets and edge sets respectively. The node set includes the short text set D = {d 1 ,...,d m}, topic set T = {t 1 ,...,t k}, entity set E = {e 1 ,...,e n}、Sending time distribution set C={c 1 ,...,c p}、Vocabulary proportion set W={w 1 ,…,w q}, that is, V = D∪T∪E∪C∪W. The edge set ε represents the relationship between them.

[0018] S22. Use the document topic generation model Latent Dirichlet Allocation to identify the topic information hidden in the short text and mine the implicit topics to enrich the semantics of the short text. Calculate the word frequency, each topic t i =(θ 1 ,...,θ w )(w represents the vocabulary size) is represented by the probability distribution of words, and the first P topics with the highest probability are assigned to each document. If there is an assignment relationship between documents and topics, the "document-topic" edge is established;

[0019] S23, perform entity linking on short texts. Identify entities E in document D and map them to Wikipedia using the entity linking tool TAGME. If the document contains entities, a “document-entity” edge is established;

[0020] S24, perform entity embedding on short texts. Treat an entity as a complete word and use word2vec2 based on the Wikipedia corpus to learn entity embedding. In order to further enrich the semantics of short texts and promote information dissemination, the relationship between entities is considered. If the similarity score (cosine similarity) between two entities calculated based on embedding is higher than the predefined threshold δ, the "entity-entity" edge is established.

[0021] S25. Establish edges related to user behavior data and user portrait data. For example, each time distribution corresponds to each user, each vocabulary ratio corresponds to each user, etc. Establish "time distribution-document" edge, establish "vocabulary ratio-document" edge, etc.

[0022] S26. Use word frequency and inverse document frequency (TF-IDF) as features, delete entities without features, delete some edges, and delete isolated points. Generate files of edges and features (document nodes, entity nodes, topic nodes, user behavior data nodes, and user portrait data nodes) respectively, and save the map index information file at the same time to be input into network training.

[0023] As a preferred technical solution, the specific process of step S3 is:

[0024] S31. Use TF-IDF (Term Frequency-Inverse Document Frequency) to evaluate the importance of a certain word of a user to a social text sent by the user. The more times a word appears in a social text sent by the user, and the fewer times it appears in all social texts, the more representative it is of the social text. TF is expressed as follows

[0025]

[0026] Among them, n i,j Indicates the term t i In the document d j The number of occurrences in TF i,j It means the term t i In the document d j The frequency of occurrence in . IDF is expressed as follows

[0027]

[0028] where |D| represents the number of all documents, |j:t i ∈d j | indicates that the term t is included i The number of documents. TF-IDF is expressed as

[0029] TF-IDF=TF·IDF (3)

[0030] S32. For the heterogeneity of different types of information, heterogeneous graph convolution is used. In HIN, we have five types of nodes: documents, topics, entities, user behavior data, and user portrait data, which have different feature spaces. For a document d∈D, we use the TF-IDF vector as its feature vector x d For a topic t∈T, the word distribution x i =(θ 1 , ..., θ w ) is used to represent the topic feature vector. For each entity, in order to make full use of relevant information, we concatenate its word vector embedding and the TF-IDF vector of its Wikipedia text to represent the entity feature vector x v Using the heterogeneous graph convolution method, we consider the differences between different types of information and project them into a transformation matrix W using their respective transformation matrices; we consider the differences between different feature spaces and project them into an implicit common space. The update formula for the node is

[0031]

[0032] in yes Submatrix of, adjacency matrix Contains self-connections, its rows represent all nodes, and its columns represent the node's τ-type neighbors. τ represents the node type (document, entity, topic, user behavior data, user portrait data). The node representation H (l+1) By using the transformation matrix of each type τ Embedding of nodes under each type of τ Aggregation is obtained. The transformation matrix W considers the differences in different feature spaces and projects them into the common space R q(l+1) Initialization

[0033] As a preferred technical solution, the specific process of step S4 is:

[0034] S41. Type level attention can learn the weights of neighbor nodes of different types and fuse the representations of nodes under multiple relationships. Given a specific node v, the embedding of type τ is represented as the sum of the features of neighbor nodes of type τ, as shown in the following formula:

[0035]

[0036] S42, embedding h based on the current node v v and h τ , embed τ to calculate the type-level attention score, and obtain the attention score a of node v on the type τ domain τ As shown below:

[0037]

[0038] Where || represents connection, μ τ is the attention vector (parameter) of type τ, which is shared by all nodes. σ(·) represents the activation function, such as LeakyReLU.

[0039] S43. Normalize the attention scores on all types through the softmax function to obtain the type-level attention weight, as shown in the following formula:

[0040]

[0041] S44. Node level attention can capture the importance of different neighbor nodes and learn the representation of nodes through weighted aggregation. Given a specific node v of type τ, and its neighbors of type τ′ First, the representations of node v and its neighbor v′ are concatenated, and then converted into attention scores through a single-layer MLP and attention vector. v and h v′ and the type-level attention score α τ′ , calculate node v about The node-level attention score b vv′ , as shown below:

[0042]

[0043] Where v is the attention vector (parameter).

[0044] S45. The attention score b vv′ The attention weight β is obtained by normalizing the softmax function vv′ .

[0045]

[0046] S46. Aggregate neighbors based on the learned attention weights. Compared with equation (4), equation (10) Replaced with Based on the two-layer attention mechanism, the weight of noisy neighbors will be lower and the weight of relatively important neighbors will be higher, so that the importance of different neighboring nodes and the importance of different node (information) types to a specific node are taken into account. The node type forms a matrix of the attention weights of the node and its corresponding neighboring points The node update formula is:

[0047]

[0048] in Represents the attention matrix, whose elements are β vv′ , β i,j Indicates v i With v j The attention weight between .

[0049] As a preferred technical solution, the specific process of step S5 is:

[0050] S51. Based on the above two-level attention mechanism at the node level and type level, a heterogeneous graph attention network (HGAT) model is constructed to embed HIN for short text classification. HGAT considers the heterogeneity of different types of information through heterogeneous graph convolution. At the same time, the attention mechanism can capture the importance of different neighbor nodes, reduce noise information, and capture the importance of different types of nodes, so as to better realize information aggregation and make the representation of learned short text more accurate. The HGAT class contains the First Layer and the Second Layer, which correspond to the two layers of attention mechanism respectively, and the Output Layer corresponds to the softmax output layer.

[0051] S52, extract the node (short text) representation of the last layer and train it through cross entropy. HGAT is a semi-supervised algorithm, and the loss here is also calculated on a small amount of labeled data.

[0052] Z=softmax(H (L) ) (11)

[0053] The cross entropy loss is

[0054]

[0055] Where C is the number of categories, D train is the short text index set, θ is the model parameter. Finally, the label of the document is predicted through the softmax layer.

[0056] The present invention has the following advantages and effects compared with the prior art:

[0057] 1. The method of the present invention can better solve the problems of information fragmentation and useless information interference in the data processing stage. The amount of content data posted by users on social platforms is huge and the topics are scattered. Users do not always post information related to emotions, but also post other information such as work, study, stars, shopping, weather, etc., which has no effect or has a negative effect on judging the state of depression. We performed automatic text summarization on it and screened out important sentences from a large amount of social texts of users. Compared with not performing text summarization, the accuracy of automatic text summarization has been significantly improved, and the processing time is shorter. It can be seen that this method effectively reduces information interference and improves model efficiency and accuracy.

[0058] 2. The method of the present invention constructs a flexible heterogeneous information network structure to process social short text content. The framework can integrate information such as entities, topics, documents, user behavior data, user portrait data, and capture the relationship between them. It can solve the problem of semantic sparsity, reduce noise, and enrich the semantics of short texts.

[0059] 3. The method of the present invention mines a variety of information in social networks that may reflect the user's depressive state. In addition to the text posted by the user on social media, this information also includes a number of important statistical information related to the user, such as the time distribution statistics of the user sending information, the statistics of the proportion of positive and negative expressions used by the user, the statistics of the proportion of positive and negative vocabulary used by the user, the statistics of the proportion of the first-person singular and plural used by the user, and the statistics of the number of followers and followers of the user account. These texts and statistical information can be data for a certain user within 14 days or a month. In this way, we have rich information to reflect the user's psychological state, and select part of the data to be integrated into the information of the heterogeneous graph to capture the influence or weight of the information, thereby improving the accuracy of the model judgment.

[0060] 4. The method of the present invention considers the heterogeneity of different types of information through heterogeneous graph convolution. At the same time, the attention mechanism can capture the importance of different neighbor nodes, reduce noise information, and capture the importance of different types of nodes, so as to better realize information aggregation and make the representation of learned short text more accurate. Prior to this, semi-supervised text classification research in the field of depression detection has not been able to capture important information through the attention mechanism.

[0061] 5. The method of the present invention is the first to apply heterogeneous graph neural networks to online detection research on depression. Social network data such as Twitter and Weibo belong to typical heterogeneous graph structures, including different node types such as users and tweets, and different edge types such as user-user, user-tweet, and tweet-tweet. Therefore, in the online detection research of depression, heterogeneous graphs are more suitable for modeling social network data. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0063] Figure 1 It is a flow chart of the method for detecting depression tendency of social users based on heterogeneous graph attention network of the present invention;

[0064] Figure 2 The present invention is a flowchart of the Twitter social user depression tendency detection event based on the heterogeneous graph attention network. DETAILED DESCRIPTION

[0065] The present invention will be described in further detail below in conjunction with the accompanying drawings and specific embodiments. The following embodiments are used to illustrate the present invention but are not intended to limit the scope of the present invention.

[0066] Example

[0067] like Figure 1 and Figure 2 As shown, a method for detecting depression tendency of social users based on heterogeneous graph attention network includes the following steps:

[0068] S1. Collect data on user social network platforms, perform text summarization on short texts of user-generated content, and perform statistical calculations on user behavior data and user portrait data;

[0069] The text summarization of user-generated content refers to the use of the Bert model for text embedding and Kmeans clustering to identify sentences close to the centroid for automatic summary selection when users send a large amount of text data on social networking platforms. The purpose is to automatically filter out important sentences from a large amount of social texts of users, which can better solve the problems of information fragmentation and useless information interference, and improve the efficiency and accuracy of the model;

[0070] The statistical calculation of user behavior data refers to the statistical calculation of the time when users send information on social platforms to form the distribution of sending time. These statistical information may distinguish the depression state of users and help to judge the psychological state of users. The prepared functions are used for collection and calculation and used as heterogeneous graph node information;

[0071] The statistical calculation of user portrait data refers to the statistical calculation of the proportion of positive and negative expressions used by users, the proportion of positive and negative words used by users, the proportion of first-person singular and plural forms used by users, the number of followers and the number of followers of user accounts, etc., to construct user portraits. These statistical information may distinguish the depression state of users and are helpful for judging the psychological state of users. They are collected and calculated using the prepared functions and used as heterogeneous graph node information.

[0072] S2. Build a flexible heterogeneous information network framework to model short texts, user behavior data, and user portrait data, perform entity linking, entity embedding, and feature extraction on the processed short texts, and perform topic analysis on the features; specifically, the following steps are included:

[0073] S21. In order to solve the semantic sparsity problem of short texts, we use a flexible heterogeneous information network (HIN) framework to model short texts, which can integrate any type of additional information and capture the relationship between them to enrich the semantics of short texts. For additional information, in addition to topics and entities, we also use the user behavior data and user portrait data calculated in step S1, such as the distribution of sending time, statistics on the proportion of positive and negative words used by users, etc. Construct a graph G = (V, ε), where V and ε are node sets and edge sets respectively. The node set includes the short text set D = {d 1 , ..., d m}, topic set T = {t 1 , ..., t k}, entity set E = {e 1 , ..., e n}、Sending time distribution set C={c 1 , ..., c p}、Vocabulary proportion set W={w 1 , ..., w q}, that is, V = D∪T∪E∪C∪W. The edge set ε represents the relationship between them.

[0074] S22. Use the document topic generation model Latent Dirichlet Allocation to identify the topic information hidden in the short text and mine the implicit topics to enrich the semantics of the short text. Calculate the word frequency, each topic t i =(θ 1 , ..., θ w )(w represents the vocabulary size) is represented by the probability distribution of words, and the first P topics with the highest probability are assigned to each document. If there is an assignment relationship between documents and topics, the "document-topic" edge is established;

[0075] S23, perform entity linking on short texts. Identify entities E in document D and map them to Wikipedia using the entity linking tool TAGME. If the document contains entities, a “document-entity” edge is established;

[0076] S24, perform entity embedding on short texts. Treat an entity as a complete word and use word2vec2 based on the Wikipedia corpus to learn entity embedding. In order to further enrich the semantics of short texts and promote information dissemination, the relationship between entities is considered. If the similarity score (cosine similarity) between two entities calculated based on embedding is higher than the predefined threshold δ, the "entity-entity" edge is established.

[0077] S25. Establish edges related to user behavior data and user portrait data. For example, each time distribution corresponds to each user, each vocabulary ratio corresponds to each user, etc. Establish "time distribution-document" edge, establish "vocabulary ratio-document" edge, etc.

[0078] S26. Use word frequency and inverse document frequency (TF-IDF) as features, delete entities without features, delete some edges, and delete isolated points. Generate files of edges and features (document nodes, entity nodes, topic nodes, user behavior data nodes, and user portrait data nodes) respectively, and save the map index information file at the same time to be input into network training.

[0079] S3. For the heterogeneity of different types of information, heterogeneous graph convolution is used; specifically, the following steps are included:

[0080] S31. Use TF-IDF (Term Frequency-Inverse Document Frequency) to evaluate the importance of a certain word of a user to a social text sent by the user. The more times a word appears in a social text sent by the user, and the fewer times it appears in all social texts, the more representative it is of the social text. TF is expressed as follows

[0081]

[0082] Among them, n i,j Indicates the term t i In the document d j The number of occurrences in TF i,j It means the term t i In the document d j The frequency of occurrence in the IDF is expressed as follows:

[0083]

[0084] where |D| represents the number of all documents, |j:t i ∈d j | indicates that the term t is included i The number of documents. TF-IDF is expressed as

[0085] TF-IDF=TF.IDF (3)

[0086] S32. For the heterogeneity of different types of information, heterogeneous graph convolution is used. In HIN, we have five types of nodes: documents, topics, entities, user behavior data, and user portrait data, which have different feature spaces. For a document d∈D, we use the TF-IDF vector as its feature vector x d For a topic t∈T, the word distribution x i =(θ 1 , ..., θ w ) is used to represent the topic feature vector. For each entity, in order to make full use of relevant information, we concatenate its word vector embedding and the TF-IDF vector of its Wikipedia text to represent the entity feature vector x v Using the heterogeneous graph convolution method, we consider the differences between different types of information and project them into a transformation matrix W using their respective transformation matrices; we consider the differences between different feature spaces and project them into an implicit common space. The update formula for the node is

[0087]

[0088] in yes Submatrix of, adjacency matrix Contains self-connections, its rows represent all nodes, and its columns represent the node's τ-type neighbors. τ represents the node type (document, entity, topic, user behavior data, user portrait data). The node representation H (l+1) By using the transformation matrix of each type τ Embedding of nodes under each type of τ Aggregation is obtained. The transformation matrix W considers the differences in different feature spaces and projects them into the common space R q(l+1) Initialization

[0089] S4. For the importance of different adjacent nodes and the importance of different node types to a specific node, a two-layer attention mechanism based on type level and node level is established; specifically, the following steps are included:

[0090] S41. Type level attention can learn the weights of neighbor nodes of different types and fuse the representations of nodes under multiple relationships. Given a specific node v, the embedding of type τ is represented as the sum of the features of neighbor nodes of type τ, as shown in the following formula:

[0091]

[0092] S42, embedding h based on the current node v v and h τ , embed τ to calculate the type-level attention score, and obtain the attention score a of node v on the type τ domain τ As shown below:

[0093]

[0094] Where || represents connection, μ τ is the attention vector (parameter) of type τ, which is shared by all nodes. σ(·) represents the activation function, such as LeakyReLU.

[0095] S43. Normalize the attention scores on all types through the softmax function to obtain the type-level attention weight, as shown in the following formula:

[0096]

[0097] S44. Node level attention can capture the importance of different neighbor nodes and learn the representation of nodes through weighted aggregation. Given a specific node v of type τ, and its neighbors of type τ′ First, the representations of node v and its neighbor v′ are concatenated, and then converted into attention scores through a single-layer MLP and attention vector. v and h v′ and the type-level attention score α τ′ , calculate node v about The node-level attention score b vv′ , as shown below:

[0098] b vv′ =σ(v T α τ′ [h v ||h v′ ] (8)

[0099] Where v is the attention vector (parameter).

[0100] S45. The attention score b vv′The attention weight β is obtained by normalizing the softmax function vv′ .

[0101]

[0102] S46. Aggregate neighbors based on the learned attention weights. Compared with equation (4), equation (10) Replaced with Based on the two-layer attention mechanism, the weight of noisy neighbors will be lower and the weight of relatively important neighbors will be higher, so that the importance of different neighboring nodes and the importance of different node (information) types to a specific node are taken into account. The node type forms a matrix of the attention weights of the node and its corresponding neighboring points The node update formula is:

[0103]

[0104] in Represents the attention matrix, whose elements are β vv′ , β i,j Indicates v i With v j The attention weight between .

[0105] S5. Construct a heterogeneous graph neural network based on the attention mechanism, train and test the network, predict labels, and complete the classification task of determining whether the user has a tendency to depression. Specifically, the following steps are included:

[0106] S51. Based on the above two-level attention mechanism at the node level and type level, a heterogeneous graph attention network (HGAT) model is constructed to embed HIN for short text classification. HGAT considers the heterogeneity of different types of information through heterogeneous graph convolution. At the same time, the attention mechanism can capture the importance of different neighbor nodes, reduce noise information, and capture the importance of different types of nodes, so as to better realize information aggregation and make the representation of learned short text more accurate. The HGAT class contains the First Layer and the Second Layer, which correspond to the two layers of attention mechanism respectively, and the Output Layer corresponds to the softmax output layer.

[0107] S52, extract the node (short text) representation of the last layer and train it through cross entropy. HGAT is a semi-supervised algorithm, and the loss here is also calculated on a small amount of labeled data.

[0108] Z = softmax(H (L) ) (11)

[0109] The cross entropy loss is

[0110]

[0111] Where C is the number of categories, D train is the short text index set, θ is the model parameter. Finally, the label of the document is predicted through the softmax layer.

[0112] The above method can effectively detect the depressive tendency of users in social networks and has good portability, robustness, effectiveness and practicality.

[0113] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the claims.

Claims

1. A method for detecting depression tendency of social users based on heterogeneous graph attention network, characterized in that: The following steps are involved: S1. Collect data on user social network platforms, perform text summarization on short texts of user-generated content, and perform statistical calculations on user behavior data and user portrait data; S2. Build a flexible heterogeneous information network framework to model short texts, user behavior data, and user portrait data, perform entity linking, entity embedding, and feature extraction on the processed short texts, and perform topic analysis on the features; In order to solve the semantic sparsity problem of short texts, we use a flexible heterogeneous information network (HIN) framework to model short texts. This framework can integrate any type of additional information and capture the relationship between them to enrich the semantics of short texts. For additional information, in addition to topics and entities, we also use the user behavior data and user portrait data calculated in step S1, such as the distribution of sending time, the statistics of the proportion of positive and negative words used by users, etc., to construct a graph G = (V, ε), where V and ε are node sets and edge sets respectively, where the node set includes the short text set D = {d1,…,d m }, topic set T = {t1,…,t k }, entity set E = {e1,...,e n }、Sending time distribution set C={c1,…,c p }、Vocabulary proportion set W={w1,…,w q }, that is, V = D∪T∪E∪C∪W, and the edge set ε represents the relationship between them; The document topic generation model Latent Dirichlet Allocation is used to identify the topic information hidden in the short text, mine the implicit topics to enrich the semantics of the short text, calculate the word frequency, and each topic t i =(θ1,...,θ w ), w represents the vocabulary represented by the probability distribution of words, and each document is assigned the first P topics with the highest probability. If there is a distribution relationship between documents and topics, a "document-topic" edge is established; Perform entity linking on short texts, identify entities E in document D, and use the entity linking tool TAGME to map them to Wikipedia. If the document contains an entity, a "document-entity" edge is established; Entity embedding is performed on short texts. An entity is regarded as a complete word, and word2vec2 based on the Wikipedia corpus is used to learn entity embedding. In order to further enrich the semantics of short texts and promote information dissemination, the relationship between entities is considered. If the cosine similarity between two entities calculated based on the embedding is higher than the predefined threshold δ, the "entity-entity" edge is established; Establish edges related to user behavior data and user portrait data, including each time distribution corresponding to each user, each vocabulary ratio corresponding to each user, establish "time distribution-document" edges, and establish "vocabulary ratio-document" edges; Use word frequency and inverse document frequency (TF-IDF) as features, delete entities without features, delete some edges, delete isolated points, and generate edge feature files, including document nodes, entity nodes, topic nodes, user behavior data nodes, and user portrait data nodes. At the same time, save the map index information file to be input into network training; S3. For the heterogeneity of different types of information, use heterogeneous graph convolution; S4. For the importance of different adjacent nodes and the importance of different node types to specific nodes, a two-layer attention mechanism based on type level and node level is established; S5. Build a heterogeneous graph neural network based on the attention mechanism, train and test the network, predict labels, and thus complete the classification task of determining whether the user has a tendency to depression.

2. The method for detecting depression tendency of social users based on heterogeneous graph attention network according to claim 1 is characterized in that: In step S1, the text summarization of user-generated content refers to the use of the Bert model for text embedding and Kmeans clustering to identify sentences close to the centroid for automatic summary selection for a large amount of text data sent by the user on the social networking platform. The purpose is to automatically filter out important sentences from a large amount of social text of the user, which can better solve the problems of information fragmentation and interference from useless information and improve the efficiency and accuracy of the model.

3. The method for detecting depression tendency of social users based on heterogeneous graph attention network according to claim 1 is characterized in that: In step S1, the statistical calculation of user behavior data refers to the statistical calculation of the time when users send information on the social platform to form a sending time distribution. These statistical information may distinguish the user's depression state and help to judge the user's psychological state. The data is collected and calculated using the written functions and used as heterogeneous graph node information.

4. The method for detecting depression tendency of social users based on heterogeneous graph attention network according to claim 1 is characterized in that: In step S1, the statistical calculation of user portrait data refers to the statistical calculation of the proportion of positive and negative expressions used by users, the statistical calculation of the proportion of positive and negative words used by users, the statistical calculation of the proportion of first-person singular and plural used by users, the statistical calculation of the number of followers and the number of followers of user accounts, etc., to construct a user portrait. These statistical information may distinguish the user's depressive state and help judge the user's psychological state. The data are collected and calculated using the written functions and will be used as heterogeneous graph node information.

5. The method for detecting depression tendency of social users based on heterogeneous graph attention network according to claim 1 is characterized in that: The specific process of step S3 is: S31. Use TF-IDF (Term Frequency-Inverse Document Frequency) to evaluate the importance of a certain word of a user to a social text sent by the user. The more times a word appears in a social text sent by the user and the fewer times it appears in all social texts, the more representative it is of the social text. TF is expressed by the following formula: Among them, n i,j Indicates the term t i In the document d j The number of occurrences in TF i,j It means the term t i In the document d j The frequency of occurrence in the IDF formula is as follows Where |D| represents the number of all documents, |j:t i ∈d j | indicates that the term t is included i The number of documents, TF-IDF is expressed as TF-IDF=TF·IDF (3) S32. For the heterogeneity of different types of information, heterogeneous graph convolution is used. In HIN, we have five types of nodes: documents, topics, entities, user behavior data, and user portrait data. They have different feature spaces. For document d∈D, we use TF-IDF vector as its feature vector x d , for a topic t∈T, the word distribution x i =(θ1,…,θ w ) is used to represent the topic feature vector. For each entity, in order to make full use of relevant information, we concatenate its word vector embedding and the TF-IDF vector of its Wikipedia text to represent the entity feature vector x v , using the heterogeneous graph convolution method, considering the differences between different types of information, projecting them into a transformation matrix W using their own transformation matrices; considering the differences between different feature spaces and projecting them into the implicit common space, the update formula of the node is in yes Submatrix of, adjacency matrix Contains self-connections, its rows represent all nodes, columns represent the node's τ-type neighbors, τ represents the node type including documents, entities, topics, user behavior data, user portrait data, and the node representation H (l+1) By using the transformation matrix of each type τ Embedding of nodes under each type of τ Aggregation results in the transformation matrix W considering the differences in different feature spaces and projecting them into the common space R q (l+1) In the initialization 6. The method for detecting depression tendency of social users based on heterogeneous graph attention network according to claim 1 is characterized in that: The specific process of step S4 is: S41. Type level attention can learn the weights of different types of neighbor nodes and fuse the representations of nodes under multiple relationships. Given a specific node v, the embedding of type τ is represented as the sum of the features of neighbor nodes of type τ, as shown in the following formula: S42, embedding h based on the current node v v and h τ , embed τ to calculate the type-level attention score, and obtain the attention score a of node v on the type τ domain τ As shown below: Where || represents connection, μ τ is an attention vector of type τ, with shared parameters for all nodes, and σ(·) represents the activation function, such as LeakyReLU; S43. Normalize the attention scores on all types through the softmax function to obtain the type-level attention weight, as shown in the following formula: S44. Node level attention can capture the importance of different neighbor nodes and learn the representation of nodes through weighted aggregation. Given a specific node v of type τ, and its neighbors of type τ' First, the representations of node v and its neighbor v' are concatenated, and then converted into attention scores through a single-layer MLP and attention vector. v and h v' and the type-level attention score α τ′ , calculate node v about The node-level attention score b vv′ , as shown below: b vv' =σ(v T ·a τ' [h v ||h v' ] (8) Where ν is the attention vector parameter; S45. The attention score b vv′ The attention weight β is obtained by normalizing the softmax function vv′ , S46. Aggregate neighbors based on the learned attention weights. Compared with equation (4), equation (10) Replaced with Based on the two-layer attention mechanism, the weight of noisy neighbors will be lower and the weight of relatively important neighbors will be higher, so that the importance of different adjacent nodes and the importance of different node types to specific nodes are taken into account. The node type forms a matrix of the attention weights of the node and its corresponding neighboring points The node update formula is: in Represents the attention matrix, whose elements are β vv , β j,j Indicates v i With v j The attention weight between .

7. The method for detecting depression tendency of social users based on heterogeneous graph attention network according to claim 1 is characterized in that: The specific process of step S5 is: S51. Based on the above two-level attention mechanism at the node level and type level, a heterogeneous graph attention network (HGAT) model is constructed to embed HIN for short text classification. HGAT considers the heterogeneity of different types of information through heterogeneous graph convolution. At the same time, the attention mechanism can capture the importance of different neighbor nodes, reduce noise information, and capture the importance of different types of nodes, so as to better realize information aggregation. The representation of the learned short text is more accurate. The HGAT class contains the First Layer and the Second Layer, which correspond to the two layers of attention mechanism respectively, and the Output Layer corresponds to the softmax output layer. S52. Take out the short text node representation of the last layer and train it through cross entropy. HGAT is a semi-supervised algorithm, and the loss here is also calculated on a small amount of labeled data. Z=softmax(H (L) ) (11) The cross entropy loss is Where C is the number of categories, D train is a set of short text indexes, θ is a model parameter, and finally, the label of the document is predicted through a softmax layer.