A method for prescription recommendation based on path and global relationship perception
By constructing a gated graph attention neural network framework based on path and global relationship awareness, the problem of insufficient information representation and fusion capabilities in medical knowledge graphs is solved, enabling more efficient disease prediction and drug recommendation, and improving the accuracy and intelligence level of prescription recommendation.
Patent Information
- Application Number
- CN202510175343.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2045-02-18
AI Technical Summary
Existing graph neural network models struggle to accurately capture and analyze complex, multi-dimensional information such as diseases and drugs when processing medical knowledge graphs, thus limiting the accuracy and intelligence of prescription recommendations in the medical field.
We construct a gated graph attention neural network framework based on path and global relationship awareness. By adding inverse and identity relations, we expand the triplet set and combine it with the OMGU-GNN model for feature representation and prediction. We optimize the model parameters using a multi-class log loss function to achieve disease prediction and drug recommendation.
It enhances the information representation and fusion capabilities in medical knowledge graphs, improves the accuracy and intelligence of prescription recommendations, and performs exceptionally well on multiple evaluation metrics, particularly on the diabetes dataset.
Smart Images

Figure CN120072342B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of knowledge graph processing, and particularly relates to a prescription recommendation method based on path and global relationship perception. BACKGROUND
[0002] With the rapid development of medical informatization, big data and artificial intelligence technology are gradually penetrating and changing the traditional medical service mode. As one of the core functions of medical decision support systems, the accuracy and intelligence level of prescription recommendation are directly related to the treatment effect of patients and the rational allocation of medical resources. At present, the prescription recommendation method based on knowledge reasoning technology has become a research hotspot and frontier. By mining and analyzing the potential relationships in medical data, scientific and reasonable medication suggestions are provided for doctors.
[0003] In recent years, as an important branch of deep learning, graph neural networks (GNNs) have shown excellent performance in complex network structure analysis due to their unique network structure and powerful information processing capability. In medical knowledge reasoning, graph neural networks provide a new way to solve complex relationship problems. For example, in the task of drug repositioning, researchers can use GNN models to analyze the complex associations between drugs and diseases, and discover that a drug originally used to treat other diseases may have potential efficacy for a new disease. This graph structure-based reasoning method not only considers the direct connection between drugs and diseases, but also explores their indirect associations through multi-step relationship paths, greatly improving the accuracy and comprehensiveness of reasoning.
[0004] However, although graph neural networks have shown great potential in the medical field, existing models still face many challenges in processing medical knowledge graphs. On the one hand, the knowledge system in the medical field is vast and complex, involving multi-dimensional information such as diseases, symptoms, and drugs, requiring the model to have strong information representation and fusion capabilities. On the other hand, medical data has high heterogeneity and dynamics, and traditional models often have difficulty accurately capturing and analyzing these complex relationships, resulting in limited reasoning effectiveness.
[0005] Therefore, the present application proposes a prescription recommendation method based on path and global relationship perception. SUMMARY
[0006] The present application aims to overcome the shortcomings of the prior art and develop a prescription recommendation method based on path and global relationship perception, with the main purpose of promoting the development of prescription recommendation methods and providing new perspectives and ideas for solving complex reasoning problems in the medical field.
[0007] The technical scheme for solving the technical problems of the present application is a prescription recommendation method based on path and global relationship perception, comprising the following steps:
[0008] S1, by analyzing the diabetes data provided in the Ruijin Hospital MMC artificial intelligence auxiliary construction knowledge graph competition, a set of diabetes triples is constructed;
[0009] S2, by adding inverse relationship and identity relationship to expand the triple set, the expanded triple set is divided into training set and test set according to the proportion, and the knowledge graph is constructed according to the expanded triple set ;
[0010] S3, a gate graph attention neural network framework based on path and global relationship perception is constructed to reason the knowledge graph , the gate graph attention neural network framework includes a gate graph attention neural network and a full connection layer, the triples in the training set are input into the framework, the gate graph attention neural network is used to capture the feature representation of the query based on the relationship path rule, and the full connection layer is used to predict the score on the candidate answer;
[0011] S4, a loss function is constructed, a multi-classification logarithmic loss is used to measure the difference between the predicted probability distribution and the true label of the present application, the parameters in the gate graph attention neural network framework based on path and global relationship perception are adjusted to gradually reduce the loss function, and the framework is optimized;
[0012] S5, the test set triples are input into the optimized gate graph attention neural network framework based on path and global relationship perception, the disease prediction of the patient condition is made by obtaining the score on the candidate answer, the disease risk is evaluated, and the drug recommendation is made for the patient.
[0013] S1 is as follows:
[0014] S1.1, data collection: collecting disease knowledge from public medical disease data sets, and collecting knowledge related to the corresponding disease directly or indirectly from extensive textbooks and academic papers;
[0015] S1.2, data preprocessing: preprocessing the collected data through optical character recognition (OCR) technology, converting the collected data into text form, and then performing word-by-word verification, deduplication and screening on the converted text;
[0016] S1.3, constructing a triple set: constructing a triple set according to the preprocessed data, the triple set is composed of nodes and edges, the node is an entity, and the edge is the relationship between entities, and the triple set is as follows:
[0017] ,
[0018] wherein, denotes a set of triples, denotes a set of entities, denotes a set of relations, denotes a head entity, denotes a tail entity, denotes a relation.
[0019] S2 is specifically as follows:
[0020] The set of triples is expanded by adding inverse relations and identity relations, wherein the inverse relation is to exchange the head entity and the tail entity in the triple, change the direction of the relation at the same time, and expand the reversible relation to , for the relation type with the inverse relation, traverse the original triple set, generate the corresponding inverse relation triple for each triple, the identity relation is to expand the data set by adding other relations between the head entity and the tail entity, traverse the original triple set, generate the corresponding identity relation for the entity pair with the other relations, and then obtain the expanded triple set;
[0021] The expanded triple set is divided into a training set and a test set , and a knowledge graph is constructed according to the expanded triple set , , the expanded entity set, denotes the expanded relation set, denotes the expanded triple set.
[0022] S3 is specifically as follows:
[0023] S3.1, feature embedding is performed on the entities and relations in the knowledge graph , to obtain the embedding representation of each entity and the relation information feature vector between entities, and a query triple is set , denotes a query entity, denotes a query relation, denotes a missing response entity ;
[0024] S3.2, a set of key relation paths are learned as local evidence to predict triples based on the path method , the key relation path from to is composed of triples, the triple is represented as From to the key relationship path contains entities, respectively , , , , to the relationship between the adjacent two entities in the key relationship path is , , , The head is connected to the tail in order by
[0025] Capture and query the feature vector based on the key relationship path through the gated graph attention neural network OMGU-GNN, from triples are represented as , , , traverse, the head entity of the traversed triple is represented by , the tail entity is represented by , OMGU-GNN has N layers, N≥1, the number of layers N is determined according to the number of times of OMGU-GNN operation when the missing answer entity is found, starting from the traversal head entity , the relationship rule features along the edge are captured through the OMGU gating unit at each layer of the gated graph attention neural network, and the missing answer entity is found from entities in the key relationship path at each layer of the gated graph attention neural network , represents the relationship between the traversal head entity and the traversal tail entity ,
[0026] ,
[0027] …
[0028] ,
[0029] …
[0030] ,
[0031] wherein represents the initial feature vector of the traversal head entity , represents the traversal head entity characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer, characteristic vector of the head entity on the i-th layer,
[0032] The OMGU gating unit is specifically as follows:
[0033] The OMGU gating unit includes an update gate, a reset gate, a hidden state candidate, and an updated hidden state.
[0034] (1) The update gate is a sequence network including a simple linear layer and a Sigmoid activation function. The relationship structure vector , the query relationship structure vector , and the head entity of the previous layer are input into the update gate to obtain the output of the update gate, and the calculation formula is as follows:
[0035] ,
[0036] wherein, denotes a vector splicing operation, denotes a weight matrix of the update gate, is a bias term of the update gate, denotes a Sigmoid activation function.
[0037] (2) The global relationship information is adjusted through the reset gate. The relationship structure vector and the global relationship vector are input into the reset gate to obtain the output of the reset gate, and the calculation formula is as follows:
[0038] ,
[0039] wherein, denotes a vector concatenation operation, denotes a weight matrix of the reset gate, denotes a bias term of the reset gate, denotes a Sigmoid activation function;
[0040] (3) The information filtered by the gate is converted into a new hidden state, and the calculation formula is as follows:
[0041] ,
[0042] wherein, denotes the information filtered by the gate on the layer is converted into a new hidden state, denotes an element-wise multiplication, denotes a weight matrix, denotes a bias term, denotes a hyperbolic tangent activation function;
[0043] (4) The calculation formula of updating the hidden state is as follows:
[0044] .
[0045] S3.3 Obtain the relationship feature representation and the relationship feature representation The traversal head entity The attention of each adjacent edge , and the calculation formula is as follows:
[0046] On the first layer of the gated graph attention neural network:
[0047] ,
[0048] ,
[0049] wherein, denotes the attention score on the layer of the gated graph attention neural network, denotes the attention weight on the layer of the gated graph attention neural network, denotes a transpose, denotes an operation of an activation function , denotes a traversal head entity feature transformation matrix, denotes a query relationship feature transformation matrix on the layer of the gated graph attention neural network, denotes an attention bias term, denotes the gating graph attention neural network first layer on the traversal head entity , denotes the gating graph attention neural network first layer on the traversal head entity , denotes the gating graph attention neural network first layer on the traversal head entity , denotes the gating graph attention neural network first layer on the traversal head entity , denotes the gating graph attention neural network first layer on the traversal head entity ;
[0050] aggregates the attention of each adjacent edge to obtain , and the calculation formula is as follows:
[0051] ,
[0052] wherein, denotes the aggregated traversal tail entity vector on the first layer, denotes the operation of the activation function ;
[0053] S3.4, node update by GRU gating unit:
[0054] input the node message containing the current layer aggregation and the last layer updated node state to the GRU gating unit, and calculate the formula as follows:
[0055] ,
[0056] wherein, denotes the operation of the GRU gating unit, denotes the updated node state of the first layer;
[0057] S3.5, according to the key relationship path from to , query from , , , in turn until the final updated after passing through the gating graph attention neural network of the Nth layer, that is, when the query tail entity corresponds to , denotes the missing answer entity on the N-th layer of the gated graph attention neural network ;
[0058] Then the input into the full connection layer to predict the score on the candidate answer , and the scoring function is specifically as follows:
[0059] ,
[0060] wherein, denotes the transformation matrix of the scoring function, denotes the offset of the scoring function, denotes the scoring result.
[0061] S4 is specifically as follows:
[0062] The loss of the scoring result is calculated by a multi-classification logarithmic loss function, and the framework is optimized by a stochastic gradient descent minimization, and the loss function calculation formula is as follows:
[0063] ,
[0064] wherein, denotes the score of the positive triple , denotes that the query triple belongs to the triple set in the training set , denotes the score of all triples with the same query .
[0065] S5 is specifically as follows:
[0066] The triple in the test set is input into the optimized path and global relation perception based gated graph attention neural network framework, the disease prediction of the patient condition is carried out by obtaining the score on the candidate answer, the highest score is the final result of the prediction, the disease risk is evaluated according to the prediction result, and the drug recommendation is carried out for the patient.
[0067] The effects provided in the summary of the invention are only the effects of the embodiments, not all the effects of the invention, and the above technical solutions have the following advantages or beneficial effects:
[0068] The application provides a prescription recommendation method based on path and global relationship perception. The OMGU-GNN model of the application realizes the state transition of entities along the path in the sequence relationship through a relationship path-based gate graph neural network. Specifically, in the graph convolution process, the model performs global relationship and local structure dual perception through the designed OMGU gate unit and graph attention technology, effectively improving the information representation and fusion capability. In addition, in view of the increasingly serious problem of diabetes, a triple set is constructed. Experimental results show that the OMGU-GNN has excellent performance in multiple evaluation indexes on the public knowledge reasoning data set and the triple set. The application promotes the development of the prescription recommendation method and provides a new perspective and idea for solving complex reasoning problems in the medical field. BRIEF DESCRIPTION OF DRAWINGS
[0069] The accompanying drawings are included to provide a further understanding of the application, and constitute a part of the specification, illustrate the application, and are used together with the embodiments of the application to explain the application, and do not constitute a limitation on the application.
[0070] Figure 1 The method flowchart in the application is shown.
[0071] Figure 2 The partial data set example graph of the triple set is shown. DETAILED DESCRIPTION
[0072] In order to clearly illustrate the technical features of the present scheme, the application will be described in detail below with reference to the specific embodiments and the accompanying drawings.
[0073] Embodiment 1
[0074] As shown in the figure, a prescription recommendation method based on path and global relationship perception is as follows: Figure 1
[0075] S1, by analyzing the diabetes data provided in the MMC artificial intelligence auxiliary construction knowledge graph competition of Ruijin Hospital, a diabetes triple set is constructed;
[0076] S2, by adding inverse relationships and identity relationships to expand the triple set, the expanded triple set is divided into a training set and a test set according to the proportion, and a knowledge graph is constructed according to the expanded triple set ;
[0077] S3, a gate graph attention neural network framework based on path and global relationship perception is constructed to reason the knowledge graph , the gate graph attention neural network framework includes a gate graph attention neural network and a full connection layer, and the training set The middle triple is input into the framework, the feature representation of the query based on the relationship path rule is captured through the gated graph attention neural network, and the score on the candidate answer is predicted through the full connection layer;
[0078] S4, a loss function is constructed, a multi-classification logarithmic loss is used to measure the difference between the predicted probability distribution of the application and the true label, the parameters in the gated graph attention neural network framework based on path and global relationship perception are continuously adjusted to gradually reduce the loss function, and the framework is optimized;
[0079] S5, the test set The triple is input into the optimized gated graph attention neural network framework based on path and global relationship perception, the disease prediction of the patient condition is performed by obtaining the score on the candidate answer, the disease risk is evaluated, and the drug recommendation is made for the patient.
[0080] S1 is as follows:
[0081] S1.1, data collection: collecting disease knowledge from public medical disease data sets, collecting knowledge related to the corresponding disease directly or indirectly from extensive textbooks and academic papers, such as disease pathogenesis, clinical manifestations, examination methods, drug dosage, adverse reactions, etc.;
[0082] S1.2, data preprocessing: the collected data is preprocessed by optical character recognition (OCR) technology, the collected data is converted into text form, and the converted text is checked word by word, de-duplicated and screened;
[0083] S1.3, construction of triple set: according to the preprocessed data, the triple set is constructed, the triple set is composed of nodes and edges, the node is an entity, and the edge is the relationship between entities, and the triple set is as follows:
[0084] ,
[0085] Among them, represents the triple set, represents the entity set, represents the relationship set, represents the head entity, represents the tail entity, represents the relationship.
[0086] S2 is as follows:
[0087] The triple set is expanded by adding inverse relationships and identity relationships, wherein the inverse relationship is to exchange the head entity and the tail entity in the triple, change the direction of the relationship, and expand the reversible relationship to For relation types with inverse relations, the original set of triples is traversed, and a corresponding inverse relation triple is generated for each triple. The identity relation is expanded by adding other relations between the head entity and the tail entity. The original set of triples is traversed, and the corresponding identity relation is generated for the entity pairs of other relations, thus obtaining the expanded set of triples.
[0088] The expanded set of triples is divided into a training set. and test set A knowledge graph is constructed based on the expanded set of triples. , , The expanded set of entities Represents the expanded set of relations. This represents the expanded set of triples.
[0089] S3 is as follows:
[0090] S3.1, Knowledge Graph The entities and relationships in the dataset are embedded to obtain feature vectors representing the embedded representations of each entity and the relationship information between entities. Query triples are then set. , Indicates the entity being queried. Indicates the query relationship. Indicates a missing response entity ;
[0091] S3.2 Path-based methods learn a set of key relational paths as local evidence to predict triples. ,from arrive The key relationship path is It consists of three triplets, A triplet is represented as ,from arrive The key relationship path contains The entities are: , , ... ,from arrive The relationships between adjacent entities in the critical relationship path are as follows: , ... , The triples are connected sequentially from head to tail;
[0092] Feature vectors based on key relationship paths are captured and queried using a gated graph attention neural network OMGU-GNN, from which... A triple is represented as , , , The traversal is performed, the head entity of the triple traversed is represented as , the tail entity is represented as , the OMGU-GNN has N layers, N≥1, the number of layers N is determined according to the number of times of OMGU-GNN operation when the missing response entity is found, at each layer of the OMGU-GNN, starting from the traversal head entity , the missing response entity is found from the entities in the key relationship path through the OMGU gate unit to capture the relationship rule features along the edge , at each layer of the gate graph attention neural network, the missing response entity is found from the entities in the key relationship path , represents the relationship between the traversal head entity and the traversal tail entity , the calculation process is as follows:
[0093] ,
[0094] ...
[0095] ,
[0096] ...
[0097] ,
[0098] wherein, represents the initial feature vector of the traversal head entity , represents the feature vector of the traversal head entity at the first layer of the gate graph attention neural network, represents the feature vector of the traversal head entity at the layer of the gate graph attention neural network, represents the feature vector of the traversal head entity at the layer of the gate graph attention neural network, 1≤ ≤N, represents the relationship structure feature vector at the layer, represents the feature vector of the query relationship at the layer, represents the feature vector of the traversal head entity at the layer, A feature vector representing global relational information. , Representing dimension, This indicates the operation of the OMGU gating unit.
[0099] The OMGU gating unit is as follows:
[0100] The OMGU gate control unit consists of four parts: update gate, reset gate, hidden state candidate, and update hidden state.
[0101] (1) The update gate is a sequence network containing a simple linear layer and a sigmoid activation function, and the relational structure vector is changed. Query relational structure vector and the head entity of the previous layer The input is fed into the update gate, and the output of the update gate is obtained. The calculation formula is as follows:
[0102] ,
[0103] in, This represents the vector concatenation operation. This represents the weight matrix of the updated gate. It updates the bias term of the gate. This represents the Sigmoid activation function;
[0104] (2) Adjust the global relation information through the reset gate, and change the relation structure vector. and global relation vector Input into the reset door to get the reset door. The output is calculated using the following formula:
[0105] ,
[0106] in, This represents a vector concatenation operation. This represents the weight matrix of the reset gate. This indicates the option to reset the door's bias. This represents the Sigmoid activation function;
[0107] (3) Convert the gated information into a new hidden state. The calculation formula is as follows:
[0108] ,
[0109] in, Indicates the first Information from entities on a layer that has undergone gating and filtering is converted into a new hidden state. This represents element-wise multiplication. Represents the weight matrix. Indicates the bias term. Represents the hyperbolic tangent activation function;
[0110] (4) The formula for updating the hidden state is as follows:
[0111] .
[0112] S3.3 uses global query relationship features The relationship features obtained Calculate the traversal of the head entity Attention to each adjacent edge The calculation formula is as follows:
[0113] First layer of the gated graph attention neural network:
[0114] ,
[0115] ,
[0116] in, This represents the gated graph attention neural network. Attention scores on the layer This represents the gated graph attention neural network. Attention weights on the layer Indicates transpose. Indicates activation function The operation, Indicates traversing the head entity Characteristic transformation matrix, This represents the gated graph attention neural network. Query relationship feature transformation matrix at the layer, Indicates attention bias. This represents the gated graph attention neural network. Layer-by-layer traversal of head entities The set of adjacent edges, This indicates the first step in the gated graph attention neural network. Layer above the field Sum the exponents of all edges in the array. Represents the removal of edges Other Adjacent edge set express The neighboring nodes, express and Relationship;
[0117] right Attention to each adjacent edge Aggregation is performed to obtain The calculation formula is as follows:
[0118] ,
[0119] in, Indicates the first After traversing the layer-wise aggregated tail entity Vector representation, Indicates activation function Operation;
[0120] S3.4 Node updates via GRU gating units:
[0121] Messages containing the aggregated nodes from the current layer and the updated node state of the previous layer The input is fed into the GRU gated unit, and the entity is updated using the GRU. The calculation formula is as follows:
[0122] ,
[0123] in, This indicates the operation of the GRU gating unit. Indicates the first Node state after layer update;
[0124] S3.5, according to from arrive The key relationship path from , , , The query proceeds sequentially until it is updated through the Nth layer of the gated graph attention neural network, ultimately yielding the result. That is, query tail entity Corresponding to hour, This represents the missing response entity in the Nth layer of a gated graph attention neural network. eigenvectors;
[0125] Then The input is fed into a fully connected layer to predict the candidate answer. The scoring function is as follows:
[0126] ,
[0127] in, The transformation matrix represents the scoring function. This represents the offset of the scoring function. This indicates the scoring result.
[0128] S4 is as follows:
[0129] The loss of the scoring results is calculated using a multi-class log loss function, and the framework is optimized by minimizing it using stochastic gradient descent. The formula for the loss function is as follows:
[0130] ,
[0131] in, Represents a positive triplet The score, This indicates that the query triple belongs to the training set. The set of triples in the middle, Represents all triples with the same query. The score.
[0132] S5 is detailed below:
[0133] Test set The triplet is input into an optimized gated graph attention neural network framework based on path and global relationship awareness. The framework predicts the patient's condition by obtaining scores on candidate answers. The highest score is the final prediction result. Based on the prediction results, the disease risk is assessed and drug recommendations are made for the patient.
[0134] Figure 2 This example diagram illustrates a portion of the dataset within a triplet set. Solid lines represent relationships between entities, while dashed lines represent their inverse relationships. Based on the type 2 category, vascular anatomy, HbA1c test results, and early retinopathy symptoms in this example diagram, the patient's condition can be identified as type 2 diabetes. Further analysis of the diagram reveals treatment options such as oral insulin secretagogues and physical exercise. It's important to note that insulin secretagogues can cause hypoglycemia, a condition with other causes including stroke. Insulin secretagogues can also treat renal insufficiency and other diabetic problems, indirectly reflecting the various complications that type 2 diabetes can lead to. This graphical representation intuitively demonstrates the complexity of type 2 diabetes, including its disease categories, diagnostic tests, causes, and treatments. It not only helps medical professionals better understand and manage the disease but also provides a foundation for developing intelligent medical assistance systems.
[0135] Example 2
[0136] To verify the inference performance of the method in this invention, an experiment was conducted on the WN18RR dataset to compare it with existing inference techniques. The comparison results are shown in Table 1. In addition, to verify the effectiveness of the two gating mechanisms, OMGU and GRU, an ablation experiment was also conducted. The results are shown in Table 2.
[0137] As can be seen from the results in Tables 1 and 2, the method in this invention effectively improves the ability to represent and fuse information by combining two gating mechanisms, OMGU and GRU, and graph attention technology to perform dual perception of global relationships and local structures.
[0138] Table 1 lists the models, including RotatE (rotation embedding), QuatE (quaternion embedding), DRUM (deep relation understanding), RNNLogic (recurrent neural network logic), CompGCN (combined graph convolutional network), DPMPN (deep probabilistic matching propagation network), and RED-GNN (relation embedding propagation graph neural network). Evaluation metrics include MRR, Hit@1, and Hit@10. MRR (Mean Reciprocal Rank) indicates the highest accuracy of the returned results; Hit@1 represents the proportion of correct results among the first returned results, used to evaluate model performance under high accuracy requirements; and Hit@10 represents the proportion of correct results among the first 10 returned results, used to evaluate model performance under more lenient conditions.
[0139] In Table 2, wo-OMGU means removing the OMGU gating, wo-GRU means removing the GRU gating, and wo-OMGU,GRU means removing both the OMGU and GRU gating.
[0140] Table 1. Comparison of the method of this invention with existing inference techniques on the WN18RR dataset.
[0141]
[0142] Table 2 Ablation Experiment Results
[0143]
[0144] Example 3
[0145] This invention provides a prescription recommendation method based on path and global relationship awareness. The invention is compared with the translation embedding model TransE, the relational graph converter Relphormer, and the local embedding relation propagation model LERP on the DiaTriples dataset for disease prediction and drug recommendation tasks. The scores are shown in Table 3.
[0146] Table 3 Scores for Disease Prediction and Drug Recommendation Tasks on DiaTriples
[0147]
[0148] Table 3 shows that in the disease prediction task, OMGU-GNN demonstrated superior performance across all evaluation metrics, surpassing LERP, Relphormer, and TransE. This indicates that the model is more accurate and effective in capturing patient disease characteristics and predicting potential diseases. Furthermore, for the drug recommendation task, the MRR and Hit@k (k=1,3,10) of the OMGU-GNN model also outperformed the LERP, Relphormer, and TransE models, further demonstrating the powerful ability of the OMGU-GNN model of this invention to provide drug recommendations.
[0149] Although the specific embodiments of the invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the invention. Based on the technical solutions of the invention, various modifications or variations that can be made by those skilled in the art without creative effort are still within the scope of protection of the invention.
Claims
1. A method for prescription recommendation based on path and global relation awareness, characterized in that, Comprise the following steps: S1, by analyzing the data provided by the artificial intelligence auxiliary construction of knowledge graph in the race of ruijin hospital MMC diabetes, construct a set of triples of diabetes; S1 is as follows: S1.1, data collection: collect disease knowledge from public medical disease data sets, collect knowledge related to the corresponding disease directly or indirectly from extensive textbooks and academic papers, such as disease pathogenesis, clinical manifestations, examination methods, drug dosage, adverse reactions, etc.; S1.2, data preprocessing: the collected data are preprocessed by optical character recognition (OCR) technology, and the collected data are converted into text form, and then the converted text is checked word by word, de-duplicated and screened; S1.3, construct a set of triples: according to the triples constructed after the data preprocessing, the triples are composed of nodes and edges, the nodes are entities, and the edges are the relationships between entities, and the set of triples is as follows: , wherein, denotes a set of triples, denotes a set of entities, denotes a set of relations, denotes a head entity, denotes a tail entity, denotes a relation; S2, extend the triple set by adding inverse relations and identity relations, divide the extended triple set into training set and test set according to proportion and test set , and construct a knowledge graph according to the extended triple set ; S3, Construct a gating graph attention neural network framework based on path and global relationship awareness for knowledge graph Reasoning, the gating graph attention neural network framework includes a gating graph attention neural network and a fully connected layer, and the training set is input into the framework, the gating graph attention neural network is used to capture the feature representation of the query based on the relationship path rule, and the fully connected layer is used to predict the score on the candidate answer. S4, construct a loss function, use multi-classification log loss to measure the difference between the predicted probability distribution and the true label, and continuously adjust the parameters in the gate graph attention neural network framework based on path and global relationship perception to make the loss function gradually decrease, and then optimize the framework; S5、the test set is divided into a training set and a test set The triplets are input into the optimized path and global relation-aware gated graph attention neural network framework to make disease prediction on the patient condition, assess disease risk, and make drug recommendations for the patient by obtaining scores on the candidate answers.
2. The method of claim 1, wherein the method is characterized by, S2 is as follows: The triple set is expanded by adding inverse relations and identity relations, wherein the inverse relation is to exchange the head entity and the tail entity in the triple and change the direction of the relation, The inverse relation is expanded as For the relation type with the inverse relation, the original triple set is traversed, and the corresponding inverse relation triple is generated for each triple; the identity relation is to expand the data set by adding other relations between the head entity and the tail entity, the original triple set is traversed, and the corresponding identity relation is generated for the entity pair of the other relations, and then the expanded triple set is obtained. The expanded set of triples is divided into a training set. and test set A knowledge graph is constructed based on the expanded set of triples. , , The expanded set of entities Represents the expanded set of relations. This represents the expanded set of triples.
3. The method of claim 2, wherein S3 As follows: S3.1, performing feature embedding on entities and relations in the knowledge graph to obtain entity embedding representations and relation information feature vectors of relations between entities, setting query triplets , , representing query entities, representing query relations, representing missing response entities ; S3.2, Path-based method learns a set of key relation paths as local evidence to predict triplets From to key relation path consists of triplets, triplets are denoted as From to key relation path contains entities, respectively , , , , , , , , , triplets are connected in order from head to tail; Feature vectors based on key relationship paths are captured and queried using a gated graph attention neural network OMGU-GNN, from which... A triplet is represented as , , , Perform a traversal, and use the head entity of the triples encountered during the traversal. Indicates that the tail entity uses This indicates that OMGU-GNN has N layers, where N≥1, and the number of layers N is determined by finding the missing response entity. The number of times the OMGU-GNN operation is performed is determined. At each layer of the OMGU-GNN, the process starts from traversing the head entity. Initially, edge detection is captured via the OMGU gating unit. Relationship rule features are derived from key relationship paths at each layer of the gated graph attention neural network. The entity found the missing response entity. , Indicates traversing the head entity With traversing tail entities The relationship is calculated as follows: , …… , …… , wherein, represents the initial feature vector of the traversed head entity , represents the feature vector of the traversed head entity on the first layer of the gated graph attention neural network , represents the feature vector of the traversed head entity on the layer of the gated graph attention neural network , represents the feature vector of the traversed head entity on the layer of the gated graph attention neural network , represents the feature vector of the traversed head entity on the layer of the gated graph attention neural network , represents the feature vector of the query relation on the layer , represents the feature vector of the traversed head entity on the layer , represents the global relation information feature vector, , represents the dimension, represents the operation of the OMGU gating unit.
4. The method of claim 3, wherein the OM is a global relationship aware method. The GU gate unit is as follows: The OMGU gate unit includes update gate, reset gate, hidden state candidate, and updated hidden state four parts; (1) The update gate is a sequential network containing simple linear layers and Sigmoid activation functions, and the relational structure vector , the query relational structure vector and the head entity of the previous layer are input into the update gate to obtain the output of the update gate, and the calculation formula is as follows: , wherein, denotes a concatenation operation of vectors, denotes a weight matrix of the update gate, is a bias term of the update gate, denotes a Sigmoid activation function; (2) The global relationship information is adjusted by resetting the gate, and the relationship structure vector and the global relationship vector are input into the reset gate to obtain the output of the reset gate, and the calculation formula is as follows: , wherein, denotes a vector concatenation operation, denotes a weight matrix of a reset gate, denotes a bias term of a reset gate, denotes a Sigmoid activation function; (3) the information screened by the gate is converted into a new hidden state, and the calculation formula is as follows: , wherein, represents the first layer converts the information of the entities passing through the gating filter into new hidden states, represents an element-wise multiplication, represents a weight matrix, represents a bias term, represents a hyperbolic tangent activation function; (4) the calculation formula of the updated hidden state is as follows: 。 5. The prescription recommendation method based on path and global relationship perception according to claim 4, characterized in that: S3.3 By globally querying relational features and the obtained relational feature representation Computing the traversal head entity Attention for each adjacent edge The calculation formula is as follows: On the first layer of the gate graph attention neural network: , , wherein, denotes the attention score of the gated graph attention neural network at the layer, denotes the attention weight of the gated graph attention neural network at the layer, denotes the transpose, denotes the operation of the activation function , denotes the set of neighboring edges of the head entity characteristic transformation matrix, denotes the query relation characteristic transformation matrix of the gated graph attention neural network at the layer, denotes the attention bias term, denotes the set of neighboring edges of the head entity at the layer of the gated graph attention neural network, denotes the sum of the index values of all edges in the domain at the layer of the gated graph attention neural network, denotes the set of neighboring edges excluding the edge , , denotes the neighbor node of , denotes the relation between and ; To Attention of each adjacent edge Aggregation is performed to obtain The calculation formula is as follows: , wherein, represents the layer after the vector representation, represents an activation function operation; S3.4, update the node through the GRU gate unit: The node messages of the current layer after being aggregated and the node states of the previous layer after being updated are input into the GRU gating unit, and the entity is updated by using the GRU, and the calculation formula is as follows: , wherein, denotes the operation of the GRU gating unit, denotes the operation of the first layer updated node state; S3.5, according to the key relationship path from to is sequentially queried from , , , , until , that is, the query tail entity corresponding to , represents the feature vector of the missing answer entity on the Nth layer of the gated graph attention neural network . The predicted scores on the candidate answers are then obtained by inputting the features into a fully connected layer The scoring function is as follows: , wherein, represents a transformation matrix of the scoring function, represents an offset of the scoring function, represents a scoring result.
6. The method of claim 5, wherein the method further comprises: S4 is as follows: The loss of the scoring result is calculated by the multi-classification log loss function, and the framework is optimized by stochastic gradient descent minimization, and the loss function calculation formula is as follows: , wherein, denotes the fraction of positive triples , denotes the fraction of triples in the training set to which the query triple belongs, denotes the fraction of all triples with the same query.
7. The method of claim 6, wherein the method further comprises: S5 is as follows: The test set The triplets are input into the optimized path and global relation-aware gated graph attention neural network framework, disease prediction is made on the patient condition by obtaining scores on the candidate answers, the highest score is the final result of prediction, the disease risk is evaluated according to the prediction result, and drug recommendation is made for the patient.