Traditional Chinese medicine prescription intelligent generation method and system based on syndrome-molecular map attention network
By using a syndrome-molecular graph attention network, the patient's condition is dynamically captured and integrated with information from both traditional Chinese medicine and Western medicine. This solves the problem of integrating theoretical systems in traditional Chinese medicine prescription recommendation systems and enables the dynamic generation and scientific recommendation of personalized prescriptions.
Patent Information
- Application Number
- CN202511774564.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-02-06
Smart Images

Figure CN121483483A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of medical information processing, and particularly relates to a method and system for intelligent generation of traditional Chinese medicine prescriptions based on a syndrome-molecule graph attention network. Background Art
[0002] Traditional Chinese medicine prescription recommendation highly relies on doctors' experience. Under the guidance of the theory of syndrome differentiation and treatment, individualized prescription recommendation is achieved through the overall association among symptoms, syndromes and drugs. The core of syndrome differentiation and treatment lies in accurately identifying the patient's constitution and pathogenesis, and then achieving the overall regulation of the body through formula compatibility to achieve the ideal therapeutic effect. This process fully reflects the diagnostic and treatment characteristics of traditional Chinese medicine of "treating people according to their individual conditions".
[0003] However, existing traditional Chinese medicine prescription recommendation systems have significant limitations. Most of them only build models based on the static associations of symptoms-prescriptions or symptoms-drugs, and fail to achieve the unified characterization of the dynamic evolution of syndromes, the synergistic effects of multiple components of drugs, and the molecular-level action mechanisms, making it difficult to meet the actual clinical needs.
[0004] In the scenario of integrating traditional Chinese and Western medicine, personalized prescription recommendation faces more complex challenges: 1. The "monarch, minister, assistant, and guide" compatibility theory of traditional Chinese medicine emphasizes the suitability of the overall efficacy of the prescription and the body's syndromes, while the molecular action mechanism of Western medicine focuses on the precise action of drug components and biological targets. There is an obvious semantic gap between the two in the theoretical system and expression dimensions, resulting in the difficulty of effectively integrating traditional Chinese and Western medicine information.
[0005] 2. Traditional Chinese medicine prescriptions form an overall treatment advantage based on the "monarch, minister, assistant, and guide" theory, but this overall nature makes it difficult to microscopically analyze its action mechanism. Take the herbal medicine "Poria cocos" as an example. The active ingredient "pachymic acid" contained in it can up-regulate the expression of intestinal AQP3 protein and promote the reabsorption of intestinal water fluid, thereby relieving the symptom of "loose stools". This example shows that the research on herbal active molecules is crucial for revealing the microscopic interaction mechanism between herbs. However, most current studies (such as SMGCN, KDHR models) still stay at the level of symptom-herb association analysis and cannot deeply explore the molecular action mechanism between traditional Chinese medicine active ingredients and biological targets.
[0006] 3. Although Western medicine recommendation systems (such as SafeDrug, COGNet, PCCNet) have initially constructed a molecular-disease knowledge system in the field of Western medicine, when facing the synergistic or antagonistic effects of a large number of active ingredients in traditional Chinese medicine compounds, traditional molecular graph neural networks often have problems such as low computational efficiency and insufficient model generalization ability due to high data dimensions. Even models such as PresRecRF obtain recommendation results by mining relationships through a symptom-syndrome-herb tripartite graph, and their molecular feature learning is still limited to the level of relational graph embedding and fails to fully explore the deep information at the molecular level.
[0007] 4. Existing methods for recommending TCM prescriptions are mostly based on static symptom or single-visit information modeling, neglecting the dynamic evolution of patient signs and syndromes during disease progression. The core of syndrome differentiation and treatment lies in the continuous perception and dynamic adjustment of syndrome changes over time. Static modeling cannot reflect the "syndrome migration" pattern during disease progression, making it difficult for the system to accurately capture the trend of symptom evolution and state shifts after drug intervention. Consequently, the recommendation results fail to reflect the dynamic syndrome differentiation characteristic of TCM of "adding and subtracting prescriptions according to symptoms." Summary of the Invention
[0008] The purpose of this invention is to propose a method and system for intelligent generation of TCM prescriptions based on syndrome-molecular graph attention networks, so as to achieve cross-modal alignment between TCM syndrome differentiation logic and molecular mechanisms, and improve the rationality, interpretability and scientificity of prescription recommendations.
[0009] According to a first aspect of the present disclosure, a method for intelligent generation of traditional Chinese medicine prescriptions based on syndrome-molecular graph attention networks is provided, comprising the following steps: The patient's symptom and syndrome sequence information is acquired and preprocessed. A vital sign time sequence perception module is constructed. Symptoms and herbal medicines are projected into the feature space through a learnable embedding table. Combined with a GRU network, dynamic medical history features of the patient are extracted to generate a complete patient representation containing time sequence information. Based on patient representations, a batch computation herbal ingredient encoder is designed to perform molecular segmentation of active ingredients in herbs to preserve the substructure of key functional groups. Substructure features are aggregated through masking matrices and feedforward neural networks. Then, combined with the Weisfeiler–Lehman algorithm, UMAP dimensionality reduction and message passing network, the herbal molecular feature representation is modeled and output. Extract symptom-symptom, herbal-herbal, and symptom-herbal co-occurrence information from traditional Chinese medicine prescriptions, construct a medical knowledge graph, aggregate global features of the graph using a multi-layer GCN network, and then establish the association between graph entity embeddings and patient representations through a Transformer-based multi-head attention mechanism to generate preliminary herbal recommendation vectors; For the molecular feature representation of herbs and the preliminary herbal recommendation vector, a cross-modal association is first constructed through a cross-attention mechanism to enhance multimodal information interaction. Then, a dynamic gating fusion mechanism is introduced to allocate the contribution weight of feature components. Finally, the probability distribution of herbal recommendations is output to complete the intelligent generation of traditional Chinese medicine prescriptions.
[0010] In one embodiment, the learnable embedding table , ,in For the number of feature categories, To embed the spatial dimension, each row stores the embedding vectors of specific symptoms and herbs; given multiple fever symptom vectors... and multi-hot herb vector The symptom embedding vector is obtained by projecting it into the embedding space through the dot product of the vector matrix. With herb embedding vector : A GRU network is used to embed hidden layers into the patient's medical history, simulating the dynamic evolution of the patient's medical history, thereby extracting hidden vectors. and : in, This indicates that the hidden vector exists in a dimension of . In the real space; in the initial state, and All are zero vectors.
[0011] In one embodiment, the herbal molecule feature representation is obtained as follows: Organize the chemical formulas of herbal ingredients Molecular segmentation of herbal components preserves the functional group structure. Construct a mask matrix ,like This indicates herbs Contains substructure , The quantity of herbs; Using a feedforward neural network: Dimensional transformation of the symptom distribution is performed, combined with an activation function. The substructure representation is obtained as follows: ,in To the patient, These are learnable weights; Then, using a masked neural network, the substructure features are aggregated into a herbal representation. ,in For learnable weights, Represents the matrix dot product; The Weisfeiler–Lehman algorithm is used to extract molecular topological fingerprint features, and the molecular structural features are updated through node iterative hashing. in For the first Layer Time Node The expression, For the first Layer Time Node The expression, For the first +1 level node The expression, For learnable hash mapping functions, Sorting operations used to ensure the invariance of the order of neighborhood information; Let be the set of edges in the molecular graph. Represents a node and nodes There are edges between them; Adjacency matrix of molecules The fingerprint features are zero-padded to a uniform size, and dimensionality reduction is performed using UMAP and bidirectional TruncatedSVD algorithms respectively. A message-passing network is constructed, and atomic features are aggregated through message passing and update mechanisms after molecular stacking to obtain the final herbal molecule feature representation. ,in The node feature matrix, It is an adjacency matrix.
[0012] In one embodiment, the message passing and update mechanism is as follows: in, The first in the molecular diagram Layer nodes Feature representation, For nodes In the The message aggregation result of the layer; It is the first Learnable parameters of the layer Represents a node Adjacent nodes ; For message passing functions, Update the node function.
[0013] In one embodiment, the UMAP algorithm reduces the dimensionality of molecular fingerprints by minimizing the fuzzy topological differences between the high-dimensional and low-dimensional spaces. Its objective function is: in For similarity weights in a high-dimensional neighborhood graph, The reconstruction weights of the corresponding points in the low-dimensional space; The execution process of the TruncatedSVD algorithm is as follows: First, the adjacency matrix after centering is processed into a characteristic matrix. Perform singular value decomposition to obtain an approximate expression. ,in, For the sample size, The feature dimension is used; subsequently, the first part of the decomposition result is truncated. The matrix is obtained by finding the singular values and their corresponding eigenvectors. Low-dimensional representation ,in The first left singular matrix obtained after singular value decomposition. List, The first part of the singular value matrix A diagonal matrix composed of singular values. The front of the right singular matrix OK.
[0014] In one embodiment, the preliminary herbal recommendation vector is generated as follows: For Chinese medicine prescriptions The co-occurrence of symptoms and herbal remedies was statistically analyzed, and a symptom-herbal remedy adjacency matrix was constructed. ,when( , When it appears in a prescription =1, otherwise 0; Count the frequency of occurrence of herbal pairs and symptom pairs in the prescription, and set thresholds for each. and Construct a herb-herb adjacency matrix Symptom-symptom adjacency matrix When the frequency of herbal medicine is greater than hour =1, symptom frequency greater than hour =1, otherwise 0; Will , , The system is integrated into a medical knowledge graph and uses a multi-layer GCN network to aggregate graph features. The first layer aggregates one-hop neighbor information, and each subsequent layer aggregates more far-hop neighbor information in turn to achieve global feature learning. Construct a Transformer-based multi-head attention sublayer, taking the patient representation matrix as input. Entity embedding Entity embedding By using attention function and multi-head fusion calculation, a preliminary herbal recommendation vector is obtained. : in, This is an embedded representation of symptom entities. An embedded representation of herbal entities. for The patient stated at that time, Multi-head attention function.
[0015] In one embodiment, the probability distribution of the output herbal recommendations is as follows: Using herbal molecular features as a key to cross-attention AND value Preliminary herbal recommendation vectors are used as queries. Calculate the cross-attention weights : in, Cross-attention weights are used to measure query performance. AND key The degree of correlation between them; Preliminary herbal recommendation vector (query) The first in ) One element; Characterization of herbal molecules (bonds) The first in ) One element; For feature dimensions; Based on attention weights, multimodal features are fused to obtain a fusion vector: in, Herbal molecular characteristics (values) The first in ) One element; Design a sigmoid gating function to calculate the dominant weights. ,in For weight parameters, Controlling the initial herbal recommendation vector Contribution Constructing a symptom-component co-representation Global matching representation ,in These are learnable collaborative parameters. It represents the Hadamah accumulation. Represented as molecular characteristics, Representation of herbal substructures; Using a hybrid loss function Optimize the model, where For binary classification, cross-entropy loss, For masked language model loss, , The loss weight coefficients are used to output the probability distribution of herbal recommendations based on the optimized model.
[0016] According to a second aspect of the present disclosure, a TCM prescription intelligent generation system based on a syndrome-molecular graph attention network is provided, comprising: The patient dynamic feature modeling module acquires and preprocesses patient symptom and syndrome sequence information, constructs a vital sign time sequence perception module, projects symptoms and herbs into the feature space through a learnable embedding table, and extracts dynamic medical history features of patients by combining a GRU network to generate a complete patient representation containing time sequence information. The herbal molecular feature extraction module, based on patient representation, designs a batch computation herbal component encoder to perform molecular segmentation of active herbal components to retain key functional group substructures. It aggregates substructure features through mask matrix and feedforward neural network, and then combines Weisfeiler-Lehman algorithm, UMAP dimensionality reduction and message passing network to model and output herbal molecular feature representations. The medical knowledge graph fusion and preliminary recommendation module extracts symptom-symptom, herbal-herbal, and symptom-herbal co-occurrence information from traditional Chinese medicine prescriptions to construct a medical knowledge graph. It uses a multi-layer GCN network to aggregate global features of the graph and then establishes the association between graph entity embeddings and patient representations through a Transformer-based multi-head attention mechanism to generate preliminary herbal recommendation vectors. The multimodal feature fusion and final recommendation module targets the molecular feature representation of herbs and the preliminary herbal recommendation vector. First, it constructs cross-modal associations through a cross-attention mechanism to enhance multimodal information interaction. Then, it introduces a dynamic gating fusion mechanism to allocate the contribution weights of feature components and finally outputs the herbal recommendation probability distribution to complete the intelligent generation of traditional Chinese medicine prescriptions.
[0017] According to a third aspect of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and running on it. When the processor executes the program, it implements the aforementioned method for intelligent generation of traditional Chinese medicine prescriptions based on syndrome-molecular graph attention networks.
[0018] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the aforementioned method for intelligent generation of traditional Chinese medicine prescriptions based on syndrome-molecular graph attention networks.
[0019] The advantages of the above technical solutions adopted in this invention compared with the prior art are as follows: 1. This invention takes the patient's symptoms and syndrome sequence as input, and dynamically captures the temporal evolution characteristics of the patient's state through a vital sign timing perception module, perfectly aligning with the core concept of "adjusting treatment according to the syndrome" in traditional Chinese medicine. For individualized treatment scenarios involving multiple visits and frequent symptom fluctuations, it enables dynamic tracking and precise syndrome differentiation of the patient's disease course, thereby generating personalized prescriptions tailored to changes in the condition, significantly improving the adaptability and effectiveness of treatment plans.
[0020] 2. By constructing a herbal component encoder and message passing network, this invention achieves precise feature mapping from herbs to active molecules, clearly revealing the synergistic or antagonistic relationships between different herbs. This advantage can help pharmacological researchers delve into the molecular biological basis of the "principal, assistant, adjuvant, and guide" compatibility theory in traditional Chinese medicine prescriptions, providing strong technical support for the efficacy analysis of traditional Chinese medicine compound prescriptions, drug target screening, and molecular mechanism of action research, thus promoting the modernization of traditional Chinese medicine research.
[0021] 3. This invention successfully constructs cross-modal associations, aligning and integrating the semantics of traditional Chinese medicine syndromes with the molecular representations of Western medicine in a unified space. This breakthrough effectively bridges the semantic gap between the theoretical systems of traditional Chinese and Western medicine, and can play a full role in integrated traditional Chinese and Western medicine clinical decision support systems. It assists doctors in integrating clinical symptom information with molecular biological data, achieving intelligent drug recommendations driven by dual information, and improving the scientific rigor and comprehensiveness of clinical decision-making. Attached Figure Description
[0022] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute an undue limitation of this application.
[0023] Figure 1 This is a block diagram illustrating the principle of a TCM prescription intelligent generation method based on syndrome-molecular graph attention network. Figure 2 A logical link diagram for exploring the fine-grained mechanism of action of herbal ingredients on symptoms; Figure 3 This is a case study illustrating molecular structure analysis of two herbs, licorice and scutellaria. Figure 4 This is the framework diagram of the IKM-Rec intelligent model for traditional Chinese medicine prescriptions in this invention; Figure 5 This is a schematic diagram of message passing in a graph convolutional network (GCN) for graph feature extraction. Detailed Implementation
[0024] The present disclosure will be further described below with reference to the accompanying drawings and embodiments.
[0025] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.
[0026] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0027] It should be noted that the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of methods and systems according to various embodiments of this disclosure. It should be noted that each block in a flowchart or block diagram may represent a module, segment, or portion of code, which may include one or more executable instructions for implementing the logical functions specified in the various embodiments. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that shown in the drawings. For example, two consecutively represented blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, may be implemented using a dedicated hardware-based system that performs the specified functions or operations, or using a combination of dedicated hardware and computer instructions.
[0028] Example 1: like Figure 1-4 As shown, this embodiment provides a method for intelligent generation of TCM prescriptions based on syndrome-molecular graph attention networks, including the following steps: S1. Obtain and preprocess patient symptom and syndrome sequence information, construct a vital sign time sequence perception module, project symptoms and herbs into the feature space through a learnable embedding table, and extract dynamic medical history features of patients by combining a GRU network to generate a complete patient representation containing time sequence information; Specifically, this invention designs a learnable embedded table. , Each row stores the embedding vectors of specific symptoms and herbs. It is the dimension of the embedding space. Given a multi-febrile symptom vector and multi-hot herb vector The symptom embedding vector is obtained by projecting it into the embedding space through the dot product of the vector matrix. With herb embedding vector : During training, the matrix As learnable parameters, they will be updated after each iteration to achieve weight sharing. This weight update process is achieved through vector dot product operations.
[0029] To accurately simulate the dynamic evolution of a patient's medical history, this invention employs a GRU network to perform hidden layer embedding processing on the patient's historical medical records, and extracts hidden vectors. and Building a more comprehensive patient representation: in, This indicates that the hidden vector exists in a dimension of . In the real number space. Initially, and All are zero vectors used to initialize the network state of the GRU; S2. Based on patient representation, a batch computation herbal ingredient encoder is designed to perform molecular segmentation of active ingredients in herbs to preserve the key functional group substructures. Substructure features are aggregated through masking matrices and feedforward neural networks. Then, combined with the Weisfeiler–Lehman algorithm, UMAP dimensionality reduction and message passing network, the herbal molecule feature representation is modeled and output. Specifically, a collection of chemical formulas for the ingredients of the herbs was compiled. The chemical substructure of each component is largely related to its medicinal function. Therefore, this invention performs molecular segmentation on herbal components, retaining the functional group substructures that are crucial to the drug's effect, and defines them as sets. To integrate the substructure groups that play a role in the herbal medicine, a mask matrix is constructed. , used to represent the binary architecture of substructures and herbs: if This indicates herbs. Contains substructure Through the matrix In a given patient's expression In this case, the herbal representation can be derived based on the function of the substructure. Specifically, this is first achieved through a feedforward neural network. The symptom distribution is transformed in dimension, and drug features are aggregated to the substructure level to obtain the substructure representation of the current patient. : in, The activation function is used to introduce nonlinear factors and improve the model's feature representation capabilities. A masked neural network is designed to aggregate substructure features into local herbal representations. Its core function is to transform features from the substructure dimension into a herbal representation. The network's parameter matrix is multiplied by the mask matrix F to filter relevant substructure features, ensuring that only substructure features associated with the target herb are aggregated into the corresponding herbal representation. The specific mapping process is as follows: Here This refers to the herbal medicine obtained after polymerization, in which... and Represents the learnable weights. It is a matrix dot product. This ensures that the herbal representation accurately reflects the relationship between its internal components and the patient's symptoms.
[0030] To aggregate the atomic features and neighborhood information of molecules, this invention constructs a global sub-message passing network. Specifically, the Weisfeiler–Lehman (WL) algorithm is used to extract the topological fingerprint features of the molecules, and the molecular structural features are updated through iterative hash aggregation of nodes, as shown in the following formula: in Indicates the first Layer nodes The feature representation is that HASH is a learnable hash mapping function, and SORT is used to ensure the order invariance of neighborhood information. Given a substructure molecular graph, its atomic relationships can be represented by an adjacency matrix. Characterization. This invention first utilizes the topological fingerprint features and adjacency matrix of the extracted molecules described above. Before training the message passing model, the molecular adjacency matrix was analyzed. Zero-padding is applied to the molecular fingerprint features to ensure uniform size. Subsequently, the UMAP algorithm and the bidirectional Truncated SVD algorithm are used for dimensionality reduction to maintain consistent feature dimensions after reduction. The UMAP algorithm achieves dimensionality reduction of the molecular fingerprint features by minimizing the fuzzy topological differences between the high-dimensional and low-dimensional spaces; its objective function is: in, For similarity weights in a high-dimensional neighborhood graph, The reconstruction weights of the corresponding points in the low-dimensional space; TruncatedSVD features the centered adjacency matrix. Perform singular value decomposition: Take before Given singular values and their corresponding vectors, we obtain a low-dimensional representation: .
[0031] During message passing, this invention processes molecular data using molecular stacking rather than splicing, effectively reducing the overall computational cost of the model. For a given molecular representation... The Layer node features The message passing and update mechanism is defined as follows: The substructure aggregation results are summarized into the herbal memory matrix. In this matrix, each row corresponds to a substructural feature of a single herb. A herb molecule correspondence matrix is constructed. This is used to mask non-existent molecular features or invalid drug information. Herbal features are represented as... in, This represents element-level mask multiplication.
[0032] S3. Extract symptom-symptom, herbal-herbal, and symptom-herbal co-occurrence information from traditional Chinese medicine prescriptions, construct a medical knowledge graph, aggregate global features of the graph using a multi-layer GCN network, and then establish the association between graph entity embeddings and patient representations through a Transformer-based multi-head attention mechanism to generate preliminary herbal recommendation vectors; For any Chinese herbal formula ,That It is a set of symptoms corresponding to the prescription. Given the set of herbs included in the prescription; construct an adjacency matrix of the symptom-herb graph based on the co-occurrence relationship between symptoms and herbs in the prescription. Its edge information is The adjacency matrix as follows: To achieve accurate prediction, this invention delves into the co-occurrence relationships of symptoms and herbs commonly found in traditional Chinese medicine prescriptions. The core basis is that strongly correlated symptom pairs or herb pairs often co-occur frequently within the same prescription, and this type of association information plays a crucial supporting role in the model's predictive performance. This is achieved using a herb-herb adjacency matrix. Taking the construction of [a formula] as an example, the specific process is as follows: Statistically analyze the co-occurrence frequency of herbal pairs in all prescriptions; if the herbal pairs... with herbs If herbs appear together in the same prescription, then the herbs are effective. Increment the co-occurrence frequency by 1; then set the hyperparameter threshold. This is used to filter entries in the frequency matrix that meet the correlation strength requirement, and its mathematical expression is as follows: Following the above process, a symptom-symptom matrix was also constructed. ,Right now: Based on the information transmission principle of multi-layered GCNs (such as...) Figure 5 As shown, graph convolutional networks (GCNs) efficiently aggregate and transmit neighborhood information of nodes in a graph through progressive inter-layer information transfer. In the first layer of the GCN, each node only aggregates information about its one-hop neighbors (i.e., directly connected nodes). As the number of network layers increases, the range of aggregated information for nodes in subsequent GCN layers gradually expands, including not only information about direct neighbors but also features from more distant neighbors. For example, the first layer aggregates one-hop neighbor information, the second layer can aggregate two-hop neighbor information, and so on, ultimately achieving deep information transfer and global feature learning.
[0033] To capture the association between entity embeddings and patient representations, this invention employs a multi-head attention mechanism to obtain accurate herbal recommendation vectors through multi-dimensional information fusion. Specifically, a Transformer-based multi-head attention sub-layer is constructed, specifically designed to mine the deep association between the final entity embedding and the patient representation.
[0034] Given three input matrices , and The attention function is defined as: in These are parameters that need to be learned. It refers to the number of heads. It was the patient who said that, This represents the probability vector for herbal medicine recommendations under multi-information fusion.
[0035] S4. For the molecular feature representation of herbs and the preliminary herbal recommendation vector, a cross-modal association is first constructed through a cross-attention mechanism to enhance multimodal information interaction. Then, a dynamic gating fusion mechanism is introduced to allocate the contribution weight of feature components. Finally, the probability distribution of herbal recommendations is output to complete the intelligent generation of TCM prescriptions.
[0036] The core challenge of cross-modal alignment lies in the high-level semantic and structural differences between molecular-based herbal representations and graph-based symptom representations. To enhance the association strength of multimodal features, a nonlinear interaction term is introduced, and a cross-attention mechanism is employed to fuse the two: the molecular-based herbal representations are used as keys K and values V, respectively, and the patient-cooperative graph features are used as queries Q. Attention weights are calculated to mine deep intermodal associations, thereby fusing the two representations. The attention weights are as follows: This invention achieves dynamic weight allocation through a gating function, precisely controlling the contribution ratio of different components in the drug recommendation process. Specifically, the gating function calculates the dominant weights of prescription interaction features to adapt to recommendation needs in different scenarios: in, , where is the weight parameter. control The contribution in the final prediction. Its core function is to construct the synergistic expression of symptom-component pathways and global matching pathways; in, These are learnable collaborative parameters. It represents the Hadamah accumulation. For component matching path, Global fusion representation: By fusing feature information from two types of paths, the model can adaptively select prescription-dependent relationship features or component matching features, thereby improving the accuracy of cross-modal fusion. This design enables the model to adaptively select prescription-dependent features or ingredient matching features, and finally uses a hybrid loss function for model optimization.
[0037] The data used in this invention comes from the open-source dataset TCM-PD. The comparative models referenced include SafeDrug, SMGCN, KGAT, MEIRec, TCMPR, and KDHR, totaling five models. The results of the control experiments and ablation experiments are shown in the table below: In the figure, the ablation portion represents the removal of molecular components (IKM-Rec-NoMol), removal of gated dynamic weighting (IKM-Rec-NoGate), removal of the time-symptom module (IKM-Rec-NoGRU), and removal of the graph convolution component (IKM-Rec-NoG). The results in the table demonstrate the effectiveness of the proposed method.
[0038] Example 2: This embodiment provides a TCM prescription intelligent generation system based on syndrome-molecular graph attention network, including: The patient dynamic feature modeling module acquires and preprocesses patient symptom and syndrome sequence information, constructs a vital sign time sequence perception module, projects symptoms and herbs into the feature space through a learnable embedding table, and extracts dynamic medical history features of patients by combining a GRU network to generate a complete patient representation containing time sequence information. The herbal molecular feature extraction module, based on patient representation, designs a batch computation herbal component encoder to perform molecular segmentation of active herbal components to retain key functional group substructures. It aggregates substructure features through mask matrix and feedforward neural network, and then combines Weisfeiler-Lehman algorithm, UMAP dimensionality reduction and message passing network to model and output herbal molecular feature representations. The medical knowledge graph fusion and preliminary recommendation module extracts symptom-symptom, herbal-herbal, and symptom-herbal co-occurrence information from traditional Chinese medicine prescriptions to construct a medical knowledge graph. It uses a multi-layer GCN network to aggregate global features of the graph and then establishes the association between graph entity embeddings and patient representations through a Transformer-based multi-head attention mechanism to generate preliminary herbal recommendation vectors. The multimodal feature fusion and final recommendation module targets the molecular feature representation of herbs and the preliminary herbal recommendation vector. First, it constructs cross-modal associations through a cross-attention mechanism to enhance multimodal information interaction. Then, it introduces a dynamic gating fusion mechanism to allocate the contribution weights of feature components and finally outputs the herbal recommendation probability distribution to complete the intelligent generation of traditional Chinese medicine prescriptions.
[0039] The above modules can be deployed on the same device or distributed devices; the division of modules is only a functional logic description and does not limit the specific physical boundaries or implementation order.
[0040] Example 3: An electronic device is provided for running the aforementioned "Intelligent Generation Method of Traditional Chinese Medicine Prescriptions Based on Syndrome-Molecular Graph Attention Network". The electronic device includes: a processor, a memory, and optional communication interfaces / display devices / input devices, etc.; the memory stores a computer program that can run on the processor, and when the processor executes the program, it implements steps S1 to S4 of the method described in Embodiment 1, specifically including but not limited to: S1. Obtain and preprocess patient symptom and syndrome sequence information, construct a vital sign time sequence perception module, project symptoms and herbs into the feature space through a learnable embedding table, and extract dynamic medical history features of patients by combining a GRU network to generate a complete patient representation containing time sequence information; S2. Based on patient representation, a batch computation herbal ingredient encoder is designed to perform molecular segmentation of active ingredients in herbs to preserve the key functional group substructures. Substructure features are aggregated through masking matrices and feedforward neural networks. Then, combined with the Weisfeiler–Lehman algorithm, UMAP dimensionality reduction and message passing network, the herbal molecule feature representation is modeled and output. S3. Extract symptom-symptom, herbal-herbal, and symptom-herbal co-occurrence information from traditional Chinese medicine prescriptions, construct a medical knowledge graph, aggregate global features of the graph using a multi-layer GCN network, and then establish the association between graph entity embeddings and patient representations through a Transformer-based multi-head attention mechanism to generate preliminary herbal recommendation vectors; S4. For the molecular feature representation of herbs and the preliminary herbal recommendation vector, a cross-modal association is first constructed through a cross-attention mechanism to enhance multimodal information interaction. Then, a dynamic gating fusion mechanism is introduced to allocate the contribution weight of feature components. Finally, the probability distribution of herbal recommendations is output to complete the intelligent generation of TCM prescriptions.
[0041] The electronic device hardware can be one of a server, personal computer, workstation, industrial controller, edge computing device, or mobile terminal; the processor can be a general-purpose CPU, GPU, NPU, FPGA, or a combination thereof; the memory can be RAM, ROM, flash memory, or disk array. The device can interact with local / remote data storage (acquiring observation data and outputting inversion results) through a communication interface. The above hardware configuration does not constitute a limitation of the present invention.
[0042] Example 4: A computer-readable storage medium storing a computer program, which, when run on a processor of an electronic device, causes the program to perform the method steps S1 to S4 described in Embodiment 1; the storage medium may be a disk, optical disk, flash memory, solid-state drive, read-only memory, random access memory, or any combination of the above media.
[0043] Application Example 1: Intelligent Recommendation of Traditional Chinese Medicine Clinical Prescriptions This invention can be applied to TCM clinical consultation scenarios. Based on the patient's input of symptoms and signs, it dynamically captures changes in the patient's state through a sign timing perception module, and combines this with a herbal molecular representation matrix to achieve personalized prescription recommendations. Compared with traditional rule-based recommendation methods, this embodiment can effectively improve the accuracy and dynamic response capability of prescription matching.
[0044] Application Example 2: Medical Research Auxiliary Analysis Scenarios This invention can be applied to traditional Chinese medicine research institutions or medical data analysis centers. In the analysis of large-scale historical prescriptions and clinical records, it automatically mines the correlation between symptoms, syndromes, and molecular structures through a multimodal cross-attention mechanism model. This embodiment not only improves the interpretability of drug action mechanisms but also provides data support for new prescription screening and pharmacological tracing.
[0045] Application Example 3: Data Privacy Protection and Remote Decision Support Scenarios This invention can be applied to medical institutions or remote consultation systems that require data security and privacy protection. It enables localized processing of patient data and prescription recommendations through locally deployed models, preventing the leakage of sensitive data during network transmission. This embodiment is suitable for scenarios with limited physician resources or remote collaborative diagnosis and treatment, reducing reliance on professional TCM personnel while ensuring the reliability and privacy of recommendation results.
[0046] Those skilled in the art will understand that the modules or steps described above can be implemented using general-purpose computer devices. Optionally, they can be implemented using computer-executable program code, which can then be stored in a storage device for execution by a computer device. Alternatively, they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. This disclosure is not limited to any particular combination of hardware and software.
[0047] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
[0048] While the specific embodiments of this disclosure have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of this disclosure. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of this disclosure are still within the scope of protection of this disclosure.
Claims
1. A method for intelligent generation of traditional Chinese medicine prescriptions based on syndrome-molecular graph attention networks, characterized in that, Includes the following steps: The patient's symptom and syndrome sequence information is acquired and preprocessed. A vital sign time sequence perception module is constructed. Symptoms and herbal medicines are projected into the feature space through a learnable embedding table. Combined with a GRU network, dynamic medical history features of the patient are extracted to generate a complete patient representation containing time sequence information. Based on patient representations, a batch computation herbal ingredient encoder is designed to perform molecular segmentation of active ingredients in herbs to preserve the substructure of key functional groups. Substructure features are aggregated through masking matrices and feedforward neural networks. Then, combined with the Weisfeiler–Lehman algorithm, UMAP dimensionality reduction and message passing network, the herbal molecular feature representation is modeled and output. Extract symptom-symptom, herbal-herbal, and symptom-herbal co-occurrence information from traditional Chinese medicine prescriptions, construct a medical knowledge graph, aggregate global features of the graph using a multi-layer GCN network, and then establish the association between graph entity embeddings and patient representations through a Transformer-based multi-head attention mechanism to generate preliminary herbal recommendation vectors; For the molecular feature representation of herbs and the preliminary herbal recommendation vector, a cross-modal association is first constructed through a cross-attention mechanism to enhance multimodal information interaction. Then, a dynamic gating fusion mechanism is introduced to allocate the contribution weight of feature components. Finally, the probability distribution of herbal recommendations is output to complete the intelligent generation of traditional Chinese medicine prescriptions.
2. The method for intelligent generation of TCM prescriptions based on syndrome-molecular graph attention network according to claim 1, characterized in that, The learnable embedding table , ,in For the number of feature categories, To embed the spatial dimension, each row stores the embedding vectors of specific symptoms and herbs; given multiple fever symptom vectors... and multi-hot herb vector The symptom embedding vector is obtained by projecting it into the embedding space through the dot product of the vector matrix. With herb embedding vector : A GRU network is used to embed hidden layers into the patient's medical history, simulating the dynamic evolution of the patient's medical history, thereby extracting hidden vectors. and : in, This indicates that the hidden vector exists in a dimension of . In the real space; in the initial state, and All are zero vectors.
3. The method for intelligent generation of TCM prescriptions based on syndrome-molecular graph attention network according to claim 1, characterized in that, The method for obtaining molecular characterization of herbal medicines is as follows: Organize the chemical formulas of herbal ingredients Molecular segmentation of herbal components preserves the functional group structure. Construct a mask matrix ,like This indicates herbs Contains substructure , The quantity of herbs; Using a feedforward neural network: Dimensional transformation of the symptom distribution is performed, combined with an activation function. The substructure representation is obtained as follows: ,in To the patient, These are learnable weights; Then, using a masked neural network, the substructure features are aggregated into a herbal representation. ,in For learnable weights, Represents the matrix dot product; The Weisfeiler–Lehman algorithm is used to extract molecular topological fingerprint features, and the molecular structural features are updated through node iterative hashing. in For the first Layer Time Node The expression, For the first Layer Time Node The expression, For the first +1 level node The expression, For learnable hash mapping functions, Sorting operations used to ensure the invariance of the order of neighborhood information; Let be the set of edges in the molecular graph. Represents a node and nodes There are edges between them; Adjacency matrix of molecules The fingerprint features are zero-padded to a uniform size, and dimensionality reduction is performed using UMAP and bidirectional TruncatedSVD algorithms respectively. A message-passing network is constructed, and atomic features are aggregated through message passing and update mechanisms after molecular stacking to obtain the final herbal molecule feature representation. ,in The node feature matrix, It is an adjacency matrix.
4. The method for intelligent generation of TCM prescriptions based on syndrome-molecular graph attention network according to claim 3, characterized in that, The message passing and update mechanism is as follows: in, The first in the molecular diagram Layer nodes Feature representation, For nodes In the The message aggregation result of the layer; It is the first Learnable parameters of the layer Represents a node Adjacent nodes ; For message passing functions, Update the node function.
5. The method for intelligent generation of TCM prescriptions based on syndrome-molecular graph attention network according to claim 3, characterized in that, The UMAP algorithm reduces the dimensionality of molecular fingerprints by minimizing the fuzzy topological differences between high-dimensional and low-dimensional spaces. Its objective function is: in For similarity weights in a high-dimensional neighborhood graph, The reconstruction weights of the corresponding points in the low-dimensional space; The execution process of the TruncatedSVD algorithm is as follows: First, the adjacency matrix after centering is processed into a characteristic matrix. Perform singular value decomposition to obtain an approximate expression. ,in, For the sample size, The feature dimension is used; subsequently, the first part of the decomposition result is truncated. The matrix is obtained by finding the singular values and their corresponding eigenvectors. Low-dimensional representation ,in The first left singular matrix obtained after singular value decomposition. List, The first part of the singular value matrix A diagonal matrix composed of singular values. The front of the right singular matrix OK.
6. The method for intelligent generation of TCM prescriptions based on syndrome-molecular graph attention network according to claim 1, characterized in that, The method for generating preliminary herbal recommendation vectors is as follows: For Chinese medicine prescriptions The co-occurrence of symptoms and herbal remedies was statistically analyzed, and a symptom-herbal remedy adjacency matrix was constructed. ,when( , When it appears in a prescription =1, otherwise 0; Count the frequency of occurrence of herbal pairs and symptom pairs in the prescription, and set thresholds for each. and Construct a herb-herb adjacency matrix Symptom-symptom adjacency matrix When the frequency of herbal medicine is greater than hour =1, symptom frequency greater than hour =1, otherwise 0; Will , , The system is integrated into a medical knowledge graph and uses a multi-layer GCN network to aggregate graph features. The first layer aggregates one-hop neighbor information, and each subsequent layer aggregates more far-hop neighbor information in turn to achieve global feature learning. Construct a Transformer-based multi-head attention sublayer, taking the patient representation matrix as input. Entity embedding Entity embedding By using attention function and multi-head fusion calculation, a preliminary herbal recommendation vector is obtained. : in, This is an embedded representation of symptom entities. An embedded representation of herbal entities. for The patient stated at that time, Multi-head attention function.
7. The method for intelligent generation of TCM prescriptions based on syndrome-molecular graph attention network according to claim 1, characterized in that, The probability distribution of the output herbal recommendations is as follows: Using herbal molecular features as a key to cross-attention AND value Preliminary herbal recommendation vectors are used as queries. Calculate the cross-attention weights : in, Cross-attention weights are used to measure query performance. AND key The degree of correlation between them; Preliminary herbal recommendation vector (query) The first in ) One element; Characterization of herbal molecules (bonds) The first in ) One element; For feature dimensions; Based on attention weights, multimodal features are fused to obtain a fusion vector: in, Characterization of herbal molecules The first in One element; Design a sigmoid gating function to calculate the dominant weights. ,in For weight parameters, Controlling the initial herbal recommendation vector Contribution Constructing a symptom-component co-representation Global matching representation ,in These are learnable collaborative parameters. It represents the Hadamah accumulation. Represented as molecular characteristics, Representation of herbal substructures; Using a hybrid loss function Optimize the model, where For binary classification, cross-entropy loss, For masked language model loss, , The loss weight coefficients are used to output the probability distribution of herbal recommendations based on the optimized model.
8. A TCM prescription intelligent generation system based on syndrome-molecular graph attention network, characterized in that, include: The patient dynamic feature modeling module acquires and preprocesses patient symptom and syndrome sequence information, constructs a vital sign time sequence perception module, projects symptoms and herbs into the feature space through a learnable embedding table, and extracts dynamic medical history features of patients by combining a GRU network to generate a complete patient representation containing time sequence information. The herbal molecular feature extraction module, based on patient representation, designs a batch computation herbal component encoder to perform molecular segmentation of active herbal components to retain key functional group substructures. It aggregates substructure features through mask matrix and feedforward neural network, and then combines Weisfeiler-Lehman algorithm, UMAP dimensionality reduction and message passing network to model and output herbal molecular feature representations. The medical knowledge graph fusion and preliminary recommendation module extracts symptom-symptom, herbal-herbal, and symptom-herbal co-occurrence information from traditional Chinese medicine prescriptions to construct a medical knowledge graph. It uses a multi-layer GCN network to aggregate global features of the graph and then establishes the association between graph entity embeddings and patient representations through a Transformer-based multi-head attention mechanism to generate preliminary herbal recommendation vectors. The multimodal feature fusion and final recommendation module targets the molecular feature representation of herbs and the preliminary herbal recommendation vector. First, it constructs cross-modal associations through a cross-attention mechanism to enhance multimodal information interaction. Then, it introduces a dynamic gating fusion mechanism to allocate the contribution weights of feature components and finally outputs the herbal recommendation probability distribution to complete the intelligent generation of traditional Chinese medicine prescriptions.
9. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and running thereon, characterized in that, When the processor executes the program, it implements the aforementioned method for intelligent generation of traditional Chinese medicine prescriptions based on syndrome-molecular graph attention networks.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, this program implements the aforementioned method for intelligent generation of traditional Chinese medicine prescriptions based on syndrome-molecular graph attention networks.
Citation Information
Cited By
Method for generating multi-mode synthesizable molecules perceived by chemical reaction
CN121789834A