Physique identification method and system based on syndrome element knowledge graph and attention mechanism
By combining the knowledge graph of syndrome elements with the attention mechanism, the problem of insufficient information integration in TCM constitution identification is solved, realizing intelligent identification of TCM "four diagnostic methods", and improving accuracy and interpretability.
Patent Information
- Application Number
- CN202511380271.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-25
- Publication Date
- 2026-02-13
AI Technical Summary
Existing technologies struggle to effectively integrate information from the four diagnostic methods of traditional Chinese medicine, resulting in insufficient accuracy and generalization ability in identifying constitutions in traditional Chinese medicine. Furthermore, existing methods are costly to construct and difficult to simulate the diagnostic thinking of traditional Chinese medicine.
By employing a knowledge graph of syndrome elements and an attention mechanism, we construct a knowledge graph of syndrome elements, learn the embedding vectors of syndrome elements using a graph neural network, and train a model that integrates the four diagnostic methods (inspection, diagnosis, and treatment) using an attention mechanism. This simulates the diagnostic thinking of a traditional Chinese medicine practitioner and dynamically focuses on key syndrome elements.
It significantly improves the accuracy and robustness of constitution identification, can understand the nonlinear relationships between syndrome elements, provides interpretable diagnostic results, and enhances the model's generalization ability and clinical applicability.
Smart Images

