A Traditional Chinese Medicine Syndrome Prediction Method Integrating Large Language Model and Knowledge Graph

By integrating large language models and knowledge graphs and combining trained syndrome prediction models, the problem of low prediction accuracy in the prior art is solved, and higher prediction accuracy is achieved.

CN119811689BActive Publication Date: 2025-06-24PEKING UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510293559.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-13
Publication Date
2025-06-24
Estimated Expiration
2045-03-13

AI Technical Summary

Technical Problem

Existing traditional Chinese medicine syndrome prediction models are susceptible to prevalence bias, resulting in low prediction accuracy.

Method used

The method of integrating large language model and knowledge graph is adopted to predict the first probability of patients having each major category of syndrome through a trained syndrome prediction model, and the second and third probability are determined using large language model and knowledge graph, and these probabilities are combined to improve prediction accuracy.

Benefits of technology

By eliminating prevalence bias, the accuracy of prediction of TCM syndrome is improved, especially when the sample size is uneven.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119811689B_ABST
    Figure CN119811689B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for predicting traditional Chinese medicine syndromes by integrating large language models and knowledge graphs, belonging to the technical field of syndrome prediction, and solves the problem of low prediction accuracy in the prior art. The method includes: inputting the initial features of the patient to be predicted into the syndrome prediction model to predict the first probability of each major syndrome existing in the patient to be predicted; respectively using the large language model and the knowledge graph to determine the second probability and the third probability of each syndrome existing in the patient to be predicted; obtaining the comprehensive probability of each major syndrome existing in the patient to be predicted based on the first probability, the second probability and the third probability of each major syndrome existing in the patient to be predicted; determining the comprehensive probability of each sub-syndrome existing in the patient to be predicted based on the second probability and the third probability of each sub-syndrome existing in the patient to be predicted, and the similarity between the patient to be predicted and each sub-syndrome; obtaining the syndromes of the patient to be predicted based on the comprehensive probabilities of each major syndrome and each sub-syndrome. Accurate syndrome prediction is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of syndrome prediction, and in particular to a traditional Chinese medicine syndrome prediction method that integrates a large language model and a knowledge graph. Background Art

[0002] Syndrome differentiation is a thinking and practical process of comprehensively analyzing the data obtained from the four diagnostic methods (inspection, auscultation and olfaction, interrogation, and palpation) based on traditional Chinese medicine theory, clarifying the essence of the disease and determining what syndrome it is. According to traditional Chinese medicine theory, it analyzes syndromes (symptoms, signs, etc.) and related data, differentiates syndrome elements such as the location and nature of the disease, and makes a syndrome name diagnosis. Treatment based on syndrome differentiation, also known as treatment implementation, is a thinking and practical process of establishing corresponding treatment principles, methods, and prescription medications according to the results of syndrome differentiation, and selecting appropriate treatment means and measures to deal with the disease. Syndrome differentiation and treatment based on syndrome differentiation are two inseparable aspects that are interrelated in the process of diagnosing and treating diseases. Syndrome differentiation is to recognize the disease and determine the syndrome; treatment based on syndrome differentiation is to establish the treatment method and prescribe medications according to the results of syndrome differentiation. Syndrome differentiation is the premise and basis of treatment based on syndrome differentiation, and treatment based on syndrome differentiation is the means and method of treating diseases, and also a test of whether the syndrome differentiation is correct. Therefore, syndrome differentiation and treatment based on syndrome differentiation are the embodiment of the combination of theory and practice, the specific application of the theoretical system of principle, method, formula, and medicine in clinical practice, and the basic principle of traditional Chinese medicine clinical diagnosis and treatment.

[0003] With the development of technologies such as deep learning and reinforcement learning, methods have begun to combine deep learning models with traditional Chinese medicine syndrome differentiation. However, existing prediction models are very susceptible to popularity bias. That is, when the distribution of training samples is uneven, the model tends to predict the classification with a higher sample size. This affects the recognition ability of categories with a small number of samples, resulting in a low prediction accuracy. Summary of the Invention

[0004] In view of the above analysis, embodiments of the present invention aim to provide a traditional Chinese medicine syndrome prediction method that integrates a large language model and a knowledge graph to solve the problem of low existing prediction accuracy.

[0005] On the one hand, embodiments of the present invention provide a traditional Chinese medicine syndrome prediction method that integrates a large language model and a knowledge graph, including the following steps:

[0006] Convert the symptom text description of the patient to be predicted into initial features; input the initial features into the trained syndrome prediction model to predict the first probability of each major syndrome existing in the patient to be predicted;

[0007] Based on the symptom text description of the patient to be predicted, use the large language model and the knowledge graph respectively to determine the second probability and the third probability of each major syndrome and sub-syndrome existing in the patient to be predicted; obtain the comprehensive probability of each major syndrome existing in the patient to be predicted based on the first probability, second probability, and third probability of each major syndrome existing in the patient to be predicted;

[0008] Based on the second probability and the third probability of each sub-syndrome existing in the patient to be predicted, and the similarity between the patient to be predicted and each sub-syndrome, determine the comprehensive probability of each sub-syndrome existing in the patient to be predicted;

