Traditional Chinese medicine syndrome prediction method fusing large language model and knowledge graph
By integrating large language models and knowledge graphs, the first, second and third probabilities of the traditional Chinese medicine syndrome prediction model are comprehensively calculated, which solves the problem of low prediction accuracy caused by prevalence bias in the prior art, and improves the accuracy of syndrome prediction.
Patent Information
- Application Number
- CN202510293559.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-13
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2045-03-13
AI Technical Summary
Existing traditional Chinese medicine syndrome prediction models are susceptible to prevalence bias, resulting in poor identification ability of categories with small samples and low prediction accuracy.
The method of integrating large language model and knowledge graph is adopted to predict the first probability of major syndromes through a trained syndrome prediction model, and the second probability and third probability are determined using large language model and knowledge graph, and the comprehensive probability is obtained to eliminate the popularity bias.
It improves the accuracy of prediction of traditional Chinese medicine syndromes, enhances the ability to identify categories with a small sample size, and reduces the impact of prevalence bias.
Smart Images

Figure CN119811689A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of syndrome prediction, and in particular to a TCM syndrome prediction method integrating a large language model and a knowledge graph. Background Art
[0002] Syndrome differentiation is a thinking and practice process that comprehensively analyzes the data obtained from the four examinations (observation, auscultation, inquiry, palpation) based on the theory of traditional Chinese medicine, clarifies the nature of the lesion and determines what kind of syndrome it is. According to the theory of traditional Chinese medicine, it analyzes the syndrome (symptoms, signs, etc.) and related data, identifies the syndrome elements such as the location and nature of the disease, and makes a syndrome diagnosis. Discussion and treatment, also known as treatment, is the thinking and practice process of establishing corresponding treatment principles, methods and prescriptions based on the results of syndrome differentiation, and selecting appropriate treatment methods and measures to treat the disease. Syndrome differentiation and discussion and treatment are two inseparable aspects of the diagnosis and treatment of diseases. Syndrome differentiation is to understand the disease and determine the syndrome; discussion and treatment is to establish the treatment method and prescription based on the results of syndrome differentiation. Syndrome differentiation is the premise and basis of discussion and treatment, which is the means and method of treating the disease and the test of whether the syndrome differentiation is correct. Therefore, syndrome differentiation and discussion and treatment are the embodiment of the combination of theory and practice, the specific application of the theoretical system of theory, method, prescription and medicine in clinical practice, and the basic principle of clinical diagnosis and treatment of traditional Chinese medicine.
[0003] With the development of deep learning, reinforcement learning and other technologies, there are ways to combine deep learning models with TCM dialectics. 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 the classification with a small number of samples, resulting in low prediction accuracy. Summary of the invention
[0004] In view of the above analysis, an embodiment of the present invention aims to provide a TCM 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, an embodiment of the present invention provides a method for predicting TCM syndromes by integrating a large language model with a knowledge graph, comprising the following steps: Converting 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 of 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; The syndrome of the patient to be predicted is obtained based on the comprehensive probability of each major syndrome and each subdivided syndrome.
[0006] Based on the further improvement of the above method, the large language model is used to determine the second probability of each major syndrome and subdivided syndrome in the patient to be predicted based on the text description of the patient's symptoms, 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.
[0007] Based on the further improvement of the above method, the third probability of each major syndrome and subdivided syndrome in the patient to be predicted is determined by using the knowledge graph based on the text description of the patient's symptoms, 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.
[0008] Based on the further improvement of the above method, the comprehensive probability of each major syndrome in the patient to be predicted is obtained in the following manner based on the first probability, the second probability and the third probability of each major syndrome in the patient to be predicted: ; ; ; 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, It represents the comprehensive probability vector of the presence of each major syndrome in the patient to be predicted.
[0009] Based on the further improvement of the above method, 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.
[0010] Based on the further improvement of the above method, the comprehensive probability of the presence of each subdivided syndrome in the patient to be predicted is obtained in the following manner based on the second probability and the third probability of the presence of each subdivided syndrome in the patient to be predicted, and the similarity between the patient to be predicted and each subdivided syndrome: 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.
[0011] Based on the further improvement of the above method, 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.
[0012] Based on the further improvement of the above method, 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.
[0013] A further improvement based on the above method is characterized in that the subdivided syndrome prediction module includes: 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.
[0014] A further improvement based on the above method is 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.
[0015] Compared with the prior art, the present invention predicts the first probability of each major syndrome in the patient to be predicted through a trained syndrome prediction model; uses a large language model and a knowledge graph to determine the second and third probabilities of each major syndrome and subdivided syndrome 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 in the patient, and simultaneously utilizes the extrapolation of the large language model and the accuracy of the knowledge graph to eliminate popularity bias and improve the accuracy of predicting major syndromes; determines the comprehensive probability of each subdivided syndrome in the patient to be predicted based on the second and third probabilities of each subdivided syndrome in the patient to be predicted, and the similarity between the patient to be predicted and each subdivided syndrome, and simultaneously utilizes the extrapolation of the large language model and the accuracy of the knowledge graph to eliminate popularity bias and improve the accuracy of predicting subdivided syndromes; obtains the syndrome of the patient to be predicted based on the comprehensive probability of each major syndrome and each subdivided syndrome, thereby improving the accuracy of syndrome prediction.
[0016] In the present invention, the above-mentioned technical solutions can also be combined with each other to achieve more preferred combination solutions. Other features and advantages of the present invention will be described in the subsequent description, and some advantages can become obvious from the description, or can be understood by practicing the present invention. The purpose and other advantages of the present invention can be achieved and obtained through the contents particularly pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings are only used for the purpose of illustrating specific embodiments and are not to be considered as limiting the present invention. In the entire drawings, the same reference symbols represent the same components; Figure 1 This is a flow chart of a method for predicting TCM syndromes by integrating a large language model with a knowledge graph according to an embodiment of the present invention. DETAILED DESCRIPTION
[0018] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0019] A specific embodiment of the present invention discloses a method for predicting TCM syndromes by integrating a large language model with a knowledge graph. Figure 1 As shown, the following steps are included: S1. Convert the text description of the symptoms 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 of the patient to be predicted; S2. 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 the patient to be predicted having each major syndrome and subdivided syndrome; based on the first probability, second probability and third probability of the patient to be predicted having each major syndrome, the comprehensive probability of the patient to be predicted having each major syndrome is obtained; S3, determining 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; S4. Based on the comprehensive probability of each major syndrome and each sub-syndrome, the syndrome of the patient to be predicted is obtained.
[0020] It should be noted that the syndromes with sample sizes greater than the first threshold are classified as major syndromes, and the syndromes with sample sizes less than or equal to the first threshold are classified as subdivided syndromes. All subdivided syndromes are combined as a major syndrome, which is expressed as a combined major syndrome. The first threshold is determined based on the actual number of samples collected for each syndrome. For example, the first threshold can be 10.
[0021] With the continuous development of large language models, large language models have received more and more attention as a pre-trained knowledge carrier. However, due to the inherent hallucination problem, the direct application of large language models as world knowledge in the medical field is limited to a certain extent. On the other hand, the content in the knowledge graph is all extracted from the literature, so it has a high degree of authority. Compared with the large language model, the knowledge graph does not have the hallucination problem, but its extrapolation ability is far weaker than that of the large language model.
[0022] Compared with the prior art, the TCM syndrome prediction method integrating a large language model and a knowledge graph provided in the present embodiment obtains the first probability of each major syndrome in the patient to be predicted by predicting through a trained syndrome prediction model; the second probability and the third probability of each major syndrome and subdivided syndrome in the patient to be predicted are determined by using the large language model and the knowledge graph, and the comprehensive probability of each major syndrome in the patient is obtained by combining the first probability, the second probability and the third probability, and the prevalence bias is eliminated by using the extrapolation of the large language model and the accuracy of the knowledge graph to improve the accuracy of predicting major syndromes; the comprehensive probability of each subdivided syndrome in the patient to be predicted is determined based on the second probability and the third probability of each subdivided syndrome in the patient to be predicted, and the similarity between the patient to be predicted and each subdivided syndrome, and the prevalence bias is eliminated by using the extrapolation of the large language model and the accuracy of the knowledge graph to improve the accuracy of predicting subdivided syndromes; the syndrome of the patient to be predicted is obtained according to the comprehensive probability of each major syndrome and each subdivided syndrome, thereby improving the accuracy of syndrome prediction.
[0023] During implementation, the text description of the symptoms of the patient to be predicted can be converted into initial features, that is, input recognizable by the model, through existing methods. For example, a pre-trained BERT model can be used to obtain the initial features of the patient to be predicted.
[0024] During implementation, the initial features are input into the trained syndrome prediction model to predict the first probability of each major syndrome in the patient to be predicted. The first probability vector of each major syndrome in the patient to be predicted is Expressed as .
[0025] During implementation, the trained syndrome prediction model is 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.
[0026] The existing method simply establishes a direct mapping relationship from symptoms to syndromes, while ignoring the analytical process of traditional Chinese medicine in diagnosis, and therefore cannot provide good interpretability for its method. In order to increase the interpretability of the model, the present invention collects the syndrome information of sample patients at the same time, and by adding the learning of the correspondence between syndromes and syndromes and the correspondence between symptom information and syndromes, the model can integrate the information of syndromes when predicting syndrome classification, and use syndromes as intermediary information, thereby achieving the purpose of improving the accuracy of syndrome prediction and providing interpretability of syndrome prediction. It should be noted that each sample patient may have multiple symptoms and multiple syndromes.
[0027] The present invention treats syndromes with sufficient sample size as a separate major category, and combines subdivided syndromes with small sample size into a major category, and labels each sample patient with the major category syndrome, subdivided syndrome and syndrome factor, thereby constructing a training sample set, and training a neural network model based on the constructed training sample set. Since the major category syndromes are syndromes with small sample sizes combined together, there will be no sample imbalance problem. At the same time, when predicting subdivided syndromes, there will be no imbalance problem because the sample sizes of the subdivided syndromes are the same. Therefore, the trained model can accurately predict the major category syndromes, subdivided syndromes and syndrome factors, thereby further eliminating the impact of sample size imbalance on the prediction degree, avoiding overfitting, and improving the prediction accuracy.
[0028] Specifically, the constructed 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.
[0029] During implementation, the first feature extraction module may adopt an existing NLP model structure.
[0030] The syndrome factor classification module, the major syndrome prediction module, and the detailed syndrome prediction module can adopt the existing multi-classifier structure.
[0031] During implementation, the major syndrome prediction module integrates the syndrome element information and predicts the major syndrome based on the first feature and the syndrome element prediction result. Specifically, the major syndrome prediction module predicts the major syndrome of the sample based on the first feature and the syndrome element prediction result, including: The first feature is combined with the syndrome factor prediction structure to predict the major syndromes of the sample.
[0032] During implementation, in order to improve the accuracy of subdivided syndrome prediction, the subdivided syndrome prediction module includes: 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.
[0033] First, we hope that the invariant features can better distinguish whether the samples have combined major syndromes, that is, to extract the common features of small sample syndromes, and use variable features to assist in distinguishing different sub-syndromes in the combined major syndromes.
[0034] During implementation, the feature decomposition module decomposes the first feature through the mask matrix. The mask matrix M is introduced, that is, the matrix size is the same as the first feature, and the unchanged feature , variable features The value of the mask matrix M is obtained by model learning. represents the first feature of the i-th patient.
[0035] When implemented, the third classifier is a binary classifier , whose output Indicates the probability that there is no combined major syndrome in the sample.
[0036] The fourth classifier is multi-classification, expressed as , whose output is the probability that the sample has the kth subdivided syndrome.
[0037] During implementation, 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.
[0038] When implemented, the combined loss of syndrome factor prediction and major syndrome prediction is: ; ; ; in, The predicted loss of major syndromes is shown. Indicates the predicted loss of the certificate element, Indicates whether the i-th sample has the label of the J-th major syndrome, It indicates the probability of whether the i-th sample predicted by the model has the J-th major syndrome. Indicates whether the i-th sample has the label of the k-th evidence element, It indicates the probability of whether the i-th sample predicted by the model contains the k-th evidence. represents the weight, n represents the number of samples in the current training batch, Indicates the number of major syndromes. The number of types of evidence.
[0039] Specifically, the following formula is used to calculate the prediction loss of the subdivided syndrome: ; ; ; in, represents the invariant feature of the i-th sample, Indicates whether the i-th sample has the label of the j-th subdivision syndrome, It indicates the probability of whether the i-th sample has the j-th subdivision syndrome predicted by the model. represents the third classifier, Indicates whether the i-th sample has a label for merging major syndromes. If yes, it is 1, otherwise it is 0. represents the weight, n represents the number of samples in the current training batch, Indicates the number of subdivided syndromes.
[0040] By merging the classification of major syndromes and prediction of subdivided syndromes based on invariant and variable features, and adding classification and subdivided syndrome prediction losses, the accuracy of subdivided syndrome prediction can be improved.
[0041] During implementation, the gradient of the neural network is back-propagated 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, reaches the preset loss accuracy or number of iterations, the training is stopped to obtain a trained syndrome prediction model.
[0042] For the patient to be predicted, the text description of his / her symptoms is converted into initial features; the trained syndrome prediction model is input 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.
[0043] In order 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.
[0044] Specifically, in step S2, based on the text description of the symptoms of the patient to be predicted, a large language model is used to determine the second probability that the patient to be predicted has each major syndrome and subdivided syndrome, 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.
[0045] During implementation, we 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 Chinese medicine expert. Based on {patient symptom description}, please give the probability that the patient belongs to each syndrome in {syndrome name list}." Where {patient symptom description} represents the patient's symptom description text X, and {syndrome name list} represents the name list of all syndromes we want to predict. The return result of LLM is recorded as , represents the probability of each syndrome in the patient to be predicted predicted by the large language model. Where N is the number of syndrome types, , Indicates the number of subdivided syndromes, Indicates the number of major syndromes, Indicates the number of syndromes for which the sample size exceeds the first prediction.
[0046] In order to ensure that the sum of all probabilities is 1, the probability corresponding to each syndrome is normalized to obtain the second probability of the patient to be predicted having each syndrome (including subdivided syndromes and other major syndromes except the combined major syndromes), and the probabilities of all subdivided syndromes are added up as the second probability of the combined major syndrome. The second probability vector of the patient to be predicted having each major syndrome Expressed as .
[0047] Specifically, based on the text description of the symptoms of the patient to be predicted, 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.
[0048] During implementation, the existing constructed TCM knowledge graph can be used.
[0049] Extract the symptoms from the text description of the patient to be predicted. For each symptom, query the syndrome corresponding to the symptom in the knowledge graph to obtain the associated features corresponding to each symptom.
[0050] If the knowledge graph records the relationship between nodes, the association feature is expressed as ,in, Indicates whether the kth symptom is associated with the first syndrome, and the value is 0 or 1, and so on. Indicates whether the kth symptom is associated with the Nth syndrome.
[0051] If the knowledge graph records the association weights between nodes, the association feature is expressed as ,in, represents the association weight between the kth symptom and the first syndrome, and so on. It represents the association weight between the kth symptom and the Nth syndrome, and its value ranges from 0 to 1.
[0052] Add up the correlation features corresponding to all symptoms of the patient to be predicted to obtain the correlation features of the patient to be predicted , perform softmax operation on KG to obtain the third probability of each syndrome (including subdivided syndromes and other major syndromes except combined major syndromes) in the patient to be predicted. The third probabilities of all subdivided syndromes are summed up as the third probability of the combined major syndrome. The third probability vector of each major syndrome in the patient to be predicted is Expressed as .
[0053] Specifically, based on the first probability, the second probability and the third probability of the patient to be predicted having each major syndrome, the comprehensive probability of the patient to be predicted having each major syndrome 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, It represents the comprehensive probability vector of the presence of each major syndrome in the patient to be predicted.
[0054] During implementation, for each major syndrome, due to the high accuracy of the knowledge graph, the first probability and the third probability are aggregated first, and then the features are transformed through the neural network to obtain , then Aggregate with the second probability and transform its features through the neural network to obtain ,Will and Combining, that is, using the residual connection method, a more accurate comprehensive probability is obtained.
[0055] Specifically, the similarity between the patient to be predicted and each subdivided syndrome is obtained in the following manner: S31, 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; S32, extracting variable features and syndrome factor prediction results of the patient to be predicted based on the trained syndrome prediction model; splicing the variable features and syndrome factor prediction results of the patient to be predicted to obtain features to be compared of the patient to be predicted; S33, calculating 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; S34. Calculate the similarity between the patient to be predicted and each subdivided syndrome based on the similarity between the patient to be predicted and each sample to be compared.
[0056] During implementation, samples with subdivided syndromes are first extracted as samples to be compared, that is, the patients to be predicted are compared with the samples to be compared.
[0057] Then, the variable features of each sample to be compared are obtained based on the trained syndrome prediction model. Prediction results of syndrome factors , after splicing, we get the features to be compared of the samples to be compared .
[0058] Similarly, the variable features of the patient to be predicted and the syndrome factor prediction results are concatenated to obtain the features to be compared q of the patient to be predicted.
[0059] 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. .
[0060] Specifically, 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, including: For each subdivided syndrome, the average of the similarities between all samples to be compared and the patient to be predicted that have the subdivided syndrome is taken as the similarity between the patient to be predicted and the subdivided syndrome.
[0061] Specifically, 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, the comprehensive probability that the patient to be predicted has each subdivided syndrome is obtained: 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 prediction probability of the jth subdivision syndrome in the patient to be predicted ; 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.
[0062] The prediction probability of the subdivided syndromes is adjusted through the second probability and the third probability to eliminate bias and improve the accuracy of the prediction.
[0063] During implementation, the second probability of each subdivided syndrome in the predicted patient is normalized by dividing the second probability of each subdivided syndrome by the sum of the second probabilities of the subdivided syndromes, so that the sum of the second probabilities of each subdivided syndrome is 1. Similarly, the third probability of each subdivided syndrome in the predicted patient is normalized by dividing the third probability of each subdivided syndrome by the sum of the third probabilities of the subdivided syndromes, so that the sum of the third probabilities of each subdivided syndrome is 1.
[0064] The syndrome of the patient to be predicted is obtained based on the comprehensive probability of each major syndrome and each subdivided syndrome in the patient to be predicted. During implementation, the major syndrome and subdivided syndrome with a comprehensive probability greater than a second threshold are the syndromes of the patient to be predicted. The second threshold is, for example, set to 0.6.
[0065] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0066] 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 changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within 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; The syndrome of the patient to be predicted is obtained based on the comprehensive probability of each major syndrome and each subdivided syndrome.
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: 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, It represents the comprehensive probability vector of the presence of each major syndrome in the patient to be predicted.
5. 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.
6. The TCM syndrome prediction method integrating a large language model and a knowledge graph according to claim 5 is characterized in that: 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.
7. 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.
8. The TCM syndrome prediction method integrating a large language model and a knowledge graph according to claim 7 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.
9. The TCM syndrome prediction method integrating a large language model and a knowledge graph according to claim 8, 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.
10. The TCM syndrome prediction method integrating a large language model and a knowledge graph according to claim 8, 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
Rheumatoid joint traditional Chinese medicine syndrome prediction model construction method and prediction method
CN119008024A
Traditional Chinese medicine question and answer method, device and equipment based on large language model and medium
CN119092157A
Method and system for predicting syndromes by fusing multi-graph convolution and ontology knowledge
CN119207726A