Feature weighting method based on ranking learning model for depression tendency analysis of social media texts
Through the feature weighting method based on the sorting learning model, the characteristics of social media text are extracted and the depression risk assessment model is trained, which solves the problem of insufficient detection accuracy in the existing technology, and early detection and risk assessment of depression tendencies are achieved.
Patent Information
- Application Number
- CN202110559680.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-21
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2041-05-21
AI Technical Summary
The prior art is difficult to improve the accuracy in depression detection, especially when detecting depression tendencies in early stages, the characteristics of depression are ignored, resulting in insufficient detection accuracy.
Using a feature weighting method based on the sorting learning model, social media texts are evaluated for depression risk. By collecting and preprocessing data, text features are extracted, such as negative word frequency, language fluency, time characteristics, metaphor and emotional vocabulary frequency, training sorting Model to assess the risk of depression.
It has achieved fine-grained query of users' depressive tendencies, improved the accuracy of early detection of depression, and can carry out targeted psychological counseling and clinical treatment.
Smart Images

Figure CN113268582B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to depression detection and risk assessment, and in particular to a feature weighting method based on a ranking learning model for depression tendency analysis of social media texts. Background Art
[0002] In recent years, mental health has received increasing attention and attention from the public. How to maintain a healthy mental state while maintaining physical health is an important guarantee for improving the quality of life. Depression, as a common mental illness, seriously affects the patient's living conditions and endangers physical and mental health. The clinical diagnosis of depression usually adopts the patient's self-statement or filling out questionnaires. The content described by the patient is likely to be subjective and vague. At the same time, patients who have resorted to clinical diagnosis often have a tendency to depression for some time, which poses a great challenge to the treatment of depression. Therefore, early detection of depression is conducive to early detection of potential depression risks, and by actively guiding and venting depressive emotions, it can avoid aggravating mental illness and related consequences. How to detect depressive tendencies as early as possible is a difficult problem that needs to be solved in related fields.
[0003] The rise of social media has provided an effective way for early detection of depressive tendencies. Patients with depressive tendencies are often reluctant to confide in people around them, and are more willing to express their personal emotions through social media platforms. Therefore, the text content posted by users on social media will reflect the characteristics of their emotional changes, which are very valuable for early detection of depression. Existing technologies often treat depression detection as a binary classification problem, that is, classifying social media texts into texts with depressive emotions and texts without depressive emotions, and then further mining texts with depressive emotions. Although related technologies can detect depressive tendencies at an early stage to a certain extent, they will ignore the characteristics of depression itself, and it is difficult to improve the accuracy of detection.
[0004] Based on the above considerations, the present invention proposes a feature weighting method based on a ranking learning model for the analysis of depression tendency in social media text. This method regards the detection of depression tendency as a risk assessment problem, fine-grainedly queries the classification of users with depression tendency, and uses the ranking learning method combined with psychological theory to detect the depression risk of social media users. Summary of the invention
[0005] In order to solve the problem of depression risk assessment, the present invention proposes a feature weighting method based on a ranking learning model for depression tendency analysis of social media texts. The method comprises the following steps:
[0006] S1. Collect and preprocess social media text data;
[0007] S2, text feature extraction for depression;
[0008] S3, training sorting model;
[0009] S4. Depression risk assessment based on ranking model.
[0010] Further, in step S1:
[0011] Collect text data posted by users on social media texts. The text data includes data under the topic of "depression" and data under other topics. The data under the topic of "depression" is used as positive samples in model training, and the data under other topics is used as negative samples in model training. Collect all text data posted by the same user. The social media text posted by the same user u can be represented as {s1, s2, ... si, ... sn}, where si represents any social media text posted by the user. Each social media text corresponds to a label, which indicates whether the social media text belongs to the topic of depression. 1 is a social media text with a tendency to depression, and 0 is a social media text without a tendency to depression. The label corresponding to the social media text of user u is represented as {y1, y2, ..., yn}. What the depression risk assessment model needs to predict is whether each social media text of user u has a tendency to depression, that is, each label value in the label set.
[0012] Further, in step S2:
[0013] The purpose of text feature extraction is to represent each social media text of the user in the form of a feature vector. The feature vector is used as the input for subsequent model training. Considering the symptoms and characteristics of depression, the following text features are defined and extracted;
[0014] Text feature 1 of depressive symptoms: Depressed patients tend to deny themselves. The frequency of negative words in social media texts reflects the degree of depression of users. The frequency of negative words is used as a text feature and is defined as f1 = the number of negative words in a single social media text / the total number of words in a single social media text.
[0015] Depression symptom 2: Depressed patients have poor language fluency due to cognitive impairment, which is reflected in the fluency and readability of social media texts posted by users. In order to quantitatively evaluate and extract features of the fluency and readability of texts, in machine translation and text summarization tasks, the fluency of sentences is measured by the BLEU indicator, and the following features are defined:
[0016]
[0017] First, based on a given social media text sentence s, a search engine is used to search, and the retrieved related sentences are represented as T = {t1, t2, t3...}. The number of n-grams in the given social media text sentence s and the number of n-grams in the related sentences T are counted to calculate Pt, t = 1, ..., N, that is, the ratio of n-grams in the social media text sentence s to the number of related sentences, for example, P1 = (the number of times a 1-gram in s appears in T) / (the number of 1-grams in s); n in n-gram is a variable, representing an n-gram language model. The specific explanation below is the meaning of 1-gram and 2-gram, which is a commonly used probabilistic statistical method in the field, used to count the frequency of co-occurrence between words.
[0018] For example, s = the weather is very good today, and n = 2. Then the 1-grams in the social media text sentence s are {today, day, weather, weather, very, good}; the 2-grams in the social media text sentence s are {today, day, weather, weather, very, very good}.
[0019] In the previous article, we retrieved related sentences to determine the similarity between sentences and social media texts, that is, to determine whether the words in social media texts frequently appear in other related sentences. The related sentences T retrieved are: Today's weather is great, yesterday's weather was OK, then the 1-grams in T are {Today, the weather, is great, yesterday, the weather, is OK}, and the 2-grams are {Today, every day, the weather, is great, yesterday, every day, the weather, is OK}
[0020] P1=(1+4+4+2+1) / 6=2
[0021] P2=(1+2+2+1) / 5=1.2
[0022] Substitute into the formula to find the value of f2;
[0023] Depression symptom 3: Patients with depression tendencies have a time-varying pattern of being more severe in the morning and less severe at night. The time when social media texts are posted is used as a feature value, and the following features are defined:
[0024] f3 = num(t, t+1), where num(t) represents the number of social media texts posted by the user from t to t+1, and t is {0, 1, 2, …, 23}, representing 0:00 to 23:00 in a day;
[0025] Similarly, the defined feature f4 = num(t, t+1) / num(t-12, t+12) represents the ratio of the number of social media texts posted by a user in a certain hour to the number posted in 24 hours;
[0026] Depressive symptom 4: Patients with depressive tendencies are unwilling to express their true emotions directly, and instead use metaphors and allusions to express them, accompanied by emotional fluctuations. Metaphorical words or emotional words reflect the degree of depression. The following characteristics are defined:
[0027] f5 = the number of social media texts containing metaphors / the total number of social media texts, where social media texts containing metaphors refer to social media texts containing {like, similar to, as, if}, etc.;
[0028] f6 = number of social media texts containing sensory verbs / total number of social media texts, where sensory verbs include verbs such as {feel, feel, see, hear, see};
[0029] f7 = number of social media texts containing sentiment words / total number of social media texts, where sentiment words include words in the sentiment dictionary;
[0030] Depressive symptoms 5: users with depressive tendencies have somatic symptoms, i.e., feeling discomfort in body parts, measured by symptom words contained in social media texts;
[0031] f8 = Number of social media texts containing symptom words / total number of social media texts. Symptom words include but are not limited to: difficulty breathing, palpitations, chest tightness, rapid heartbeat, bloating, nausea, stomach cramps, tiredness, pain, and dizziness.
[0032] Further, in step S3:
[0033] Each social media text posted by user u is represented as a feature vector F = {f1, f2, f3, ..., f8}, and the feature vector F is used as the input data for training the ranking learning model to obtain a depression risk assessment model;
[0034] The purpose of ranking learning training is to learn a scoring function The weight parameter w of each feature is obtained through model training, and the loss function of training optimization is defined as:
[0035] L(g;s,y)=-log P(y|g(w,s))
[0036]
[0037] y represents the true label sequence {y1, y2, …, yn} of the social media text of a given user. The true label is given by the topic label of the social media text. The label of the social media text with the topic label “depression” is set to 1, otherwise the label is set to 0. The above loss function L(g; s, y) is obtained by calculating the maximum likelihood probability value between the true label sequence and the label sequence predicted by the scoring function. For any given user, the closer the social media text ranking obtained by g is to the true ranking, the smaller the loss. The loss function is optimized by gradient descent, the loss is iteratively reduced, and the parameter w is continuously optimized to obtain the final prediction model, that is, the weight value of each feature of the scoring function.
[0038] Further, in step S4:
[0039] Given a test sample social media text, the above-mentioned feature vector F = {f1, f2, f3, ..., f8} is extracted, and the depression risk value of the social media text is calculated using the weight parameter w in the learned scoring function as a basis for determining whether the user has a tendency to depression.
[0040] The beneficial effect of the present invention is that the present invention regards depression detection based on social media as a risk assessment problem, and then uses a ranking learning algorithm to rank the risk levels of social media users with potential depression risks, which is beneficial for early detection of users with depression tendencies and targeted psychological counseling and clinical treatment. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 A flow chart for the operation of the present invention;
[0042] Figure 2 It is a system block diagram of the present invention. DETAILED DESCRIPTION
[0043] The present invention proposes a ranking learning model and feature weighting method for analyzing depression tendency of social media texts. Figure 1-2 As shown, the method comprises the following steps:
[0044] S1, collect and preprocess social media text data;
[0045] Collect text data posted by users on social media texts. The text data includes data under the topic of "depression" and data under other topics. The data under the topic of "depression" is used as positive samples in model training, and the data under other topics is used as negative samples in model training. Collect all text data posted by the same user. The social media text posted by the same user u can be represented as {s1, s2, ... si, ... sn}, where si represents any social media text posted by the user. Each social media text corresponds to a label, which indicates whether the social media text belongs to the topic of depression. 1 is a social media text with a tendency to depression, and 0 is a social media text without a tendency to depression. The label corresponding to the social media text of user u is represented as {y1, y2, ..., yn}. What the depression risk assessment model needs to predict is whether each social media text of user u has a tendency to depression, that is, each label value in the label set.
[0046] S2, text feature extraction for depression;
[0047] The purpose of text feature extraction is to represent each social media text of the user in the form of a feature vector. The feature vector is used as the input for subsequent model training. Considering the symptoms and characteristics of depression, the following text features are defined and extracted;
[0048] Text feature 1 of depressive symptoms: Depressed patients tend to deny themselves. The frequency of negative words in social media texts reflects the degree of depression of users. The frequency of negative words is used as a text feature and is defined as f1 = the number of negative words in a single social media text / the total number of words in a single social media text.
[0049] Text feature 2 of depressive symptoms: Depressed patients have poor language fluency due to cognitive impairment, which is reflected in the fluency and readability of social media texts posted by users. In order to quantitatively evaluate and extract features of the fluency and readability of texts, in machine translation and text summarization tasks, the fluency of sentences is measured by the BLEU indicator, and the following features are defined:
[0050]
[0051] First, based on a given social media text sentence s, a search engine is used to search, and the retrieved related sentences are represented as T = {t1, t2, t3...}. The number of n-grams in the given social media text sentence s and the number of n-grams in the related sentences T are counted to calculate Pt, t = 1, ..., N, that is, the ratio of n-grams in the social media text sentence s to the number of related sentences, for example, P1 = (the number of times a 1-gram in s appears in T) / (the number of 1-grams in s); n in n-gram is a variable, representing an n-gram language model. The specific explanation below is the meaning of 1-gram and 2-gram, which is a commonly used probabilistic statistical method in the field, used to count the frequency of co-occurrence between words.
[0052] For example, s = the weather is very good today, and n = 2. Then the 1-grams in the social media text sentence s are {today, day, weather, weather, very, good}; the 2-grams in the social media text sentence s are {today, day, weather, weather, very, very good}.
[0053] In the previous article, we retrieved related sentences to determine the similarity between sentences and social media texts, that is, to determine whether the words in social media texts frequently appear in other related sentences. The related sentences T retrieved are: Today's weather is great, yesterday's weather was OK, then the 1-grams in T are {Today, the weather, is great, yesterday, the weather, is OK}, and the 2-grams are {Today, every day, the weather, is great, yesterday, every day, the weather, is OK}
[0054] P1=(1+4+4+2+1) / 6=2
[0055] P2=(1+2+2+1) / 5=1.2
[0056] Substitute into the formula to find the value of f2;
[0057] Text feature 3 of depressive symptoms: Patients with depression tendencies have a time-varying pattern of being more severe in the morning and less severe at night. The time when social media texts are posted is used as a feature value, and the following features are defined:
[0058] f3 = num(t, t+1), where num(t) represents the number of social media texts posted by the user from t to t+1, and t is {0, 1, 2, …, 23}, representing 0:00 to 23:00 in a day;
[0059] Similarly, the defined feature f4 = num(t, t+1) / num(t-12, t+12) represents the ratio of the number of social media texts posted by a user in a certain hour to the number posted in 24 hours;
[0060] Textual feature 4 of depressive symptoms: Patients with depressive tendencies are unwilling to express their true emotions directly, and instead use metaphors and allusions to express them, accompanied by emotional fluctuations. Metaphorical words or emotional words reflect the degree of depression. The following features are defined:
[0061] f5 = the number of social media texts containing metaphors / the total number of social media texts, where social media texts containing metaphors refer to social media texts containing {like, similar to, as, if}, etc.;
[0062] f6 = number of social media texts containing sensory verbs / total number of social media texts, where sensory verbs include verbs such as {feel, feel, see, hear, see};
[0063] f7 = number of social media texts containing sentiment words / total number of social media texts, where sentiment words include words in the sentiment dictionary;
[0064] Textual feature 5 of depressive symptoms: users with depressive tendencies have somatic symptoms, i.e., feeling discomfort in body parts, measured by the symptom words contained in social media texts;
[0065] f8 = Number of social media texts containing symptom words / total number of social media texts. Symptom words include but are not limited to: difficulty breathing, palpitations, chest tightness, rapid heartbeat, bloating, nausea, stomach cramps, tiredness, pain, and dizziness.
[0066] S3, training sorting model;
[0067] Each social media text posted by user u is represented as a feature vector F = {f1, f2, f3, ..., f8}, and the feature vector F is used as the input data for training the ranking learning model to obtain a depression risk assessment model;
[0068] The purpose of ranking learning training is to learn a scoring function The weight parameter w of each feature is obtained through model training, and the loss function of training optimization is defined as:
[0069] L(g;s,y)=-log P(y|g(w,s))
[0070]
[0071] y represents the true label sequence {y1, y2, …, yn} of the social media text of a given user. The true label is given by the topic label of the social media text. The label of the social media text with the topic label “depression” is set to 1, otherwise the label is set to 0. The above loss function L(g; s, y) is obtained by calculating the maximum likelihood probability value between the true label sequence and the label sequence predicted by the scoring function. For any given user, the closer the social media text ranking obtained by g is to the true ranking, the smaller the loss. The loss function is optimized by gradient descent, the loss is iteratively reduced, and the parameter w is continuously optimized to obtain the final prediction model, that is, the weight value of each feature of the scoring function.
[0072] S4. Depression risk assessment based on ranking model.
[0073] Given a test sample social media text, the above-mentioned feature vector F = {f1, f2, f3, ..., f8} is extracted, and the depression risk value of the social media text is calculated using the weight parameter w in the learned scoring function as a basis for determining whether the user has a tendency to depression.
[0074] The above contents are further detailed descriptions of the present invention in combination with specific preferred technical solutions, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as belonging to the protection scope of the present invention.
[0075] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical solutions and concepts of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A ranking learning feature weighting method for text depressive tendency analysis, characterized by: The method comprises the following steps: S1. Collect and preprocess social media text data; S2, extracting text features oriented towards depression; S3, training the ranking learning model; S4. Evaluating depression risk based on ranking learning model; In step S2: Each social media text of the user is represented as a feature vector. The feature vector is used as the input for subsequent model training. The following text features are defined and extracted. Text feature 1 of depressive symptoms: The frequency of negative words is used as a text feature, defined as f1 = the number of negative words in a single social media text / the total number of words in a single social media text; Text features of depressive symptoms 2: Quantitative evaluation and feature extraction of text fluency and readability. In machine translation and text summarization tasks, the fluency of sentences is measured by the BLEU index, and the following features are defined: First, based on a given social media text sentence s, a search engine is used to retrieve the relevant sentences retrieved, and the retrieved relevant sentences are represented as T = {t1, t2, t3...}. The number of n-grams in the given social media text sentence s and the number of n-grams in the relevant sentences T are counted to calculate Pn, n = 1, ..., N, that is, the ratio of n-grams in the social media text sentence s to the number of relevant sentences. In n-gram, n is a variable, representing an n-gram language model. In the previous article, the similarity between sentences and social media texts was determined by retrieving related sentences, that is, determining whether the words in social media texts frequently appear in other related sentences; Text feature 3 of depression symptoms: The time when social media text is posted is used as a feature value, and the following features are defined: f3 = num(t, t+1), where num(t, t+1) represents the number of social media texts posted by the user from time t to t+1, and t is {0, 1, 2, …, 23}, representing 0:00 to 23:00 in a day; Similarly, the defined feature f4 = num(t, t+1) / num(t-12, t+12) represents the ratio of the number of social media texts posted by a user in a certain hour to the number posted in 24 hours; Text feature 4 of depressive symptoms: Define the following metaphorical vocabulary or emotional word features: f5 = the number of social media texts containing metaphors / the total number of social media texts, where social media texts containing metaphors refer to social media texts containing {like, similar to, as, if}; f6 = number of social media texts containing sensory verbs / total number of social media texts, where sensory verbs include {feel, feel, see, hear, see}; f7 = number of social media texts containing sentiment words / total number of social media texts, where sentiment words include words in the sentiment dictionary; Textual characteristics of depressive symptoms 5: measured by symptom vocabulary contained in social media texts; f8 = Number of social media texts containing symptom words / total number of social media texts. Symptom words include: difficulty breathing, palpitations, chest tightness, rapid heartbeat, bloating, nausea, stomach cramps, tiredness, pain, and dizziness.
2. The method for ranking learning feature weighting for text depressive tendency analysis as claimed in claim 1, characterized in that: In step S1: The text data posted by users on social media texts are collected. The text data include data under the topic of "depression" and data under non-topics of "depression". The data under the topic of "depression" is used as positive samples in model training, and the data under non-topics of "depression" is used as negative samples in model training. All text data posted by the same user are collected. For the social media text posted by the same user u, it is represented as {s1, s2, ... si, ... sn}, si represents any social media text posted by the user, and each social media text corresponds to a label. The label indicates whether the social media text belongs to the topic of depression. 1 is a social media text with a tendency to depression, and 0 is a social media text without a tendency to depression. The label corresponding to the social media text of user u is represented as {y1, y2, ..., yn}. What the depression risk assessment model needs to predict is whether each social media text of user u has a tendency to depression, that is, each label value in the label set.
3. The ranking learning feature weighting method for text depressive tendency analysis as claimed in claim 1, characterized in that: In step S3: Each social media text posted by user u is represented as a feature vector F = {f1, f2, f3, ..., f8}, and the feature vector F is used as the input data for training the ranking learning model to obtain a depression risk assessment model; The purpose of ranking learning training is to learn a scoring function The weight parameter w of each feature is obtained through model training, and the loss function of training optimization is defined as: L(g;s,y)=-logP(y|g(w,s)) y represents the true label sequence {y1, y2, …, yn} of the social media text of a given user. The true label is given by the topic label of the social media text. The label of the social media text with the topic label "depression" is set to 1, otherwise the label is set to 0. The above loss function L(g; s, y) is obtained by calculating the maximum likelihood probability value between the true label sequence and the label sequence predicted by the scoring function. For any given user, the closer the social media text ranking obtained by g is to the true ranking, the smaller the loss. The loss function is optimized by gradient descent, the loss is iteratively reduced, and the parameter w is continuously optimized to obtain the final prediction model, that is, the weight value of each feature of the scoring function.
4. The method for weighting features of sorting learning for text depressive tendency analysis as claimed in claim 3, characterized in that: In step S4: Given a test sample social media text, the above-mentioned feature vector F = {f1, f2, f3, ..., f8} is extracted, and the depression risk value of the social media text is calculated using the weight parameter w in the learned scoring function as a basis for determining whether the user has a tendency to depression.
Citation Information
Patent Citations
Depressive emotion recognition method integrating microblog user social relations and microblog text characteristics
CN109918556A
Depression detection method based on text and image social network
CN112669936A
Classification of affective states in social media
US20140365208A1