[0009] Based on the comprehensive probabilities of each major syndrome and each sub-syndrome, obtain the syndrome of the patient to be predicted.

[0010] Based on a further improvement of the above method, use a large language model respectively based on the symptom text description of the patient to be predicted to determine the second probability of each major syndrome and sub-syndrome existing in the patient to be predicted, including:

[0011] Generate prompt words based on the symptom text of the patient to be predicted and all syndromes, and input the generated prompt words into the large language model to predict the probability corresponding to each syndrome;

[0012] Normalize the probability corresponding to each syndrome to obtain the second probability of the sub-syndrome and other major syndromes except the combined major syndromes; sum the probabilities of all sub-syndromes as the second probability of the combined major syndrome.

[0013] Based on a further improvement of the above method, use a knowledge graph based on the symptom text description of the patient to be predicted to determine the third probability of each major syndrome and sub-syndrome existing in the patient to be predicted, including:

[0014] Extract the symptoms in the symptom text description of the patient to be predicted. For each symptom, query the syndromes corresponding to the symptom based on the knowledge graph to obtain the associated features corresponding to each symptom; aggregate the associated features corresponding to all the symptoms of the patient to be predicted to obtain the associated features of the patient to be predicted;

[0015] Based on the associated features, obtain the third probability of each sub-syndrome and other major syndromes except the combined major syndromes existing in the patient to be predicted; sum the third probabilities of all sub-syndromes as the third probability of the combined major syndrome.

[0016] Based on a further improvement of the above method, based on the first probability, second probability and third probability of each major syndrome existing in the patient to be predicted, obtain the comprehensive probability of each major syndrome existing in the patient to be predicted in the following way:

[0017] ;

[0018] ;

[0019] ;

[0020] Among them, represents a multi-layer neural network, represents the first probability vector of each major syndrome existing in the patient to be predicted, The second probability vector indicating the existence of each major syndrome type in the patient to be predicted, The third probability vector indicating the existence of each major syndrome type in the patient to be predicted, Indicating the softmax function, The comprehensive probability vector indicating the existence of each major syndrome type in the patient to be predicted.

[0021] Based on a further improvement of the above method, the similarity between the patient to be predicted and each sub - syndrome is obtained in the following manner:

[0022] Extract the samples with sub - syndromes in the training sample set as the samples to be compared; extract the variable features and syndrome element prediction results of each sample to be compared based on the trained syndrome prediction model; splice the variable features and syndrome element prediction results to obtain the features to be compared of each sample to be compared;

[0023] Extract the variable features and syndrome element prediction results of the patient to be predicted based on the trained syndrome prediction model; splice the variable features and syndrome element prediction results of the patient to be predicted to obtain the features to be compared of the patient to be predicted;

[0024] Calculate the similarity between the features to be compared of the patient to be predicted and the features to be compared of each sample to be compared to obtain the similarity between the patient to be predicted and each sample to be compared;

[0025] Calculate the similarity between the patient to be predicted and each sub - syndrome based on the similarity between the patient to be predicted and each sample to be compared.

[0026] Based on a further improvement of the above method, based on the second probability and the third probability of the existence of each sub - syndrome in the patient to be predicted, and the similarity between the patient to be predicted and each sub - syndrome, the comprehensive probability of the existence of each sub - syndrome in the patient to be predicted is obtained in the following manner:

[0027] According to the formula Calculate the initial prediction probability of the existence of the j - th sub - syndrome in the patient to be predicted ;

[0028] Normalize the second probability of the existence of each sub - syndrome in the patient to be predicted; normalize the third probability of the existence of each sub - syndrome in the patient to be predicted;

[0029] According to the formula , Calculate the comprehensive probability of the existence of the j - th sub - syndrome in the patient to be predicted ;

[0030] Among them, Indicates the similarity between the patient to be predicted and the j - th sub - syndrome, P represents the first probability of the existence of the combined major syndrome type predicted for the patient to be predicted, represents the number of sub-syndromes, represents the normalized second probability that the patient to be predicted has the j-th sub-syndrome, represents the normalized third probability that the patient to be predicted has the j-th sub-syndrome, , and represents the weight.

[0031] Based on the further improvement of the above method, a trained syndrome prediction model is obtained in the following way:

[0032] Obtain the symptom text descriptions, syndromes, and syndrome elements of the sample patients, convert the symptom text descriptions into initial features, and construct a training sample set based on the initial features, syndromes, and syndrome elements of the sample patients; among them, the syndromes with the sample quantity greater than the first threshold are used as separate major syndromes; the syndromes with the sample quantity less than or equal to the first threshold are sub-syndromes; all sub-syndromes are merged to form a merged major syndrome; each sample includes three groups of labels, the first group of labels mark whether the patient has each major syndrome, the second group of labels are used to represent whether the patient has each sub-syndrome in the merged major syndrome, and the third group of labels are used to mark whether the patient has each syndrome element;