Figure CN121528563A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of medical information processing and artificial intelligence technology, and in particular to a method and system for constitution identification based on evidence knowledge graphs and attention mechanisms. Background Technology
[0002] Traditional Chinese medicine has a long history of application in disease diagnosis and treatment and health management. Its core concept is "syndrome differentiation and treatment," which involves comprehensively analyzing information from the four diagnostic methods (inspection, auscultation and olfaction, inquiry, and palpation) to determine the patient's syndrome state and constitution type. Among these methods, "integrated diagnosis using the four diagnostic methods" is the fundamental principle to ensure the comprehensiveness and accuracy of diagnosis.
[0003] Currently, some studies have attempted to utilize modern technologies such as computer vision, natural language processing, and signal analysis to assist in TCM constitution identification. For example, tongue diagnosis systems based on tongue images can identify tongue texture and coating characteristics through image segmentation and classification algorithms; pulse diagnosis systems based on pulse wave signals can collect pulse images through sensors and perform feature matching; and text-based consultation systems obtain symptom information through user interaction and perform rule or model reasoning. However, most of these technologies are based on single diagnostic information, resulting in information bias and making it difficult to reproduce the holistic view of TCM's "four diagnostic methods combined."
[0004] To overcome the limitations of single-information approaches, existing research has proposed multi-information fusion methods. A common practice is to simply concatenate different diagnostic features and input them into a classifier. However, this method fails to capture the complex semantic relationships between different syndrome elements and cannot simulate the dynamic thinking pattern of physicians focusing on key symptoms during diagnosis, easily leading to misjudgments. In addition, expert systems based on artificial rules have also been attempted, but their construction costs are high, their generalization ability is poor, and they are difficult to adapt to complex and ever-changing clinical situations. Summary of the Invention
[0005] To overcome the shortcomings of existing technologies, the technical problem to be solved by this invention is to propose a constitution identification method and system based on evidence knowledge graphs and attention mechanisms, and the following technical solution is adopted: The constitution identification method based on evidence element knowledge graph and attention mechanism includes the following steps: S1: Obtain manually labeled case data, which includes the patient's four diagnostic methods information as well as the corresponding syndrome element set and constitution category. The four diagnostic methods information includes one or more of the following: tongue image, facial image, consultation text, and pulse waveform. S2: Based on the set of syndrome elements from multiple cases, construct a syndrome element knowledge graph. In the above syndrome element knowledge graph, nodes represent different syndrome elements, edges represent the relationships between different syndrome elements, and the weights of the edges are determined based on the degree of correlation between syndrome elements and the constitution category. S3: Use a graph neural network to train the above evidence element knowledge graph to obtain the embedding vector of each evidence element, and construct an evidence element embedding vector library. S4: Based on the above syndrome element embedding vector library and the constitution categories of the above case data, perform training of the four diagnostic parameters model: input the syndrome element embedding vector sequence of the case into the attention mechanism, calculate the diagnostic weight of each syndrome element, perform weighted aggregation of the syndrome element embedding vector according to the above weights to obtain the sample feature vector, input the above sample feature vector into the classifier to output the corresponding constitution category probability. S5: For the target patient to be identified, collect their four diagnostic methods information and extract their corresponding syndrome element set. Obtain the corresponding syndrome element embedding vector sequence according to the above syndrome element embedding vector library and input it into the trained four diagnostic methods combined parameter model to obtain the constitution category of the target patient.
[0006] As a further improvement, in step S2, the correlation between the aforementioned evidence elements is determined based on at least one of the co-occurrence frequency of evidence elements in the same case, point mutual information, or semantic similarity.
[0007] As a further improvement, in step S2, the edge weights are corrected by the physical type to satisfy: ; in, λ represents the corrected edge weight; λ is the weighting coefficient, with a value range of [0,1]; PMI(i,j) represents the point mutual information between evidence element i and evidence element j; P(i,j|c) represents the conditional probability that evidence element i and evidence element j appear simultaneously under physical category c; P(c) represents the prior probability of physical category c; and C is the total number of physical categories.
[0008] To further improve the process, the above evidence element knowledge graph is sparsified: for each evidence element node, only its top k neighboring edges by edge weight are retained, and edge weight scaling is performed on hub nodes with a degree greater than a threshold. ; in, This represents the scaled edge weights; d i and d j Let i and j be the degrees of node i and node j, respectively.
[0009] As a further improvement, in step S3, the training objective function of the above-mentioned graph neural network introduces a graph Laplacian regularization term, which is defined as: ; Among them, L graph For graph regularization loss; v i and v j Let E be the embedding vector of the element node; E is the set of edges.
[0010] As a further improvement, during the training of the four diagnostic parameters model in step S4, the total loss function is: ; Among them, L task The cross-entropy loss is used for body type classification, where μ and β are hyperparameters; L center The cohesion constraint loss is used to constrain the feature vector z of samples belonging to the same physical category. i The center vector closest to the body type c is defined as the trainable prototype vector m of body type c. c L center satisfy: ; L inter For the separation constraint loss between body types, the center vectors of different body types are constrained to maintain the margin, L inter satisfy: .
[0011] As a further improvement, in step S4, the attention mechanism introduces a trainable prior vector g related to the body type when calculating the weights. c Its weight is calculated as follows: ; Where, α i The attention weights for element i; v i The embedding vector of element i; g c* Let c be the prior vector of the current candidate physical fitness category. * =argmax c p(c) represents the candidate physical type with the highest probability.
[0012] As a further improvement, the aforementioned four-diagnostic parameter-based model is also used to generate an explanation matrix. , where matrix elements The contribution of characteristic factor i to constitution category c is calculated as follows: ; Where σ(·) is the activation function; m c Let c be the trainable prototype vector of the physical category c.
[0013] Another aspect of the present invention provides a constitution identification system based on evidence knowledge graphs and attention mechanisms, used to execute the constitution identification method proposed in any of the above embodiments, including: The database module is used to store the four diagnostic methods information, syndrome element set, and constitution category of the case. The graph construction module is used to generate a knowledge graph of evidence elements. The nodes mentioned above are evidence elements, and the weights of the edges are determined based on the correlation between evidence elements and the body type. The graph neural network training module is used to transform the above-mentioned evidence element knowledge graph into evidence element embedding vector representations and form an evidence element embedding vector library. The four diagnostic methods combined model includes an attention mechanism layer and a classifier, which are used to train and output the constitution category and syndrome weights. The online reasoning module includes a syndrome element extraction submodule, an embedding vector query submodule, and a constitution discrimination submodule. It is used to collect the four diagnostic methods information of the target patient, extract the syndrome element set and query the embedding vector, input the above four diagnostic methods parameter model, and output the constitution category through the attention mechanism and classifier.
[0014] As a further improvement, the above-mentioned four-diagnosis combined model performs temperature calibration on the output constitution category probability: ; in, z is the calibrated class probability. c The output logic value is for category c; T > 0 indicates the calibration temperature parameter.
[0015] Compared with the prior art, the beneficial effects of the present invention are: Firstly, this invention constructs a knowledge graph of syndrome elements and utilizes graph neural networks to learn the embedding vectors of these elements, transforming the complex synergistic and antagonistic relationships between TCM syndrome elements into quantifiable mathematical representations. Specifically, in constructing the graph, an edge weight calculation method modified by constitution category is employed, ensuring that the knowledge graph not only covers the statistical correlations between syndrome elements but also embeds the syndrome logic of TCM diagnosis and treatment. These measures significantly improve the accuracy and depth of constitution identification, enabling the model to understand semantic associations, such as the combination of "yellow and greasy tongue coating" and "slippery and rapid pulse" pointing to "damp-heat constitution." This overcomes the shortcomings of existing technologies where simple feature splicing fails to reveal the nonlinear relationships between syndrome elements, achieving progress from static feature recognition to intelligent diagnostic reasoning.
[0016] Secondly, this invention introduces an attention mechanism into the four diagnostic methods combined model and further employs trainable prior vectors related to constitution categories to calculate diagnostic weights. This simulates the thought process of a traditional Chinese medicine practitioner "grasping the main symptoms," enabling adaptive focusing on the most critical core elements for constitution assessment in specific cases. Simultaneously, by generating an explanatory matrix to quantify the contribution of each element to different constitution categories, the diagnostic results are no longer a black box output but rather have traceable decision-making basis. For example, it can clearly indicate that the judgment of "Qi deficiency constitution" is mainly based on "fatigue and weakness" and "weak pulse," thereby enhancing the reliability and clinical applicability of the results.
[0017] Thirdly, this invention improves training efficiency and model stability during graph construction through sparsification and edge weight scaling. During training, a graph Laplacian regularization term is introduced to maintain the consistency of adjacent element embeddings, and the cohesion and separation constraints of constitutions enhance the discriminative power of different constitution categories. Furthermore, temperature calibration is performed during the output stage to avoid inflated or distorted model probability predictions, making the output probabilities more consistent with actual diagnostic reliability. These measures collectively improve the robustness, generalization ability, and practical value of the final model, enabling the system to effectively filter noise interference, make more accurate judgments on atypical cases, and output more reliable and user-friendly diagnostic conclusions, providing a solid technical guarantee for large-scale automated TCM constitution identification. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained from these drawings without creative effort.
[0019] Figure 1 This is a flowchart of the steps of the method of the present invention; Figure 2 This is a schematic diagram of the framework connection of the system of the present invention; Figure 3 This is a flowchart illustrating an embodiment of the method of the present invention. Detailed Implementation
[0020] To facilitate understanding by those skilled in the art, the structure of the present invention will now be described in further detail with reference to the accompanying drawings: In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. The terms "section," "side," "end," etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as limiting the invention. like Figure 1 As shown, this application provides a constitution identification method based on evidence knowledge graph and attention mechanism. The steps will be explained one by one below.
[0021] Step S1: Obtain manually labeled case data. The case data includes the patient's four diagnostic methods information, as well as the corresponding syndrome element set and constitution category. The four diagnostic methods information includes one or more of the following: tongue image, facial image, consultation text, and pulse waveform.
[0022] Specifically, in this embodiment, a high-quality case database needs to be constructed first, serving as the foundation for subsequent model training and constitution identification. This database consists of manually annotated case data. Each case is comprehensively interpreted by a senior TCM physician using the "four diagnostic methods" (inspection, auscultation, palpation, and olfaction), and its syndrome element set and final constitution result are annotated one by one. The case data includes at least the original information from the four diagnostic methods, the syndrome element set, and the constitution category.
[0023] The original information from the four diagnostic methods further includes tongue images, facial images, medical history texts, and pulse waveforms. Tongue images are captured using high-definition cameras to extract features such as tongue color, coating thickness, and tongue shape. Facial images record the patient's skin tone, luster, and morphological features using facial recognition devices, serving as important evidence for assessing the state of Qi and blood and the function of internal organs. Medical history texts are obtained through structured questionnaires or electronic medical records from doctors, capturing information about the patient's self-reported symptoms and lifestyle habits, such as "aversion to cold and preference for warmth" and "bitter taste and dry mouth." Pulse waveforms are recorded using time-series signals of the radial artery pulse through sensors such as pulse diagnostic instruments, used to analyze characteristics such as slowness, rapidity, slipperiness, and roughness of the pulse.
[0024] Furthermore, the syndrome element set is a standardized set of syndrome elements that physicians summarize and select based on the information from the four diagnostic methods mentioned above. For example, a tongue appearance showing "yellow and greasy tongue coating", a pulse appearance showing "slippery and rapid pulse", a complexion showing "dull and lackluster" and a symptom of "bitter taste in the mouth" can all serve as syndrome element labels for this case.
[0025] In addition, the constitution category is determined by the physician's overall assessment of the case, identifying it as one of the nine major TCM constitutions, such as "Qi deficiency constitution," "damp-heat constitution," and "Yin deficiency constitution," and this is used as the final classification label.
[0026] The case database constructed in this way contains multimodal information such as images, text, and signals, and integrates expert knowledge sets of syndrome elements and constitution diagnosis results, providing a solid data foundation for subsequent construction of syndrome element knowledge graphs and training of deep models. Compared with existing single-source data, this database can comprehensively reflect the symptom characteristics of patients, ensuring that the knowledge learned by the model conforms to the diagnostic principle of "combining the four diagnostic methods," thereby improving the scientificity and accuracy of constitution identification.
[0027] Step S2: Based on the set of syndrome elements from multiple cases, construct a syndrome element knowledge graph. In the syndrome element knowledge graph, nodes represent different syndrome elements, edges represent the relationships between different syndrome elements, and the weights of the edges are determined based on the degree of correlation between syndrome elements and the constitution category.
[0028] In this step, based on the set of syndrome elements from multiple cases obtained in step S1, a syndrome element knowledge graph is constructed to express the relationships between TCM syndrome elements. The core objective of this knowledge graph is to transform the "synergistic and antagonistic relationships between syndrome elements" in doctors' experience into a quantifiable mathematical representation, thereby laying the foundation for subsequent graph neural network training and constitution identification models.
[0029] First, in the graph construction, each node represents a unique and standardized syndrome element. For example, "yellow and greasy tongue coating," "slippery and rapid pulse," and "fatigue and weakness" are all included in the graph as separate nodes. Next, statistical calculations are needed on the case database to determine the edges between different syndrome elements and their weights.
[0030] In calculating the weights, this invention comprehensively considers two factors: statistical co-occurrence frequency and TCM constitution category information. On the one hand, it statistically analyzes the frequency of two syndrome elements appearing together in the same case, or calculates their point mutual information (PMI) index to quantify their basic correlation. On the other hand, it introduces a constitution category correction mechanism, which weights and fuses the "conditional probability of syndrome elements i and j appearing simultaneously under a certain constitution category c" with the overall probability, so that the edge weights can reflect the specific coupling relationship between "syndrome element-constitution".
[0031] Specifically, the corrected edge weights satisfy the following formula:
[0032] in, The modified edge weights are represented by λ, which is a weighting coefficient ranging from [0,1]. PMI(i,j) represents the point mutual information between evidence element i and evidence element j. P(i,j|c) represents the conditional probability that evidence elements i and j co-occur under constitution category c. P(c) represents the prior probability of constitution category c, and C is the total number of constitution categories. Through this modified formula, the edge weights between evidence elements not only reflect the statistical co-occurrence strength but also embed the constitution diagnosis logic, enabling the knowledge graph to more realistically reflect clinical experience.
[0033] Furthermore, to improve the sparsity and computational efficiency of the graph, edge weights are constrained and filtered. This invention employs a dual strategy of "sparsening + scaling".
[0034] Specifically, sparsification involves retaining only the top k nearest neighbors with the highest edge weights for each element node, discarding the rest of the weakly related edges to ensure the graph is compact and key information is highlighted. Edge weight scaling, on the other hand, is applied to core nodes with high degrees. To prevent them from excessively dominating the propagation process during subsequent training, their edge weights are normalized and scaled.
[0035] In one specific embodiment, the scaling formula is as follows:
[0036] in, This represents the scaled edge weights; d i and d j Let be the degrees of node i and node j, respectively. This formula ensures that the influence of nodes with different degrees is balanced during graph propagation, thereby enhancing the stability and generalization ability of the model.
[0037] Through the above steps, the resulting syndrome element knowledge graph not only reflects the statistical characteristics of the case data but also integrates the TCM logic of constitution identification, possessing clinical interpretability. The syndrome element knowledge graph generated in this way can clearly represent the combination relationship of syndrome elements such as "yellow and greasy tongue coating" and "slippery and rapid pulse" within the graph structure, and correspond them to constitution categories such as "damp-heat constitution." This allows the graph neural network to receive information input containing combinational associations during embedding learning.
[0038] Step S3: Use a graph neural network to train the evidence element knowledge graph to obtain the embedding vector of each evidence element, and construct an evidence element embedding vector library.
[0039] In step S3, a graph neural network is used to train the previously constructed syndrome element knowledge graph to obtain the embedding vector of each syndrome element node, thereby establishing a syndrome element embedding vector library. Specifically, the graph structure processed by sparsification and normalization in step S2 is first used as input. The graph neural network performs feature propagation and aggregation operations between nodes sequentially, enabling each syndrome element node to encode the semantic relationships and synergistic patterns between neighboring syndrome elements in its low-dimensional dense representation. For example, when "yellow and greasy tongue coating" and "slippery and rapid pulse" have a high co-occurrence in the knowledge graph, their corresponding embedding vectors will be closer after training, reflecting their synergistic significance in TCM syndrome differentiation.
[0040] In this training process, a graph Laplacian regularization term is introduced as an important component of the objective function, and its loss function is defined as:
[0041] Among them, L graph For graph regularization loss; v i and v j Let E be the embedding vector of the evidence element node; E is the set of edges. The role of this regularization term is to constrain the graph neural network to keep the embedding vector distance between strongly related evidence element nodes as close as possible during the learning process, thereby ensuring that the model can correctly capture the pathological relationship between evidence elements, rather than just staying at the level of isolated node representation.
[0042] After training, the system obtains a stable database of evidence element embedding vectors. In subsequent constitution identification tasks, the set of evidence elements contained in any case can be quickly converted into corresponding vector sequences by querying this database. These embedding vectors not only contain independent information about individual evidence elements but also carry their neighborhood relationships within the overall knowledge graph, providing high-quality input data support for the dynamic weight allocation of the subsequent attention mechanism.
[0043] In this way, step S3 lays a crucial data representation foundation for the final four diagnostic methods combined model, enabling the model to better understand the deeper pathological meaning behind the combination of syndrome elements when faced with complex cases.
[0044] Step S4: Based on the syndrome element embedding vector library and the constitution categories of case data, perform training of the four diagnostic parameters model: input the syndrome element embedding vector sequence of the case into the attention mechanism, calculate the diagnostic weight of each syndrome element, perform weighted aggregation of the syndrome element embedding vector according to the weight to obtain the sample feature vector, input the sample feature vector into the classifier to output the corresponding constitution category probability.
[0045] In step S4, after obtaining a stable evidence element embedding vector library, this step uses this vector library and the patient's constitution category to train the four diagnostic methods combined model. The system takes the patient evidence element embedding vector sequence generated in step S3 as input and combines it with the corresponding constitution category to train the four diagnostic methods combined model. The core of this step is to introduce an attention mechanism to achieve dynamic focusing on key evidence elements, thereby simulating the diagnostic thinking of a traditional Chinese medicine practitioner who "grasps the main symptom".
[0046] First, for a given training case, the name of each element in its element set is queried from the element embedding vector library to obtain its corresponding embedding vector, forming an element vector sequence. This sequence is then input into the attention mechanism layer. In this mechanism, the system no longer treats all elements equally, but instead assigns each element an attention weight related to the current constitution category.
[0047] Specifically, when calculating the attention weights, a prior vector g of the physical constitution category is introduced. c This refers to the predefined or learned trainable vector for each type of constitution during the training process. For the embedding vector v of the i-th constitution element in a case... i Its attention weight α i The calculation method is as follows:
[0048] Where, α i v represents the attention weight of element i. i Let g represent the embedding vector of element i. c*Let c be the prior vector of the current candidate constitution category. Using this formula, the model can dynamically calculate the importance of each element in diagnosis based on the semantic information of the candidate constitution categories.
[0049] Furthermore, to enhance the interpretability of the model, the system constructs an interpretation matrix based on the attention mechanism. , where matrix elements This represents the contribution of factor i to constitution category c. Its calculation method is as follows:
[0050] Where σ(·) is the activation function; m c Let be the trainable prototype vector for constitution category c. Through this interpretation matrix, the model can not only output the final constitution category prediction result, but also intuitively display the contribution degree of each element under different constitution categories. For example, when the system determines that a patient has a "Qi deficiency constitution," it can clearly show that "fatigue" and "weak pulse" have the highest contribution in the determination, thus providing doctors with transparent diagnostic evidence.
[0051] Finally, the system inputs the attention-weighted feature vector of the syndrome elements into a classifier, such as a fully connected neural network (MLP), and outputs the probability distribution of the case under nine constitution categories. By minimizing the difference between the predicted probability and the actual constitution category, the training of the four diagnostic methods combined with the physical examination is completed. This step ensures that the model achieves automated classification while possessing high interpretability and robustness, providing a reliable diagnostic reference for clinical practice.
[0052] During the training of the four diagnostic parameters model in step S4, the model's total loss function not only includes the loss from the physical constitution classification task itself, but also incorporates multiple regularization constraint terms, which are as follows:
[0053] Among them, L task The cross-entropy loss is used for body type classification, with μ and β being hyperparameters. To further improve the separability and discriminative power of the feature space, the following two constraints are introduced into the training objective: Volumetric cohesion constraint loss L center This term is used to constrain the feature vector z of samples within the same physical category. i The center vector closest to the body type c, where the center vector is defined as the trainable prototype vector m of body type c. c L center Defined as Among them, S c Let z represent the set of samples belonging to physical category c. i Let m be the feature vector of sample i. cLet be the center vector of body type c. Minimizing this term ensures that the representations of samples of the same type tend to be concentrated in the embedding space, thereby improving the model's ability to characterize the internal consistency of body types.
[0054] Interbody separation constraint loss L inter This term is used to constrain the center vectors of different body types to maintain a margin. The center vectors are represented by the trainable prototype vectors of the corresponding body type c. inter Defined as , where m c and m d ...
[0055] In the loss function described above, μ and β are hyperparameters used to adjust the weights of each loss term. These weights are optimized during training. center With L inter The model can maintain classification accuracy while taking into account the semantic relationships between syndrome elements, the compactness within the constitution category, and the separability between categories, ultimately achieving a more robust and interpretable TCM constitution identification.
[0056] Step S5: For the target patient to be identified, collect their four diagnostic methods information and extract their corresponding syndrome element set. Obtain the corresponding syndrome element embedding vector sequence according to the syndrome element embedding vector library and input it into the trained four diagnostic methods combined parameter model to obtain the constitution category of the target patient.
[0057] In step S5, for the target patient to be identified, their four diagnostic methods (palpation, palpation, inquiry, and olfaction) information is first collected. This information includes one or more of the following: tongue image, facial image, medical history text, and pulse waveform data. Subsequently, the raw data is parsed and standardized using a pre-trained basic model to automatically extract the set of syndrome elements related to the patient.
[0058] After obtaining the set of syndrome elements, the system queries the names of each syndrome element in the set one by one according to the syndrome element embedding vector library constructed in step S3, and converts them into corresponding embedding vectors, thus forming a sequence of syndrome element embedding vectors. This sequence of embedding vectors can comprehensively reflect the symptom characteristics of the target patient and their potential related semantics, and serves as direct input data for subsequent identification.
[0059] The embedded vector sequence is input into the four diagnostic methods combined model that has been trained and deployed in step S4. The model first uses an attention mechanism to weight the importance of different syndrome elements, dynamically focusing on the key syndrome elements that best represent the constitution of the target patient. For example, in a case with a tendency towards damp-heat constitution, the model will automatically give higher weights to "yellow and greasy tongue coating" and "slippery and rapid pulse," while assigning lower weights to more general syndrome elements such as "fatigue and weakness."
[0060] After weighted aggregation, the model generates a single vector that comprehensively represents the physical characteristics of the target patient, and inputs this vector into the classifier for final judgment. The classifier outputs the probability distribution of the patient belonging to one of the nine physical constitution categories (such as Qi deficiency, Yang deficiency, damp-heat, etc.). For example, the system might output "95% probability of damp-heat constitution, 3% probability of Qi deficiency constitution, and 2% probability of balanced constitution".
[0061] To enhance the interpretability of diagnoses, the model also outputs corresponding decision criteria based on attention weights and the interpretation matrix. For example, the system can display "This patient is diagnosed with damp-heat constitution, mainly based on yellow and greasy tongue coating (weight 0.42), slippery and rapid pulse (weight 0.37), and bitter taste in the mouth (weight 0.15)." This result not only increases users' trust in the model but also provides doctors with clear references, assisting in clinical decision-making.
[0062] Through step S5, the entire solution realizes the complete process from the collection of original case data to the extraction of syndrome element sets, and then to the embedding representation and reasoning of the four diagnostic methods model. Finally, it outputs the constitution category of the target patient and its basis, meeting the objectivity and intelligence requirements of TCM constitution identification.
[0063] Based on the detailed process description of steps S1 to S5 above, in order to facilitate a more intuitive understanding of the overall operating logic of the present invention, the complete implementation process of the TCM constitution identification method will be further explained below with reference to the accompanying drawings.
[0064] like Figure 3 As shown, the TCM constitution identification method of the present invention can be divided into two main stages: the offline training stage and the online reasoning stage.
[0065] In the offline training phase, the four diagnostic methods (inspection, auscultation and olfaction) information of patients, along with their corresponding syndrome element sets and constitution categories, are first extracted from a manually annotated case database. The database includes tongue images, facial images, consultation text, and pulse waveforms. Next, a syndrome element knowledge graph is constructed based on the syndrome element sets of all cases. Each unique syndrome element serves as a node in the graph, and relationships between different syndrome elements are represented by edges. The edge weights are calculated based on the co-occurrence frequency or mutual information between syndrome elements. Subsequently, the generated graph is input into a graph neural network for training, learning the embedding representation of each syndrome element and constructing a syndrome element embedding vector library. Based on this embedding library, a four diagnostic methods synergistic model incorporating attention mechanisms and a classification network can be further trained to learn and predict the constitution category of cases.
[0066] During the online inference phase, when a new object to be identified is encountered, the system first collects its information from the four diagnostic methods of observation, auscultation, inquiry, and palpation, and extracts the corresponding set of syndrome elements. Then, using a syndrome element embedding vector library, the set of syndrome elements is converted into a corresponding vector sequence, which is then input into the trained four-diagnostic-parameter model. Within the model, an attention mechanism assigns diagnostic weights to different syndrome elements, highlighting the primary syndrome elements that are more crucial for constitution identification. Then, through weighted aggregation, a unified feature vector representing the patient's overall condition is generated. Finally, this feature vector is input into a fully connected classifier (MLP), which outputs the probability distribution of each constitution category and generates the final constitution identification result, such as "95% probability of damp-heat constitution."
[0067] Through the above process, this invention can model and calculate the complex relationships between syndrome elements by using graph neural networks and attention mechanisms while retaining the logic of the four diagnostic methods in traditional Chinese medicine. This significantly improves the accuracy and robustness of constitution identification while ensuring the interpretability of the results.
[0068] like Figure 2 As shown, another aspect of the present invention provides a constitution identification system based on evidence knowledge graphs and attention mechanisms, used to execute the constitution identification method proposed above, including: The database module stores case data annotated by senior TCM physicians. The database contains information from the four diagnostic methods (tongue, face, pulse waveform, and patient history), as well as standardized sets of syndrome elements extracted by doctors and their corresponding constitution categories, providing fundamental support for subsequent atlas construction and model training. The graph construction module is used to generate a knowledge graph of syndrome elements. It iterates through all syndrome element sets in the database, extracting unique syndrome element names as graph nodes; then, it establishes graph edges based on the co-occurrence frequency or mutual information of syndrome elements in the same case, assigning weight values to form a weighted graph reflecting the degree of semantic association between syndrome elements. This graph can be used to construct combined associations such as "yellow and greasy tongue coating, slippery and rapid pulse, and bitter taste in the mouth." The graph neural network training module inputs the aforementioned evidence element knowledge graph into a graph neural network, such as GAT or GraphSAGE, and obtains the embedding vector representation of each evidence element through a message passing mechanism. These embedding vectors not only contain the feature information of the evidence element, but also encode the contextual relationship with surrounding evidence elements, ultimately forming a queryable evidence element vector library.
[0069] The four diagnostic methods combined model includes an attention mechanism and a classification network. During training, the set of syndrome elements in the case is first converted into an embedding sequence through a vector library. Then, the attention mechanism dynamically assigns diagnostic weights to achieve a focusing logic similar to "grasping the main symptom". The embedding sequence is then weighted and aggregated to obtain a unique patient representation vector, which is input into a fully connected classifier to output the corresponding constitution category probability distribution. Finally, a deployable four diagnostic methods combined model is trained.
[0070] The online reasoning module includes a syndrome element extraction submodule, an embedding vector query submodule, and a constitution discrimination submodule. It is used to collect the four diagnostic methods information of the target patient, extract the syndrome element set and query the embedding vector, input the four diagnostic methods parameter model, and output the constitution category through the attention mechanism and classifier.
[0071] The four diagnostic methods combined with the parameter model performs temperature calibration on the output probability of constitution category: ; in, z is the calibrated class probability. c The output logic value is for category c; T > 0 indicates the calibration temperature parameter. The temperature parameter T is obtained through validation set tuning to smooth the probability distribution, avoid overconfidence or excessive uncertainty, and thus improve the stability of the diagnostic results.
[0072] In summary, this invention achieves intelligent identification of TCM constitution by constructing a knowledge graph of syndrome elements, using graph neural networks to learn syndrome element embeddings, combining an attention-based model of the four diagnostic methods, and implementing an online reasoning application process. This invention not only comprehensively simulates the diagnostic logic of the TCM "four diagnostic methods," but also dynamically adjusts the diagnostic focus according to the characteristics of each case, thereby improving the accuracy and interpretability of the identification.
[0073] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the invention by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the invention should be included within the scope of protection of the invention.
Claims
1. A constitution identification method based on evidence element knowledge graph and attention mechanism, characterized in that, Includes the following steps: S1: Obtain manually labeled case data, which includes the patient's four diagnostic methods information as well as the corresponding syndrome element set and constitution category. The four diagnostic methods information includes one or more of the following: tongue image, facial image, consultation text, and pulse waveform. S2: Based on the set of syndrome elements from multiple cases, construct a syndrome element knowledge graph, wherein nodes in the syndrome element knowledge graph represent different syndrome elements, edges represent the association between different syndrome elements, and the weight of the edges is determined based on the degree of association between syndrome elements and the constitution category. S3: Train the evidence element knowledge graph using a graph neural network to obtain the embedding vector of each evidence element, and construct an evidence element embedding vector library; S4: Based on the syndrome element embedding vector library and the constitution category of the case data, perform training of the four diagnostic parameters model: input the syndrome element embedding vector sequence of the case into the attention mechanism, calculate the diagnostic weight of each syndrome element, perform weighted aggregation of the syndrome element embedding vector according to the diagnostic weight to obtain the sample feature vector, input the sample feature vector into the classifier to output the corresponding constitution category probability; S5: For the target patient to be identified, collect their four diagnostic methods information and extract their corresponding syndrome element set. Obtain the corresponding syndrome element embedding vector sequence according to the syndrome element embedding vector library and input it into the trained four diagnostic methods combined parameter model to obtain the constitution category of the target patient.
2. The constitution identification method based on evidence knowledge graph and attention mechanism as described in claim 1, characterized in that, In step S2, the correlation between evidence elements is determined based on at least one of the co-occurrence frequency of evidence elements in the same case, point mutual information, or semantic similarity.
3. The constitution identification method based on evidence knowledge graph and attention mechanism as described in claim 2, characterized in that, In step S2, the edge weights are corrected by the physical type to satisfy: ; in, λ represents the corrected edge weight; λ is the weighting coefficient, with a value range of [0,1]; PMI(i,j) represents the point mutual information between evidence element i and evidence element j; P(i,j|c) represents the conditional probability that evidence element i and evidence element j appear simultaneously under physical category c; P(c) represents the prior probability of physical category c; and C is the total number of physical categories.
4. The constitution identification method based on evidence knowledge graph and attention mechanism as described in claim 3, characterized in that, The evidence element knowledge graph is sparsified as follows: for each evidence element node, only its top k neighboring edges by edge weight are retained, and edge weight scaling is performed on hub nodes with a degree greater than a threshold. ; in, This represents the scaled edge weights; d i and d j Let i and j be the degrees of node i and node j, respectively.
5. The constitution identification method based on evidence knowledge graph and attention mechanism as described in claim 4, characterized in that, In step S3, the training objective function of the graph neural network introduces a graph Laplacian regularization term, which is defined as: ; Among them, L graph For graph regularization loss; v i and v j Let E be the embedding vector of the element node; E is the set of edges.
6. The constitution identification method based on evidence knowledge graph and attention mechanism as described in claim 4, characterized in that, During the training of the four diagnostic parameters model in step S4, the total loss function is: ; Among them, L task The cross-entropy loss is used for body type classification, where μ and β are hyperparameters; L center The cohesion constraint loss is used to constrain the feature vector z of samples belonging to the same physical category. i The center vector closest to the body type c, where the center vector is defined as the trainable prototype vector m of body type c. c L center satisfy: ; L inter For the separation constraint loss between body types, the center vectors of different body types are constrained to maintain the margin, L inter satisfy: 。 7. The constitution identification method based on evidence knowledge graph and attention mechanism as described in claim 1, characterized in that, In step S4, the attention mechanism introduces a trainable prior vector g related to the body type when calculating the weights. c Its weight is calculated as follows: ; Where, α i The attention weights for element i; v i The embedding vector of element i; g c* Let c be the prior vector of the current candidate physical fitness category. * =argmax c p(c) represents the candidate physical type with the highest probability.
8. The constitution identification method based on evidence knowledge graph and attention mechanism as described in claim 7, characterized in that, The four diagnostic parameters combined model is also used to generate an explanation matrix. , where matrix elements The contribution of characteristic factor i to constitution category c is calculated as follows: ; Where σ(·) is the activation function; m c Let c be the trainable prototype vector of the physical category c.
9. A constitution identification system based on evidence element knowledge graph and attention mechanism, used to execute the constitution identification method as described in any one of claims 1-8, characterized in that, include: The database module is used to store the four diagnostic methods information, syndrome element set, and constitution category of the case. The graph construction module is used to generate a knowledge graph of evidence elements. Nodes are evidence elements, and the weights of edges are determined based on the correlation between evidence elements and the constitution category. The graph neural network training module is used to convert the evidence element knowledge graph into evidence element embedding vector representations and form an evidence element embedding vector library. The four diagnostic methods combined model includes an attention mechanism layer and a classifier, which are used to train and output the constitution category and syndrome weights. The online reasoning module includes a syndrome element extraction submodule, an embedding vector query submodule, and a constitution discrimination submodule. It is used to collect the four diagnostic methods information of the target patient, extract the syndrome element set and query the embedding vector, input the four diagnostic methods parameter model, and output the constitution category through an attention mechanism and a classifier.
10. The constitution identification system based on evidence knowledge graph and attention mechanism as described in claim 9, characterized in that, The four diagnostic parameters combined model performs temperature calibration on the output body constitution category probability: ; in, z represents the calibrated class probability. c The output logic value is for category c; T > 0 indicates the calibration temperature parameter.