Depressive disorder recognition system based on context learning and knowledge graph
Through a depression disorder recognition system based on context learning and knowledge graph, using large language models and medical knowledge graphs, the problem of identifying users' emotional tendencies and depression levels on online social network platforms is solved, and accurate depression recognition and treatment assistance is achieved.
Patent Information
- Application Number
- CN202510523951.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-07-29
AI Technical Summary
It is difficult for the existing technology to accurately identify users' emotional tendencies and depression levels on online social network platforms. Traditional machine learning methods have poor recognition effects under short texts and complex semantic features, and are difficult to collect data sets and unbalanced samples, which affects the timely detection and treatment of depression.
A depression disorder recognition system based on context learning and knowledge graph is adopted to build a depression disorder recognition model by designing key issues of large language models, context learning, medical knowledge graph supplementation and neural network training, and a variety of depression scales and medical knowledge graphs are used for feature extraction and judgment.
It realizes accurate identification of emotional tendencies and depression levels of users in online healthy communities, improves the performance of large language models, alleviates systematic errors, and improves the accuracy of identification of depression disorders.
Smart Images

Figure CN120388718A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of depression disorder recognition, and particularly relates to a depression disorder recognition system based on context learning and knowledge graph. Background Art
[0002] Depression, also known as depressive disorder, is mainly clinically characterized by significant and persistent low mood. Depression causes symptoms such as listlessness and loss of appetite in patients and even suicidal tendencies, seriously affecting the quality of life of patients. According to statistics, it is expected that by 2030, depression will become the world's largest disease. At present, the treatment methods for depression have been proven to be effective, but only timely detection and treatment can effectively cure patients. At present, the traditional depression assessment methods mainly rely on self-report and doctor observation, but manual assessment often has subjective errors, and there are also problems such as long time consumption and shortage of clinical staff, which affect the assessment results. Therefore, how to achieve objective, effective and stable depression recognition is of great significance for the timely detection and treatment of depression. With the emergence of artificial intelligence, this problem has new solutions and tools.
[0003] Artificial intelligence was initially proposed by computer scientist John McCarthy and has now developed into a huge interdisciplinary field. At present, artificial intelligence has begun to be applied in psychiatry, and machine learning, as the core technology of artificial intelligence, has outstanding advantages. Many machine learning architectures have been tested on datasets in multiple modalities including facial expressions, electroencephalogram signals, text, audio and video, and have achieved fruitful results. However, these works are generally limited by datasets. Depression-related datasets involve many projects, and there are often problems of high collection difficulty and long time consumption, which in turn lead to small sample sizes and unbalanced positive and negative samples in these datasets, making it difficult to support relevant experiments. And there are no good solutions to these problems, so relevant researchers need some better and more scientific methods to collect depression datasets.
[0004] With the popularization of mobile social networks, more and more patients with depression are venting their emotions and expressing their self - demands through online social network platforms. The information posted on these online social network platforms has been proven to reflect the psychological state of the poster. Some scholars have begun to study issues such as the influencing factors, behavior types, and comment information mining of user participation behavior on online social network platforms. However, the blog content on online social network platforms such as Weibo has characteristics such as short text length, a tendency towards colloquialism in form, and complex semantic features. Traditional machine - learning - based sentiment discrimination methods and dictionary - based sentiment discrimination methods are difficult to accurately and effectively mine the semantic features of texts in online health communities. Therefore, how to use artificial intelligence technology to accurately identify the emotional tendency and depression level of users in online health communities, so as to assist in the effective treatment of patients with depression, has become a hot issue of concern in the current academic and industrial circles.
[0005] In recent years, large language models have made great progress. The technological development of large language models has had an important impact on the entire artificial intelligence community, which will completely change the way of developing and using artificial intelligence algorithms. However, directly applying large language models to specific fields cannot directly achieve excellent results. We must use some optimization means to strengthen large language models. Commonly used optimization means include full fine - tuning, parameter - efficient fine - tuning, prompt engineering, and retrieval - augmented generation, etc. Among them, prompt engineering includes methods such as in - context learning, instruction tuning, and chain of thought.
[0006] Therefore, how to provide a depression disorder recognition system based on in - context learning and knowledge graphs that can accurately identify the emotional tendency and depression level of users in online health communities and achieve accurate recognition of depressive disorders is an urgent problem for those skilled in the art. Summary of the Invention
[0007] In view of this, the present invention proposes a depression disorder recognition system based on in - context learning and knowledge graphs.
[0008] To achieve the above - mentioned purpose, the present invention adopts the following technical solutions:
[0009] A depression disorder recognition system based on in - context learning and knowledge graphs, comprising:
[0010] Large language model design module: used to design key questions of the large language model based on multiple depression scales, and write a preliminary Prompt in the form of Zero - Shot, denoted as Prompt ZS ;
[0011] In - context learning module: used to add the analysis process of the large language model for multiple user sample blog posts to Prompt based on in - context learning ZSand through precision comparison tests, obtain the best-structured Few-shot form of Prompt, denoted as Prompt FS , and input it together with the user test blog post into the large language model to obtain answers to key questions;
[0012] Knowledge Graph Module: Used to take all entities and related triples about depressive disorders in the medical knowledge graph as knowledge entries in the knowledge base, and connect the knowledge contained in each triple into a paragraph separately and set it as a piece of knowledge individually to construct a depressive disorder vector database;
[0013] Retrieval-Augmented Generation Module: Used to, after receiving the user test blog post, input it together with a Prompt for judging whether the user is depressed into the large language model, search for a preset number of relevant knowledge from the depressive disorder vector database, and input it together with the user test blog post and the Prompt for judging whether the user is depressed into the large language model again to obtain a depressive disorder judgment result;
[0014] Neural Network Training Module: Used to take the answers to key questions and the depressive disorder judgment result as input for depressive disorder recognition features, and use depressive disorder and non-depressive disorder as outputs to train a neural network-based depressive disorder recognition model for depressive disorder recognition.
[0015] Optionally, there are multiple depression scales, including: PHQ-8 Depression Scale, DSM-5 Diagnosis, Hamilton Depression Scale HAMD, Self-Rating Depression Scale SDS, and Burns Depression Checklist BDC.
[0016] Optionally, the initial Prompt is written based on the format and filling requirements of the depression scale, referring to the Prompt writing examples of the large language model, aiming to enable the large language model to correctly answer the frequency of the user being in key questions after seeing the user's blog post; among them, the frequency includes: never, occasionally, often, and always.
[0017] Optionally, the analysis process of the user sample blog post is specifically as follows:
[0018] The process of inputting the user sample blog post and Prompt ZS into the large language model to obtain the output.
[0019] Optionally, the user blog post is the user blog post after exclusion, and the exclusion conditions are as follows:
[0020] If a certain blog post in the user's blog post belongs to one of the contents of (1)-(3), then this blog post will be excluded: (1) Blog posts forwarding lottery content; (2) Blog posts shorter than the preset length; (3) Blog posts longer than the preset length; and the number of finally retained blog posts is less than the preset number of blog posts.
[0021] Optionally, based on context learning, the analysis process of the large language model for multiple user sample blog posts is added to the Prompt ZS , and through accuracy comparison tests, the Prompt in the best-structured Few-shot form is obtained, denoted as Prompt FS , as follows:
[0022]
[0023] Among them, is the j-th user sample blog post; is the output of the large language model for the j-th user sample blog post; J is the number of pairs added, determined by the accuracy comparison test.
[0024] Optionally, Prompt FS and the user test blog post are jointly input into the large language model to obtain answers to key questions, specifically:
[0025] Input Prompt FS and the user test blog post x′ i jointly into the large language model to obtain the output Answer i , and extract 16 features from Answer i [Answer i1 , Answer i2 , …, Answer i16 , representing 16-dimensional features related to depression of the user Its main content is about the frequency of the sample user in 16 key questions, and the frequency of each state is represented by an integer from 0 to 3.
[0026] Optionally, the depressive disorder judgment results include: non-depressive disorder, unable to judge, possible depressive disorder, and depressive disorder.
[0027] Optionally, the negative log-likelihood loss is selected as the loss function in the training process of the depressive disorder recognition model, as follows:
[0028]
[0029] Among them, Loss is the negative log-likelihood loss; N is the number of samples; y i is the prediction result of the i-th sample; is the true label of the i-th sample.
[0030] As can be seen from the above technical solutions, compared with the prior art, the present invention proposes a depression disorder recognition system based on context learning and knowledge graphs. First, the present invention uses a context learning module to extract key features from multiple classical depression scales and writes diverse samples of prompts suitable for large language models. At the same time, a knowledge graph module is used to supplement the large language model with materials in the medical knowledge graph. Finally, a small-scale neural network is connected after the neural network training module to process the output content of the large language model. On the one hand, the performance of the large language model optimized in the context learning and knowledge graph modules has been improved. On the other hand, the small-scale neural network connected after the neural network training module alleviates problems such as the systematic error of the large language model. In summary, the present invention realizes the ability to accurately identify the emotional tendency and depression degree of users in the online health community, and realizes the accurate recognition of depression disorders. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to the provided drawings.
[0032] Figure 1 It is a schematic structural diagram of the system of the present invention.
[0033] Figure 2 It is a schematic diagram of the depression disorder recognition process of the depression disorder recognition system of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0034] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0035] Embodiment 1:
[0036] Embodiment 1 of the present invention discloses a depression disorder recognition system based on context learning and knowledge graphs, as Figure 1 shown, including:
[0037] Large language model design module: used to design key problems of the large language model based on multiple depression scales and write a preliminary Prompt in the Zero-Shot form, denoted as Prompt ZS .
[0038] Regarding large language models, in the embodiments of the present invention, ChatGPT, including GPT-3.5 and GPT-4, is selected as the large language model mainly used for experiments.
[0039] Depression scales generally emerged in the last century and have been in use for a long time. The information contained therein can be regarded as the key features of depression.
[0040] In the embodiments of the present invention, a variety of depression scales are comprehensively analyzed, including: PHQ-8 Depression Scale, DSM-5 Diagnosis, Hamilton Depression Scale HAMD, Self-Rating Depression Scale SDS, and Burns Depression Checklist BDC, etc., and 16 key questions are designed as follows:
[0041] (1) Is this user feeling down?
[0042] (2) Is this user passive?
[0043] (3) Is this user not interested in all things?
[0044] (4) Does this user have abnormal appetite?
[0045] (5) Does this user have insomnia?
[0046] (6) Is this user moving slowly?
[0047] (7) Does this user lack vitality?
[0048] (8) Does this user feel worthless?
[0049] (9) Is this user unable to concentrate?
[0050] (10) Does this user get angry often?
[0051] (11) Does this user repeatedly think about health problems?
[0052] (12) Does this user repeatedly think about their past mistakes?
[0053] (13) Does this user often hesitate?
[0054] (14) Is this user restless?
[0055] (15) Does this user often feel uneasy?
[0056] (16) Does this user consider suicide or death?
[0057] The initial Prompt is written based on the format and filling requirements of the depression scale and with reference to the Prompt writing examples of large language models. The purpose is to enable the large language model to correctly answer the frequency of the user being in a key question (specific state) after seeing the user's blog post. Among them, the frequency includes: never, occasionally, often, and always.
[0058] Context learning module: For context learning, it adds the analysis process of the large language model for multiple user sample blog posts to the Prompt ZS and obtains the Prompt in the best-structured Few-shot form, denoted as Prompt, through accuracy comparison tests. FS This is jointly input into the large language model with the user test blog post to obtain answers to key questions.
[0059] Context learning technology is an important and efficient large model tuning method. The present invention provides two example Q&A paragraphs to the large model, which can enable the large model to learn the way of its output, not only improving performance but also standardizing the output method.
[0060] The analysis process of the user sample blog post is specifically as follows:
[0061] The process of inputting the user sample blog post and the Prompt ZS into the large language model to obtain the output.
[0062] The user blog post is the user blog post after exclusion. The exclusion conditions are as follows:
[0063] If a certain blog post in the user blog post belongs to one of the contents of (1)-(3), then this blog post will be excluded: (1) Blog posts forwarding lottery content; (2) Blog posts shorter than the preset length; (3) Blog posts longer than the preset length; and the number of finally retained blog posts is less than the preset number of blog posts.
[0064] Specifically: For the user blog post x i of all n blog posts [x i1 , x i1 ,... x in , each blog post is judged separately. If a certain blog post belongs to one of the contents of (1)-(3), then this blog post will be excluded. The user blog post after exclusion is: where m is the number of user blog posts after exclusion, and m is less than the preset number of blog posts. In the embodiment of the present invention, the preset number of blog posts is taken as 30.
[0065] The present invention combines the true labels to conduct manual diagnostic analysis on J user sample blog posts. These J user sample blog posts are denoted as corresponding true labels and for the samples The analysis results are organized into a specific format that facilitates batch statistical programming and are denoted as
[0066] To obtain the best subsequent experimental results, the present invention conducts accuracy comparison tests on various combinations of Prompts ZS , and and obtains the Prompt in the best-structured Few-shot form, denoted as Prompt FS .
[0067] Based on in-context learning, the analysis process of the large language model for multiple user sample blog posts is incorporated into Prompt ZS , and through accuracy comparison tests, the Prompt in the best-structured Few-shot form is obtained, denoted as Prompt FS , as follows:
[0068]
[0069] Among them, is the j-th user sample blog post; is the output of the large language model for the j-th user sample blog post; J is the number of pairs added, which is determined through accuracy comparison tests. In the embodiment of the present invention, J = 2, then j ∈ {1, 2}, and at this time Few-shot can be regarded as Two-shot.
[0070] Prompt FS and the user test blog post are jointly input into the large language model to obtain answers to key questions, specifically:
[0071] Prompt FS and the user test blog post x i are jointly input into the large language model to obtain the output Answer i , and 16 features [Answer i , Answer i1 , Answer i2 , …, Answer i16 are extracted from Answer to represent the 16-dimensional features related to depression of the user. i Its main content is about the frequency of the sample user in 16 key questions (16 specific states), and the frequency of each state is represented by an integer from 0 to 3. Under the constraint of in-context learning, the format of Answer
[0072] Knowledge Graph Module: It is used to take all entities and related triples about depressive disorders in the medical knowledge graph as knowledge entries in the knowledge base, and connect the knowledge contained in each triple into a paragraph separately, and set it as a piece of knowledge individually to construct a depressive disorder vector database.
[0073] A knowledge graph constructs a graph structure through nodes and edges (representing various entities and the relationships between two entities respectively), presenting the interconnections of various types of knowledge, and is an important data representation method. Due to its characteristics of structured knowledge, the knowledge graph is very suitable for use as an external database to supplement relevant information to large language models.
[0074] The present invention uses a high-quality medical knowledge graph as an external database to supplement the clinical psychiatric knowledge that may be lacking in large language models, and further improve the depressive disorder recognition ability of large language models.
[0075] Retrieval Augmented Generation Module: It is used to, after receiving a user's test blog post, jointly input it with a Prompt for judging whether the user is depressed into a large language model, search for a preset number of relevant knowledge from the depressive disorder vector database, and jointly input the user's test blog post and the Prompt for judging whether the user is depressed into the large language model again to obtain a depressive disorder judgment result, which is used as the 17th dimension feature in addition to the key question answer (16-dimensional feature) output by the large language model, and jointly serve as the input of the neural network model with the key question answer, thereby effectively improving the depressive disorder recognition accuracy of the neural network model.
[0076] Although large language models use a large amount of corpora during training, specifically in specific fields, there may still be a lack of some key materials. As a result, large language models are difficult to directly exhibit excellent performance in specific tasks. The knowledge graph module can use an external database to supplement large language models and improve the capabilities of large language models in specific tasks. Specifically:
[0077] After receiving the user's test blog post x′ i and jointly inputting it with a Prompt for judging whether the user is depressed into a large language model, search for a preset number of relevant knowledge from the depressive disorder vector database and denote it as Chunk i In the embodiment of the present invention, the preset number is taken as 5, then Chunk i ={Chunk i1 , Chunk i2 , …, Chunk i5}.
[0078] Combine x i with Chunk iAnd the Prompt for judging whether the user is depressed is input into the large language model again to obtain the judgment result of depressive disorder, including: non-depressive disorder, unable to judge, possible depressive disorder, and depressive disorder (represented by integers from 0 to 3 respectively), as the 17th dimension feature in addition to the key question answers (16-dimensional features) output by the large language model.
[0079] The judgment of depression belongs to the serious and rigorous field of clinical psychiatry, so the large language model often tends not to output clear judgment results. The vague judgment results include two categories: "unable to judge whether the user is depressed" and "the user may be depressed". After statistics, 91.70% of the samples with the result of "unable to judge whether the user is depressed" are non-depressive samples. At the same time, 84.38% of the samples with the result of "the user may be depressed" are depressive samples. Although this finding does not enable the present invention to directly regard the two vague judgments as the corresponding clear judgments, it can show that different vague judgments made by the large language model may contain different features.
[0080] Neural network training module: used to take the answers to key questions (16-dimensional features, ) and the judgment result of depressive disorder (the 17th dimension feature ) as the identification features of depressive disorder for input, and use depressive disorder and non-depressive disorder as the output (2-dimensional output) to train a neural network-based depressive disorder identification model for depressive disorder identification.
[0081] 2-dimensional output Corresponding to non-depressive disorder and depressive disorder; the final prediction is expressed as: If the prediction result is 1, it is judged that the sample x i is a depressive disorder, and if the prediction result is 0, it is judged that the sample x i is a non-depressive disorder.
[0082] The present invention performs the final processing in the way of traditional deep learning. The present invention builds a small-scale (relative to the large language model) neural network to convert the features extracted by the large language model into a confidence level of depression and health.
[0083] The negative log-likelihood loss is selected as the loss function in the training process of the depressive disorder identification model, as follows:
[0084]
[0085] Among them, Loss is the negative log-likelihood loss; N is the number of samples; y i is the prediction result of the i-th sample; is the true label of the i-th sample.
[0086] The depression disorder recognition process of the depression disorder recognition system disclosed by the present invention is as follows Figure 2 shown
[0087] The embodiments of the present invention disclose a depression disorder recognition system based on context learning and knowledge graph. The present invention first uses the context learning module to extract key features from multiple classic depression scales and write diverse prompts suitable for large language models. At the same time, the knowledge graph module is used to supplement the large language model with materials in the medical knowledge graph. Finally, a small-scale neural network is connected after the neural network training module to process the output content of the large language model. On the one hand, the performance of the large language model optimized in the context learning and knowledge graph modules has been improved. On the other hand, the small-scale neural network connected after the neural network training module alleviates problems such as the systematic error of the large language model. In summary, the present invention realizes the accurate identification of the emotional tendency and depression degree of users in the online health community, and realizes the accurate identification of depression disorder.
[0088] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method part.
[0089] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be obvious to those skilled in the art. The general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A depressive disorder recognition system based on context learning and knowledge graph, characterized in that, Including: Large language model design module: used to design key issues of the large language model based on multiple depression scales and write a preliminary Prompt in the Zero-Shot form, denoted as Prompt ZS ; Context learning module: For context learning, the analysis process of the large language model for multiple user sample blog posts is added to the Prompt ZS and through accuracy comparison tests, the best-structured Few-shot form of Prompt, denoted as Prompt FS , is jointly input into the large language model with the user test blog post to obtain the answer to the key question; Knowledge Graph Module: It is used to take all entities and related triples about depressive disorders in the medical knowledge graph as knowledge entries in the knowledge base, and connect the knowledge contained in each triple into a paragraph respectively, and set each paragraph as a piece of knowledge separately to build a depressive disorder vector database; Retrieval-Augmented Generation Module: It is used to, after receiving the user's test blog post, jointly input it with a Prompt for judging whether the user is depressed into a large language model, find a preset number of relevant knowledge from the depressive disorder vector database, and jointly input the user's test blog post and the Prompt for judging whether the user is depressed into the large language model again to obtain a depressive disorder judgment result; Neural Network Training Module: It is used to input the answers to the key questions and the depressive disorder judgment result as depressive disorder recognition features, and use depressive disorder and non-depressive disorder as outputs to train a neural network-based depressive disorder recognition model for depressive disorder recognition.
2. The depressive disorder recognition system based on context learning and knowledge graph according to claim 1, characterized in that, The multiple depression scales include: PHQ-8 Depression Scale, DSM-5 Diagnosis, Hamilton Depression Scale HAMD, Self-Rating Depression Scale SDS, and Burns Depression Checklist BDC.
3. The depressive disorder recognition system based on context learning and knowledge graph according to claim 1, characterized in that, The preliminary Prompt is written based on the format and filling requirements of the depression scale, referring to the Prompt writing examples of the large language model, aiming to enable the large language model to correctly answer the frequency of the user's key questions after seeing the user's blog post; where the frequency includes: never, occasionally, often, and always.
4. A depressive disorder recognition system based on context learning and knowledge graph according to claim 1, characterized in that, The analysis process of the user sample blog post is specifically as follows: The process of inputting a user's sample blog post and a Prompt ZS into a large language model to obtain an output.
5. The depressive disorder recognition system based on context learning and knowledge graph according to claim 1, wherein The user blog post is the user blog post after exclusion, and the exclusion conditions are as follows: If a certain blog post in the user's blog post belongs to one of the contents of (1)-(3), then this blog post will be excluded: (1) Blog posts forwarding lottery content; (2) Blog posts shorter than the preset length; (3) Blog posts longer than the preset length; and the number of finally retained blog posts is less than the preset number of blog posts.
6. The depressive disorder recognition system based on context learning and knowledge graph according to claim 1, characterized in that, Based on context learning, incorporate the analysis process of the large language model for multiple user sample blog posts into the Prompt ZS and obtain the Prompt in the best-structured Few-shot form, denoted as Prompt FS , as follows: Among them, is the j-th user sample blog post; is the output of the large language model for the j-th user sample blog post; J is the number of pairs added, which is determined by the accuracy comparison test.
7. The depressive disorder recognition system based on in-context learning and knowledge graph according to claim 1, characterized in that Prompt FS Input the user test blog post into the large language model to obtain the answers to the key questions, specifically: Input Prompt FS and the user's test blog post x′ i into the large language model together to obtain the output Answer i Extract 16 features from Answer i [Answer i1 , Answer i2 , …, Answer i16 , representing the 16-dimensional features related to depression of the user Its main content is about the frequency of the sample user in 16 key questions, and the frequency of each state is represented by an integer from 0 to 3.
8. The depressive disorder recognition system based on context learning and knowledge graph according to claim 1, characterized in that, The depressive disorder judgment result includes: non-depressive disorder, unable to judge, possible depressive disorder, and depressive disorder.
9. The depressive disorder recognition system based on context learning and knowledge graph according to claim 1, characterized in that The negative log-likelihood loss is selected as the loss function in the training process of the depressive disorder recognition model, as follows: Among them, Loss is the negative log-likelihood loss; N is the number of samples; y i is the prediction result of the i-th sample; is the true label of the i-th sample.