[0033] Construct a neural network model, the neural network model includes a syndrome prediction task and a syndrome element prediction task; among them, the syndrome prediction task includes the prediction of the major syndromes and sub-syndromes of the sample; train the neural network model based on the constructed training sample set to obtain a syndrome prediction model.

[0034] Based on the further improvement of the above method, the neural network model includes:

[0035] The first feature extraction module is used to perform deep feature extraction on the sample based on the initial features to obtain the first features of the sample;

[0036] The syndrome element classification module is used to perform syndrome element prediction on the sample based on the first features or the initial features;

[0037] The major syndrome prediction module is used to perform major syndrome prediction on the sample based on the first features and the syndrome element prediction results;

[0038] The sub-syndrome prediction module is used to perform sub-syndrome prediction in the merged major syndrome based on the first features.

[0039] Based on the further improvement of the above method, it is characterized in that the sub-syndrome prediction module includes:

[0040] The feature decomposition module is used to decompose the first features into invariant features and variable features;

[0041] A third classifier, configured to predict whether a sample does not have a combined major syndrome based on the invariant features;

[0042] A fourth classifier, configured to predict the probability that a sample has a sub-syndrome in the combined major syndrome based on the variable features.

[0043] Based on a further improvement of the above method, it is characterized in that the training loss of the neural network model is calculated by using the following formula:

[0044] ;

[0045] where represents the combined loss of syndrome element prediction and major syndrome prediction, represents the sub-syndrome prediction loss, represents the weight.

[0046] Compared with the prior art, the present invention predicts the first probability that a patient to be predicted has each major syndrome through a trained syndrome prediction model; uses a large language model and a knowledge graph to determine the second probability and the third probability that the patient to be predicted has each major syndrome and sub-syndrome, and obtains the comprehensive probability that the patient has each major syndrome by integrating the first probability, the second probability and the third probability. At the same time, the extrapolation of the large language model and the accuracy of the knowledge graph are used to eliminate the popularity bias and improve the accuracy of predicting major syndromes; based on the second probability and the third probability that the patient to be predicted has each sub-syndrome, and the similarity between the patient to be predicted and each sub-syndrome, the comprehensive probability that the patient to be predicted has each sub-syndrome is determined. At the same time, the extrapolation of the large language model and the accuracy of the knowledge graph are used to eliminate the popularity bias and improve the accuracy of predicting sub-syndromes; the syndromes of the patient to be predicted are obtained according to the comprehensive probabilities of each major syndrome and each sub-syndrome, thereby improving the accuracy of syndrome prediction.

[0047] In the present invention, the above technical solutions can also be combined with each other to achieve more preferred combination schemes. Other features and advantages of the present invention will be described in the subsequent description, and some advantages can be made obvious from the description, or understood by implementing the present invention. The objectives and other advantages of the present invention can be achieved and obtained through the content specifically pointed out in the description and the drawings. Description of the Drawings

[0048] The drawings are only for the purpose of showing specific embodiments, and are not considered to be a limitation of the present invention. Throughout the drawings, the same reference signs denote the same components;

[0049] Figure 1 is a flowchart of a traditional Chinese medicine syndrome prediction method that integrates a large language model and a knowledge graph according to an embodiment of the present invention. Detailed Embodiments

[0050] The preferred embodiments of the present invention will be specifically described below with reference to the accompanying drawings. The accompanying drawings form a part of this application and are used together with the embodiments of the present invention to explain the principles of the present invention, rather than to limit the scope of the present invention.

[0051] A specific embodiment of the present invention discloses a traditional Chinese medicine syndrome prediction method that integrates a large language model and a knowledge graph, as Figure 1 shown, including the following steps:

[0052] S1. Convert the symptom text description of the patient to be predicted into initial features; input the initial features into the trained syndrome prediction model to predict the first probability of each major syndrome existing in the patient to be predicted;

[0053] S2. Based on the symptom text description of the patient to be predicted, use the large language model and the knowledge graph respectively to determine the second probability and the third probability of each major syndrome and sub-syndrome existing in the patient to be predicted; obtain the comprehensive probability of each major syndrome existing in the patient to be predicted based on the first probability, the second probability, and the third probability of each major syndrome existing in the patient to be predicted;

[0054] S3. Based on the second probability and the third probability of each sub-syndrome existing in the patient to be predicted, and the similarity between the patient to be predicted and each sub-syndrome, determine the comprehensive probability of each sub-syndrome existing in the patient to be predicted;

[0055] S4. Obtain the syndrome of the patient to be predicted based on the comprehensive probability of each major syndrome and each sub-syndrome.

[0056] It should be noted that syndromes with a sample size greater than the first threshold are major syndromes, and syndromes with a sample size less than or equal to the first threshold are sub-syndromes. Combining all sub-syndromes together as a major syndrome is denoted as a combined major syndrome. The first threshold is determined according to the actual sample quantity of each syndrome collected. For example, the first threshold can be 10.

[0057] With the continuous development of large language models, large language models, as a pre-trained knowledge carrier, have received increasing attention. However, due to their inherent hallucination problems, their direct application as world knowledge in the medical field is subject to certain limitations. On the other hand, the content in the knowledge graph is all extracted from the literature, so it has high authority. Compared with large language models, the knowledge graph does not have hallucination problems. However, its extrapolation ability is much weaker than that of large language models.

[0058] Compared with the prior art, the traditional Chinese medicine syndrome prediction method that integrates large language models and knowledge graphs provided by this embodiment predicts the first probability of each major syndrome existing in the patient to be predicted through a trained syndrome prediction model; uses the large language model and knowledge graph to determine the second probability and the third probability of each major syndrome and sub-syndrome existing in the patient to be predicted, and combines the first probability, the second probability, and the third probability to obtain the comprehensive probability of each major syndrome existing in the patient. At the same time, the extrapolation of the large language model and the accuracy of the knowledge graph are used to eliminate popularity bias and improve the accuracy of predicting major syndromes; based on the second probability and the third probability of each sub-syndrome existing in the patient to be predicted, and the similarity between the patient to be predicted and each sub-syndrome, the comprehensive probability of each sub-syndrome existing in the patient to be predicted is determined. At the same time, the extrapolation of the large language model and the accuracy of the knowledge graph are used to eliminate popularity bias and improve the accuracy of predicting sub-syndromes; the syndromes of the patient to be predicted are obtained according to the comprehensive probability of each major syndrome and each sub-syndrome, thereby improving the accuracy of syndrome prediction.

[0059] During implementation, the text description of the symptoms of the patient to be predicted can be converted into initial features, that is, the input recognizable by the model, through existing methods. For example, a pre-trained BERT model is used to obtain the initial features of the patient to be predicted.

[0060] During implementation, the initial features are input into the trained syndrome prediction model to predict the first probability of each major syndrome existing in the patient to be predicted. The first probability vector of each major syndrome existing in the patient to be predicted is expressed as .

[0061] During implementation, the following method is used to obtain the trained syndrome prediction model:

[0062] Obtain the text description of the symptoms, syndromes, and syndrome elements of the sample patients, convert the text description of the symptoms into initial features, and construct a training sample set based on the initial features, syndromes, and syndrome elements of the sample patients; among them, the syndromes with a sample quantity greater than the first threshold are used as separate major syndromes; the syndromes with a sample quantity less than or equal to the first threshold are sub-syndromes; all sub-syndromes are combined to form combined major syndromes; each sample includes three groups of labels. The first group of labels indicates whether the patient has each major syndrome, the second group of labels is used to represent whether the patient has each sub-syndrome in the combined major syndromes, and the third group of labels is used to indicate whether the patient has each syndrome element;

[0063] Construct a neural network model, and the neural network model includes a syndrome prediction task and a syndrome element prediction task; among them, the syndrome prediction task includes the prediction of the major syndromes and sub-syndromes of the sample; the neural network model is trained based on the constructed training sample set to obtain a syndrome prediction model.

[0064] Existing methods simply establish a direct mapping relationship from symptoms to syndromes, ignoring the analysis process in traditional Chinese medicine diagnosis. Therefore, they cannot provide good interpretability for their methods. In order to increase the interpretability of the model, the present invention collects the syndrome element information of sample patients at the same time. By adding the learning of the corresponding relationship between syndrome elements and syndromes and the corresponding relationship between symptom information and syndrome elements, the model can incorporate the information of syndrome elements when predicting syndrome classification, using syndrome elements as intermediate information, and achieving the purpose of improving the accuracy of syndrome prediction and giving the interpretability of syndrome prediction at the same time. It should be noted that each sample patient may have multiple syndromes and multiple syndrome elements.

[0065] In the present invention, syndromes with sufficient sample size are used as separate major categories, and subdivided syndromes with small sample size are merged into one major category. Each sample patient is labeled with the major syndromes, subdivided syndromes and syndrome elements it has, so as to construct a training sample set. By training a neural network model based on the constructed training sample set, since the major syndromes are the combination of syndromes with small sample size, there will be no problem of sample imbalance. At the same time, when predicting subdivided syndromes, since the sample magnitudes of subdivided syndromes are the same, there will also be no imbalance problem. Therefore, the trained model can accurately predict major syndromes, subdivided syndromes and syndrome elements, further eliminating the influence of sample size imbalance on the prediction degree, and avoiding overfitting, thus improving the prediction accuracy.

[0066] Specifically, the constructed neural network model includes:

[0067] A first feature extraction module, which is used to perform deep feature extraction on the sample based on the initial features to obtain the first features of the sample;

[0068] A syndrome element classification module, which is used to predict the syndrome elements of the sample based on the first features or the initial features;

[0069] A major syndrome prediction module, which is used to predict the major syndromes of the sample based on the first features and the syndrome element prediction results;

[0070] A subdivided syndrome prediction module, which is used to predict the subdivided syndromes in the merged major syndromes based on the first features.

[0071] During implementation, the first feature extraction module can adopt an existing NLP model structure.

[0072] The syndrome element classification module, the major syndrome prediction module and the subdivided syndrome prediction module can adopt existing multi-classifier structures.

[0073] During implementation, the major syndrome prediction module integrates the syndrome element information and predicts the major syndromes based on the first features and the syndrome element prediction results. Specifically, the major syndrome prediction module predicts the major syndromes of the sample based on the first features and the syndrome element prediction results, including:

[0074] After splicing the first feature with the syndrome element prediction structure, the prediction of the large-category syndromes of the samples is carried out.

[0075] During implementation, in order to improve the accuracy of the prediction of the sub-category syndromes, the sub-category syndrome prediction module includes:

[0076] A feature decomposition module, which is used to decompose the first feature into invariant features and variable features;

[0077] A third classifier, which is used to predict whether the sample does not have a combined large-category syndrome based on the invariant features;

[0078] A fourth classifier, which is used to predict the probability that the sample has a sub-category syndrome in the combined large-category syndrome based on the variable features.

[0079] We first hope that the invariant features can better distinguish whether the sample has a combined large-category syndrome, that is, extract the common features of the small-sample syndromes, and use the variable features to assist in distinguishing different sub-category syndromes in the combined large-category syndrome.

[0080] During implementation, the feature decomposition module decomposes the first feature through a mask matrix. Introduce the mask matrix M, that is, the matrix scale is the same as the first feature, the invariant feature , the variable feature . The value of the mask matrix M is obtained by model learning. Use to represent the first feature of the i-th patient.

[0081] During implementation, the third classifier is a binary classifier , and its output represents the probability that the sample does not have a combined large-category syndrome.

[0082] The fourth classifier is a multi-classifier, denoted as , and its output is the probability that the sample has the k-th sub-category syndrome.

[0083] During implementation, the following formula is used to calculate the training loss of the neural network model:

[0084] ;

[0085] Among them, represents the combined loss of syndrome element prediction and large-category syndrome prediction, represents the sub-category syndrome prediction loss, represents the weight.

[0086] During implementation, the combined loss of syndrome element prediction and large-category syndrome prediction is:

[0087] ;

[0088] ;

[0089] ;

[0090] Among them, represents the predicted loss of the major syndrome types, represents the predicted loss of syndrome elements, represents the label indicating whether the i-th sample has the j-th major syndrome type, represents the probability that the model predicts whether the i-th sample has the j-th major syndrome type, represents the label indicating whether the i-th sample has the k-th syndrome element, represents the probability that the model predicts whether the i-th sample has the k-th syndrome element, represents the weight, and n represents the number of samples in the current training batch, represents the number of major syndrome types, the number of syndrome element types.

[0091] Specifically, the following formula is used to calculate the predicted loss of the sub-syndromes:

[0092] ;

[0093] ;

[0094] ;

[0095] Among them, represents the invariant features of the i-th sample, represents the label indicating whether the i-th sample has the j-th sub-syndrome, represents the probability that the model predicts whether the i-th sample has the j-th sub-syndrome, represents the third classifier, represents the label indicating whether the i-th sample has the combined major syndrome. If so, it is 1; otherwise, it is 0, represents the weight, and n represents the number of samples in the current training batch, represents the number of sub-syndromes.

[0096] By performing combined major syndrome classification and sub-syndrome prediction based on invariant features and variable features, and adding the classification and sub-syndrome prediction losses, the accuracy of sub-syndrome prediction is improved.

[0097] During implementation, the gradient of the neural network is backpropagated through the mini-batch stochastic gradient descent algorithm, and the parameters of the model are trained by minimizing the loss function. When the model converges, that is, when the preset loss accuracy or the number of iterations is reached, the training is stopped, and a trained syndrome prediction model is obtained.

[0098] For a patient to be predicted, convert the text description of their symptoms into initial features; input the trained syndrome prediction model to predict the probability of the patient to be predicted having each major syndrome category to obtain the first probability of the patient to be predicted having each major syndrome category.

[0099] To eliminate popularity bias, the present invention introduces a large language model and a knowledge graph to simultaneously utilize the extrapolation of the large language model and the accuracy of the knowledge graph.

[0100] Specifically, in step S2, based on the text description of the symptoms of the patient to be predicted, use the large language model to determine the second probability of the patient to be predicted having each major syndrome category and sub-syndrome, including:

[0101] Generate a prompt word based on the symptoms of the patient to be predicted and all syndromes, and input the generated prompt word into the large language model to predict the probability corresponding to each syndrome;

[0102] Normalize the probability corresponding to each syndrome to obtain the second probability of the sub-syndrome and other major syndrome categories except the combined major syndrome category; sum the probabilities of all sub-syndromes as the second probability of the combined major syndrome category.

[0103] During implementation, use the existing large language model (LLM) to extract the syndrome prediction probability by setting a prompt. An example of the prompt format is: "You are a traditional Chinese medicine expert. Please give the probability of the patient belonging to each syndrome in the {list of syndrome names} according to the {description of patient symptoms}." Where {description of patient symptoms} represents the text X of the patient's symptom description, and {list of syndrome names} represents the list of names of all syndromes we want to predict. Denote the return result of the LLM as , which represents the probability of the patient to be predicted having each syndrome predicted by the large language model. Among them, N is the number of syndrome types, , represents the number of sub-syndromes, represents the number of major syndrome categories, represents the number of syndromes with a sample size exceeding the first prediction.

[0104] To ensure that the sum of all probabilities is 1, normalize the probability corresponding to each syndrome to obtain the second probability of the patient to be predicted having each syndrome (including sub-syndromes and other major syndrome categories except the combined major syndrome category), and sum the probabilities of all sub-syndromes as the second probability of the combined major syndrome category. The second probability vector of the patient to be predicted having each major syndrome category is expressed as .

[0105] Specifically, based on the symptom text description of the patient to be predicted, use a knowledge graph to determine the third probability of each major syndrome type and sub-syndrome existing in the patient to be predicted, including:

[0106] Extract the symptoms from the symptom text description of the patient to be predicted. For each symptom, query the syndromes corresponding to the symptom based on the knowledge graph to obtain the associated features corresponding to each symptom; aggregate the associated features corresponding to all the symptoms of the patient to be predicted to obtain the associated features of the patient to be predicted.

[0107] Based on the associated features, obtain the third probability of each sub-syndrome existing in the patient to be predicted, as well as other major syndrome types except the combined major syndrome types; sum the third probabilities of all sub-syndromes as the third probability of the combined major syndrome type.

[0108] During implementation, an existing well-constructed traditional Chinese medicine knowledge graph can be used.

[0109] Extract the symptoms from the symptom text description of the patient to be predicted. For each symptom, query the syndromes corresponding to the symptom in the knowledge graph to obtain the associated features corresponding to each symptom.

[0110] If the knowledge graph records the association relationships between nodes, the associated features are represented as , where represents whether the k-th symptom is associated with the first syndrome type, with a value of 0 or 1, and so on, represents whether the k-th symptom is associated with the N-th syndrome type.

[0111] If the knowledge graph records the association weights between nodes, the associated features are represented as , where represents the association weight between the k-th symptom and the first syndrome type, and so on, represents the association weight between the k-th symptom and the N-th syndrome type, with a value ranging from 0 to 1.

[0112] Sum the associated features corresponding to all the symptoms of the patient to be predicted to obtain the associated features of the patient to be predicted , perform a softmax operation on the KG to obtain the third probability of each syndrome type (including sub-syndrome types and other major syndrome types except the combined major syndrome types) existing in the patient to be predicted. Sum the third probabilities of all sub-syndrome types as the third probability of the combined major syndrome type. The third probability vector of each major syndrome type existing in the patient to be predicted is represented as .

[0113] Specifically, based on the first probability, second probability, and third probability of each major syndrome type existing in the patient to be predicted, use the following method to obtain the comprehensive probability of each major syndrome type existing in the patient to be predicted:

[0114] ;

[0115] ;

[0116] ;

[0117] Among them, represents a multi-layer neural network, represents the first probability vector of the existence of each major syndrome type for the patient to be predicted, represents the second probability vector of the existence of each major syndrome type for the patient to be predicted, represents the third probability vector of the existence of each major syndrome type for the patient to be predicted, represents the softmax function, represents the comprehensive probability vector of the existence of each major syndrome type for the patient to be predicted.

[0118] During implementation, for each major syndrome type, due to the high accuracy of the knowledge graph, first aggregate the first probability and the third probability, and perform feature transformation on them through the neural network to obtain , and then is aggregated with the second probability, and feature transformation is performed on it through the neural network to obtain , and is combined with , that is, using the residual connection method, to obtain a more accurate comprehensive probability.

[0119] Specifically, the following method is used to obtain the similarity between the patient to be predicted and each sub-syndrome:

[0120] S31. Extract the samples with sub-syndromes in the training sample set as the samples to be compared; extract the variable features and syndrome element prediction results of each sample to be compared based on the trained syndrome prediction model; splice the variable features and syndrome element prediction results to obtain the features to be compared of each sample to be compared;

[0121] S32. Extract the variable features and syndrome element prediction results of the patient to be predicted based on the trained syndrome prediction model; splice the variable features and syndrome element prediction results of the patient to be predicted to obtain the features to be compared of the patient to be predicted;

[0122] S33. Calculate the features to be compared of the patient to be predicted and the features to be compared of each sample to be compared to obtain the similarity between the patient to be predicted and each sample to be compared;

[0123] S34. Calculate the similarity between the patient to be predicted and each sub-syndrome based on the similarity between the patient to be predicted and each sample to be compared.

[0124] During implementation, first, extract the samples with sub-syndromes as the samples to be compared, that is, the patient to be predicted is compared with the samples to be compared.

[0125] Then, based on the syndrome element prediction model obtained through training, obtain the variable features of each sample to be compared and the syndrome element prediction results , and after splicing, obtain the features to be compared of the samples to be compared .

[0126] Similarly, after splicing the variable features and syndrome element prediction results of the patient to be predicted, obtain the features to be compared q of the patient to be predicted.

[0127] During implementation, the cosine similarity formula can be used to calculate the similarity between the patient to be predicted and the i-th sample to be compared .

[0128] Specifically, calculate the similarity between the patient to be predicted and each sub-syndrome based on the similarity between the patient to be predicted and each sample to be compared, including:

[0129] For each sub-syndrome, take the mean of the similarities between all samples to be compared with the patient to be predicted that have this sub-syndrome as the similarity between the patient to be predicted and this sub-syndrome.

[0130] Specifically, based on the second probability and the third probability of the patient to be predicted having each sub-syndrome, and the similarity between the patient to be predicted and each sub-syndrome, obtain the comprehensive probability of the patient to be predicted having each sub-syndrome:

[0131] According to the formula calculate the initial prediction probability of the patient to be predicted having the j-th sub-syndrome ;

[0132] Normalize the second probability of the patient to be predicted having each sub-syndrome; normalize the third probability of the patient to be predicted having each sub-syndrome;

[0133] According to the formula , calculate the comprehensive prediction probability of the patient to be predicted having the j-th sub-syndrome ;

[0134] Among them, represents the similarity between the patient to be predicted and the j-th sub-syndrome, P represents the first probability of the patient to be predicted having the combined major syndrome obtained through prediction, represents the number of sub-syndromes, represents the normalized second probability of the patient to be predicted having the j-th sub-syndrome, represents the normalized third probability of the patient to be predicted having the j-th sub-syndrome, , and represent weights.

[0135] Adjust the prediction probability of the sub-syndromes through the second probability and the third probability to eliminate bias and improve the accuracy of prediction.

[0136] During implementation, normalizing the second probability of each sub-syndrome existing in the patient to be predicted is to divide the second probability of each sub-syndrome by the sum of the second probabilities of the sub-syndromes, so that the sum of the second probabilities of each sub-syndrome is 1. Similarly, normalizing the third probability of each sub-syndrome existing in the patient to be predicted is to divide the third probability of each sub-syndrome by the sum of the third probabilities of the sub-syndromes, so that the sum of the third probabilities of each sub-syndrome is 1.

[0137] Obtain the syndromes of the patient to be predicted based on the comprehensive probability of each major syndrome and each sub-syndrome existing in the patient to be predicted. During implementation, the major syndromes and sub-syndromes with a comprehensive probability greater than the second threshold are the syndromes of the patient to be predicted. The second threshold is set to 0.6, for example.

[0138] Those skilled in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. Among them, the computer-readable storage medium is a disk, an optical disc, a read-only memory or a random access memory, etc.

[0139] As described above, only the preferred specific embodiments of the present invention are provided, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered by the protection scope of the present invention.

Claims

1. A TCM syndrome prediction method integrating a large language model and a knowledge graph, characterized in that: The following steps are involved: Convert the text description of the symptoms of the patient to be predicted into initial features; Inputting the initial features into the trained syndrome prediction model to predict the first probability of each major syndrome in the patient to be predicted; Based on the text description of the symptoms of the patient to be predicted, the large language model and the knowledge graph are used to determine the second probability and third probability of each major syndrome and subdivided syndrome of the patient to be predicted; based on the first probability, second probability and third probability of each major syndrome of the patient to be predicted, the comprehensive probability of each major syndrome of the patient to be predicted is obtained; Determine the comprehensive probability that the patient to be predicted has each subdivided syndrome based on the second probability and the third probability that the patient to be predicted has each subdivided syndrome, and the similarity between the patient to be predicted and each subdivided syndrome; Based on the comprehensive probability of each major syndrome and each subdivided syndrome, the syndrome of the patient to be predicted is obtained; Based on the first probability, second probability and third probability of each major syndrome in the patient to be predicted, the comprehensive probability of each major syndrome in the patient to be predicted is obtained in the following manner: ; ; ; in, represents a multi-layer neural network, The first probability vector representing the presence of each major syndrome in the patient to be predicted, The second probability vector representing the presence of each major syndrome in the patient to be predicted, The third probability vector representing the presence of each major syndrome in the patient to be predicted, represents the softmax function, The comprehensive probability vector representing the presence of each major syndrome in the patient to be predicted; Based on the second probability and the third probability of the existence of each subdivided syndrome in the patient to be predicted, and the similarity between the patient to be predicted and each subdivided syndrome, the comprehensive probability of the existence of each subdivided syndrome in the patient to be predicted is obtained in the following manner: According to the formula Calculate the initial prediction probability that the patient to be predicted has the jth subdivision syndrome ; The second probability of each subdivided syndrome in the patient to be predicted is normalized; the third probability of each subdivided syndrome in the patient to be predicted is normalized; According to the formula , Calculate the comprehensive probability that the patient to be predicted has the jth subdivided syndrome ; in, represents the similarity between the patient to be predicted and the jth subdivided syndrome, P represents the first probability that the patient to be predicted has a combined major syndrome, Indicates the number of subdivided syndromes, represents the normalized second probability that the patient to be predicted has the jth subdivided syndrome, represents the normalized third probability that the patient to be predicted has the jth subdivided syndrome, , and Represents weight.

2. The TCM syndrome prediction method integrating a large language model and a knowledge graph according to claim 1 is characterized in that: Based on the text description of the symptoms of the patient to be predicted, the large language model is used to determine the second probability of each major syndrome and subdivided syndrome in the patient to be predicted, including: Generate prompt words based on the symptom text and all syndromes of the patient to be predicted, and input the generated prompt words into the large language model to predict the probability corresponding to each syndrome; The probability corresponding to each syndrome is normalized to obtain the subdivided syndrome and the second probability of other major syndromes except the combined major syndrome; the probabilities of all subdivided syndromes are added up as the second probability of the combined major syndrome.

3. The TCM syndrome prediction method integrating a large language model and a knowledge graph according to claim 1 is characterized in that: Based on the text description of the patient's symptoms, the knowledge graph is used to determine the third probability of each major syndrome and subdivided syndrome in the patient to be predicted, including: Extract the symptoms in the text description of the patient to be predicted. For each symptom, query the syndrome corresponding to the symptom based on the knowledge graph to obtain the associated features corresponding to each symptom; aggregate the associated features corresponding to all symptoms of the patient to be predicted to obtain the associated features of the patient to be predicted; Based on the association characteristics, the third probability of the patient to be predicted having each subdivided syndrome and other major syndromes except the combined major syndrome is obtained; the third probabilities of all subdivided syndromes are added together as the third probability of the combined major syndrome.

4. The TCM syndrome prediction method integrating a large language model and a knowledge graph according to claim 1, characterized in that: The similarity between the patient to be predicted and each subdivided syndrome is obtained in the following way: Extracting samples with subdivided syndromes from the training sample set as samples to be compared; extracting variable features and syndrome factor prediction results of each sample to be compared based on the trained syndrome prediction model; splicing the variable features and syndrome factor prediction results to obtain the features to be compared of each sample to be compared; Extract variable features and syndrome factor prediction results of the patient to be predicted based on the trained syndrome prediction model; splice the variable features and syndrome factor prediction results of the patient to be predicted to obtain the features to be compared of the patient to be predicted; Calculate the features to be compared of the patient to be predicted and the features to be compared of each sample to be compared to obtain the similarity between the patient to be predicted and each sample to be compared; The similarity between the patient to be predicted and each subdivided syndrome is calculated based on the similarity between the patient to be predicted and each sample to be compared.

5. The TCM syndrome prediction method integrating a large language model and a knowledge graph according to claim 1, characterized in that: The trained syndrome prediction model was obtained in the following way: Obtain the text description of symptoms, syndromes and syndrome elements of the sample patients, convert the text description of symptoms into initial features, and construct a training sample set based on the initial features, syndromes and syndrome elements of the sample patients; wherein syndromes with a sample size greater than a first threshold are regarded as separate major syndromes; syndromes with a sample size less than or equal to the first threshold are subdivided syndromes; all subdivided syndromes are combined to form a combined major syndrome; each sample includes three groups of labels, the first group of labels marks whether the patient has each major syndrome, the second group of labels is used to express whether the patient has each subdivided syndrome in the combined major syndrome, and the third group of labels is used to mark whether the patient has each syndrome element; A neural network model is constructed, wherein the neural network model includes a syndrome prediction task and a syndrome factor prediction task; wherein the syndrome prediction task includes the prediction of the major syndromes and the subdivided syndromes of the sample; the neural network model is trained based on the constructed training sample set to obtain a syndrome prediction model.

6. The TCM syndrome prediction method integrating a large language model and a knowledge graph according to claim 5 is characterized in that: The neural network model includes: A first feature extraction module, used for performing deep feature extraction on the sample based on the initial feature to obtain a first feature of the sample; A certificate element classification module, used for predicting the certificate element of the sample based on the first feature or the initial feature; A major syndrome prediction module, used to predict the major syndrome of the sample based on the first feature and the syndrome element prediction result; A subdivided syndrome prediction module is used to predict subdivided syndromes in the combined large syndrome category based on the first feature.

7. The TCM syndrome prediction method integrating a large language model and a knowledge graph according to claim 6 is characterized in that: The subdivided syndrome prediction module comprises: A feature decomposition module, used for decomposing the first feature into an invariant feature and a variable feature; A third classifier is used to predict whether the sample does not have a combined major syndrome based on the invariant features; The fourth classifier is used to predict the probability of the sample containing a subdivided syndrome in the combined large syndrome category based on the variable feature.

8. The TCM syndrome prediction method integrating a large language model and a knowledge graph according to claim 6, characterized in that: The training loss of the neural network model is calculated using the following formula: ; in, It represents the joint loss of syndrome factor prediction and major syndrome prediction. represents the prediction loss of subdivided syndromes, Represents weight.

Citation Information

Patent Citations

  • Traditional Chinese medicine intelligent inquiry tongue diagnosis comprehensive system based on syndrome elements and deep learning

    CN112216383A

  • Traditional Chinese medicine meridian prescription ancient book knowledge graph construction and syndrome mining system

    CN113488188A