A drug recommendation method based on graph neural network and attention mechanism

Through graph neural network and attention mechanism, combined with drug interaction knowledge, the problem of data sparsity and insufficient utilization of historical medical record information in drug recommendation is solved, the accuracy and safety of drug recommendation are improved, and the medical ontology information is realized. Efficient coding.

CN113808693BActive Publication Date: 2024-10-22ZHEJIANG UNIV OF SCI & TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202111061579.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-10
Publication Date
2024-10-22
Estimated Expiration
2041-09-10

AI Technical Summary

Technical Problem

Existing drug recommendation technology has problems with data sparsity and the inability to effectively utilize patient historical medical record information. It also ignores medical ontology information in medical codes, affecting the accuracy and safety of recommendations.

Method used

Using a method based on graph neural network and attention mechanism, by constructing graph neural network and GRU network models, we learn the structural characteristics of patient consultation status and medication information, and introduce the drug interaction knowledge base, combined with drug coexistence and interaction relationships, Generate a list of recommended medications.

Benefits of technology

It improves the accuracy and safety of drug recommendations, effectively utilizes patients' historical medical record information, captures high-order features in the medical system, reduces drug interaction rates, and enhances the interpretability of recommendations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113808693B_ABST
    Figure CN113808693B_ABST
Patent Text Reader

Abstract

The present invention discloses a drug recommendation method based on graph neural network and attention mechanism. The present invention regards the structural features of each patient's medical treatment or medication information as a node, uses graph neural network to capture the relationship between the various structural features, and learns high-order features containing medical system knowledge. At the same time, the attention mechanism is used to better model the user's historical medical records, and the knowledge of drug interactions is introduced, which effectively improves the accuracy and safety of drug recommendations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer application technology and relates to a drug recommendation method based on graph neural network and attention mechanism. Background Art

[0002] The development of modern medical technology has led to the widespread use of electronic medical records, which has accumulated a large amount of clinical data, such as vital signs, clinical summaries, disease diagnosis, prescription drugs, etc. At the same time, deep learning technology provides new technical means for the mining and utilization of medical data, which is currently a research hotspot. Among them, the combination drug recommendation algorithm based on electronic medical records can assist doctors in formulating safe and effective prescriptions based on the changing characteristics of the patient's condition, the properties of the drugs, and the interaction relationship between a large number of drugs, which has important research value.

[0003] Early drug recommendation technologies were mostly rule-based. Relevant experts extracted medication rules based on the patient's diagnosis, disease classification, symptoms, test results and other medical information. The disadvantage is that the maintenance is complex and difficult to update and expand. Drug recommendation technology based on deep learning embeds the patient's physical signs, diagnosis, previous medication and other information into a low-dimensional space, and uses this embedded representation for recommendation, which improves the accuracy of the recommendation. However, they still have many problems, including data sparsity, inability to effectively use the patient's historical medical record information, and ignoring the medical ontology information contained in the medical code.

[0004] Graph neural network is a neural network that acts directly on the graph structure. It has the following characteristics: the input order of nodes is ignored; during the calculation process, the representation of the node is affected by its surrounding neighbor nodes, while the connection of the graph itself remains unchanged; the representation of the graph structure allows reasoning based on the graph. Therefore, graph neural network has become a hot topic of research and is widely used in social networks, recommendation systems, financial risk control, physical systems, molecular chemistry, life sciences, knowledge graphs, traffic prediction and other fields.

[0005] The graph attention mechanism has been introduced into graph neural networks and has been widely used in many fields. Benefiting from the attention mechanism, graph neural networks can better achieve weighted aggregation of neighbors by learning the weights of neighbors, further filter out noisy neighbors, improve model performance, and provide certain explanations for the results. Summary of the invention

[0006] The purpose of the present invention is to address the deficiencies of the prior art and provide a drug recommendation method that can effectively alleviate the sparsity of medical data, effectively utilize the patient's historical case information and take into account the safety of the drug.

[0007] In order to achieve the above object, the technology provided by the present invention is a drug recommendation method based on graph neural network and attention mechanism, comprising the following steps:

[0008] Step 1: Obtain historical electronic medical record data and perform structured processing:

[0009] Obtain the patient's historical medical history and the corresponding medication information to build an electronic medical record, where the medical history includes diagnostic data and surgical status data; the patient's electronic medical record is represented by p = [x1, x2, ..., x t-1 ], t is the patient’s current number of visits, where the patient’s i-th visit is represented by x i =[d i ,p i ,m i ],i=1,2,...,t-1,d i represents the diagnosis data of the patient's i-th visit, p i represents the surgical status data of the patient's first visit in the medical record, m i Represents the medication data for the i-th visit.

[0010] Step 2: Construct three graph neural networks to learn the structural features of patients’ medical treatment and medication information. The inputs of the three graph neural networks are the patients’ diagnosis data, surgical condition data, and medication data, and the corresponding outputs are d e 、p e 、m e ;

[0011] The three graph neural networks use the same structure, including nodes and edges. The nodes include leaf nodes and non-leaf nodes. Leaf nodes are input data, i.e., one of the patient's diagnosis data, surgical condition data, and medication data. Non-leaf nodes are the medical classification of leaf nodes. Edges are the medical classification relationship between two nodes.

[0012] Each non-leaf node is represented as the sum of its own vector representation and the vector representation of all its child nodes, which is calculated using the GAT graph attention mechanism:

[0013]

[0014]

[0015] where g n represents the nth non-leaf node, K represents the total number of attentions, ReLU and LeakyReLU represent nonlinear functions, ch(n) represents the vector representation of the nth non-leaf node itself and all its child nodes, represents the weight calculation coefficient of the current non-leaf node itself and all its child nodes under the kth attention, W k represents the learning parameters of the non-leaf nodes under the kth attention, e *represents the vector representation of the node, a represents a learnable matrix, a T Transpose it.

[0016] Each leaf node is represented by the sum of its own vector representation and that of all its ancestor nodes, which is also calculated using the GAT graph attention mechanism:

[0017]

[0018]

[0019] where c′ n represents the nth leaf node, an(n) represents the vector representation of the nth leaf node itself and all its ancestor nodes, Represents the weight calculation coefficient of the current leaf node itself and all its ancestor nodes under the kth attention, W′ k Represents the learning parameters of the leaf node under the kth attention.

[0020] Step 3: Build two GRU network models with attention mechanism, and input them as the output result d of step 2. e 、p e , the corresponding outputs are k with historical information d , k p ;

[0021] The above two GRU network models with attention mechanism adopt the same structure, both of which include two parallel GRU networks and an attention mechanism module connected to the outputs of the two parallel GRU networks;

[0022] The two parallel GRU models use different activation functions to obtain the hidden layer output information of the historical medical conditions (i.e., diagnosis or surgical status information), as follows:

[0023] H=GRU1(r) (5)

[0024] W h =softmax(F h (H)) (6)

[0025] H=GRU2(r) (7)

[0026] W′ h tanh(F h′ (H′)) (8)

[0027] Among them, H, H′ respectively represent the hidden layer information output by the first GRU network and the second GRU network model, W h , W′ hRespectively represent the attention mechanism weights obtained by the first GRU network and the second GRU network through the softmax and tanh activation functions, F h , F′ h Respectively represent the linear transformation matrix functions that can be learned by the first GRU network and the second GRU network, and r represents d e or p e ;

[0028] The attention mechanism module calculates k with historical information according to formula (9): d , k p ,Right now Diagnostic information with historical information at different time scales, It is surgical situation information with historical information at different time scales.

[0029]

[0030] Where t represents the total number of visits of the patient, W h (i), W′ h (i) represents the attention mechanism weights corresponding to the i-th visit obtained through the softmax and tanh activation functions, respectively. Indicates element-by-element multiplication; k* represents k d or k p ;

[0031] Step 4: Construct two memory neural networks MANN with the same structure; the key-value pairs stored in the first memory neural network are “fusion information of the diagnosis data of the i-th visit” ”-“Medication information with graph neural network "; the key-value pair stored in the second memory neural network is "fusion information of the surgical situation of the i-th visit ”-“Medication information with graph neural network ”;

[0032] Multiply the i-th visit with its historical visits to calculate the weight of the i-th visit

[0033]

[0034] in or Indicates the medical information of the i-th visit with historical information;

[0035] By weight Get the historical medication vector The i-th medication is as follows:

[0036]

[0037] Further get the key of memory neural network

[0038]

[0039] in represents the learning weight, key The corresponding value is

[0040] according to You can get and

[0041] Step 5: Build a drug interaction knowledge base

[0042] Introducing drug interaction knowledge, using the adjacency matrix A C Represents the coexistence relationship of drugs in the electronic medical record, the adjacency matrix A D Represents the drug interaction relationship. A graph convolutional neural network is used to learn the drug co-occurrence relationship and drug interaction relationship, and the drug interaction and co-occurrence relationship are combined with the key-value pairs in step 4 to generate a list of recommended drugs.

[0043] 5-1 Replace step 4 and Combined to get the query vector containing historical medical record information, the i-th diagnosis information and the i-th surgery information

[0044]

[0045] Where W s Represents the comparative weight of diagnosis and surgery information.

[0046] 5-2 Constructing drug coexistence relationship matrix and drug interaction relationship matrix in electronic medical records

[0047] A * =D -1 (A * +I)D -1 (14)

[0048] Where D represents A * The diagonal matrix of the transformation, D -1 is its inverse, I is an identity matrix, A * Represents the drug coexistence relationship matrix A in the electronic medical record C Or drug interaction matrix A D .

[0049] 5-3 Use graph convolutional neural networks to learn the relationship between drugs, combine the interaction and coexistence relationship of drugs into the embedding representation, and obtain the representation matrix Z of the drug co-occurrence graph C , and the drug interaction graph representation matrix Z D :

[0050] Z C =A C tanh(A C m e )W C (15)

[0051] ZD=A D tanh(A D m e )W D (16)

[0052] Among them, W C , W D are the parameter matrices of the drug contribution graph and drug interaction graph, respectively, e The set of key-value pairs obtained in step 4.

[0053] Based on the matrix Z C , Z D and query vector Calculate attention λ i :

[0054]

[0055] Among them, W CD Represents the comparison weights of drug coexistence relationships and interactions.

[0056] Finally, we get the recommended drug list y i :

[0057]

[0058] Among them, W y Represents the weight coefficient when calculating the recommended drug list.

[0059] When the recommendation probability y of a drug in the drug list i When it is greater than the recommendation probability threshold ρ, the drug is recommended.

[0060] Another object of the present invention is to provide a drug recommendation device based on graph neural network and attention mechanism, comprising

[0061] The data preprocessing module is used to structure the patient's historical medical records and the corresponding medication information to construct the corresponding electronic medical record data;

[0062] The graph neural network module is used to learn the structural characteristics of patients’ medical treatment and medication information. The inputs of the three graph neural networks are the patients’ diagnosis data, surgical condition data, and medication data, and the corresponding outputs are d e 、p e 、m e ;

[0063] The GRU network model module with attention mechanism is used to extract features of the diagnostic data and surgical status data output by the graph neural network module through the GRU network, and then combine them with the current medical situation to obtain diagnostic data and surgical status data with historical information.

[0064] A memory neural network MANN module is used to construct a key-value pair of the fusion information of the i-th visit diagnosis data output by the GRU network model module with an attention mechanism and the medication information of the graph neural network, and a key-value pair of the fusion information of the i-th visit surgical situation output by the GRU network model module with an attention mechanism and the medication information of the graph neural network;

[0065] The drug interaction knowledge base module is used to learn drug co-occurrence relationships and drug interaction relationships using a graph convolutional neural network, combine the drug interactions and co-occurrence relationships into the drug embedding representation of the memory neural network MANN module, and generate a list of recommended drugs.

[0066] Yet another object of the present invention is a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the above method.

[0067] Yet another object of the present invention is a computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the above method is implemented.

[0068] The present invention has the following advantages: The present invention treats the structural features of each patient's medical treatment or medication information as a node, uses a graph neural network to capture the relationship between the various structural features, and learns high-order features containing medical system knowledge. At the same time, the attention mechanism is used to better model the user's historical medical records, and drug interaction knowledge is introduced, which effectively improves the accuracy and safety of drug recommendations. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 Drug recommendation process based on graph neural network and attention mechanism.

[0070] Figure 2 A dendrogram of the medical coding architecture.

[0071] Figure 3Comparison of F1 values ​​of different methods for different number of visits. DETAILED DESCRIPTION

[0072] The present invention is further analyzed below in conjunction with specific embodiments.

[0073] The technology provided by the present invention is a drug recommendation method based on graph neural network and attention mechanism, comprising the following steps:

[0074] Step 1: Obtain historical electronic medical record data and perform structured processing:

[0075] Obtain the patient's historical medical history and the corresponding medication information to build an electronic medical record, where the medical history includes diagnostic data and surgical status data; the patient's electronic medical record is represented by p = [x1, x2, ..., x t-1 ], t is the patient’s current number of visits, where the patient’s i-th visit is represented by x i =[d i ,p i ,m i ],i=1,2,...,t-1,d i represents the diagnosis data of the patient's i-th visit, p i represents the surgical status data of the patient's first visit in the medical record, m i Represents the medication data for the i-th visit.

[0076] Step 2: Construct three graph neural networks to learn the structural features of patients’ medical treatment and medication information. The inputs of the three graph neural networks are the patients’ diagnosis data, surgical condition data, and medication data, and the corresponding outputs are d e 、p e 、m e ;

[0077] The three graph neural networks use the same structure, including nodes and edges. The nodes include leaf nodes and non-leaf nodes. Leaf nodes are input data, i.e., one of the patient's diagnosis data, surgical condition data, and medication data. Non-leaf nodes are the medical classification of leaf nodes. Edges are the medical classification relationship between two nodes.

[0078] Each non-leaf node is represented as the sum of its own vector representation and the vector representation of all its child nodes, which is calculated using the GAT graph attention mechanism:

[0079]

[0080]

[0081] where g nrepresents the nth non-leaf node, K represents the total number of attentions, ReLU and LeakyReLU represent nonlinear functions, ch(n) represents the vector representation of the nth non-leaf node itself and all its child nodes, represents the weight calculation coefficient of the current non-leaf node itself and all its child nodes under the kth attention, W k represents the learning parameters of the non-leaf nodes under the kth attention, e * represents the vector representation of the node, a represents a learnable matrix, a T Transpose it.

[0082] Each leaf node is represented by the sum of its own vector representation and that of all its ancestor nodes, which is also calculated using the GAT graph attention mechanism:

[0083]

[0084]

[0085] where c′ n represents the nth leaf node, an(n) represents the vector representation of the nth leaf node itself and all its ancestor nodes, Represents the weight calculation coefficient of the current leaf node itself and all its ancestor nodes under the kth attention, W′ k Represents the learning parameters of the leaf node under the kth attention.

[0086] Step 3: Build two GRU network models with attention mechanism, and input them as the output results de and p of step 2 respectively. e , the corresponding outputs are k with historical information d , k p ;

[0087] The above two GRU network models with attention mechanism adopt the same structure, both of which include a GRU network and an attention mechanism module connected to the output of the GRU network;

[0088] The GRU model uses the attention mechanism to combine the hidden layer output information of historical medical conditions (i.e., diagnosis or surgical status information) into the current information representation. The specific calculation method is as follows:

[0089] H=GRU1(r) (5)

[0090] W h =softmax(F h (H)) (6)

[0091] H′=GRU2(r) (7)

[0092] W′h =tanh(F h′ (H′)) (8)

[0093] Among them, H and H′ represent the hidden layer information output by the first and second GRU network models respectively, and W h , W′ h Respectively represent the attention mechanism weights obtained by softmax and tanh activation functions, F h , F′ h Represents the linear transformation matrix function that can be learned by the first and second GRU network models, r represents d e or p e ;

[0094] The attention mechanism module calculates k with historical information according to formula (9): d , k p ,Right now Diagnostic information with historical information at different time scales, It is surgical situation information with historical information at different time scales.

[0095]

[0096] Where t represents the total number of visits of the patient, W h (i) W h (i) represents the attention mechanism weight corresponding to a specific visit to the clinic obtained through the softmax and tanh activation functions, represents element-by-element multiplication; k * Represents k d or k p ;

[0097] Step 4: Construct two memory neural networks MANN with similar structures; the key-value pairs stored in the first memory neural network are “fusion information of the diagnosis data of the i-th visit” ”-“Medication information with graph neural network "; the key-value pair stored in the second memory neural network is "fusion information of the surgical situation of the i-th visit ”-“Medication information with graph neural network ”;

[0098] Multiply the i-th visit with its historical visits to calculate the weight of the i-th visit

[0099]

[0100] in or Indicates the surgical situation information with historical information of the i-th visit;

[0101] By weight Get the historical medication vector The i-th medication is as follows:

[0102]

[0103] Further get the key of memory neural network

[0104]

[0105] in represents the learning weight, key The corresponding value is

[0106] Step 5: Build a drug interaction knowledge base

[0107] Introducing drug interaction knowledge, using the adjacency matrix A C Represents the coexistence relationship of drugs in the electronic medical record, the adjacency matrix A D Represents drug interaction relationships. A graph convolutional neural network is used to learn drug co-occurrence relationships and drug interaction relationships, and the drug interactions and co-occurrence relationships are combined with the drug embedding representation obtained in step 4 to generate a list of recommended drugs.

[0108] 5-1 Replace step 4 and Combined to get the query vector containing historical medical record information, the i-th diagnosis information and the i-th surgery information

[0109]

[0110] Among them, W s Represents the comparative weight of diagnosis and surgery information.

[0111] 5-2 Constructing drug coexistence relationship matrix and drug interaction relationship matrix in electronic medical records

[0112] A * =D -1 (A * +I)D -1 (14)

[0113] Where D represents A * The diagonal matrix of the transformation, D -1 is its inverse, I is an identity matrix, A * Represents the drug coexistence relationship matrix A in the electronic medical record C Or drug interaction matrix AD .

[0114] 5-3 Use graph convolutional neural networks to learn the relationship between drugs, combine the interaction and coexistence relationship of drugs into the embedding representation, and obtain the representation matrix Z of the drug co-occurrence graph C , and the drug interaction graph representation matrix Z D :

[0115] z C =A C tanh(A C m e )W C (15)

[0116] Z D =A D tanh(A D m e )W D (16)

[0117] Among them, W C , W D are the parameter matrices of the drug contribution graph and the drug interaction graph, respectively, and me is the drug structural feature output from step 2.

[0118] Based on the matrix Z C , Z D and query vector Calculate attention λ i :

[0119]

[0120] Among them, W CD Represents the comparison weights of drug coexistence relationships and interactions.

[0121] Finally, we get the recommended drug list y i :

[0122]

[0123] Among them, W y Represents the weight coefficient when calculating the recommended drug list.

[0124] The resulting drug list is a one-dimensional matrix with an absolute value less than 1. The horizontal and vertical coordinates represent the drug type and recommendation probability, respectively. When the recommendation probability of a drug in the drug list is greater than a pre-set threshold of 0.5, the drug is recommended.

[0125] Experimental process:

[0126] This experiment uses electronic medical record data from the MIMIC-III (Medical Information Mark for Intensive Care) database, which is a free and open intensive care dataset released by the Computational Physiology Laboratory of the Massachusetts Institute of Technology. The present invention uses the diagnosis, operation and prescription data in the database to screen the drugs received by patients within 24 hours after entering the ICU.

[0127] To measure the accuracy of recommendations, the present invention uses the Jaccard similarity coefficient (Jaccard), which is the size of the intersection of the real drug and the recommended drug divided by the size of the union, the average F1 value (F1), which is the harmonic mean of the precision and recall rate, and the precision recall curve (PRAUC) as the measurement indicators of accuracy.

[0128] To measure the safety of recommended drugs, the drug interaction rate DDI, that is, the ratio of DDI drugs in the recommended combination drugs, is used.

[0129] Comparative experiments were conducted with six currently effective methods. Among them, the Nearst method recommends the same combination of drugs as the previous diagnosis based on the similarity between the current visit and the previous diagnosis; the LR method is an L2 regularized logistic regression, which uses multi-hot vectors to represent the input data, and binary classification is used to process multi-label outputs. The Leap method uses a recurrent neural network to model label dependencies and uses a content-based attention mechanism to capture the mapping between label instances. The RETAIN method is based on a two-layer attention network model for sequential data drug combinations, which selects important clinical variables in past visits. The GAMENet method is a method that integrates historical medication and drug-drug interactions (DDIs) using a graph convolutional network through a storage module. The PREMIER method uses an attention mechanism to learn patient history representations and combines a graph attention mechanism to learn drug interactions.

[0130] Table 1 Model comparison experiment

[0131]

[0132]

[0133] Table 1 shows the performance of various methods for drug recommendation tasks on the dataset. The experimental results show that among all the methods, the model of the method of the present invention can achieve the best effect. Specifically, the method proposed in the present invention is 0.97%, 0.89% and 0.93% higher than the latest method (PREMIER) in terms of Jaccard, PRAUC and F1 scores, respectively. At the same time, the method of the present invention takes into account drug interactions, and the lowest DDI is 0.0705 when the top 40 drug interaction rates are taken among all similar deep learning methods. In addition, the average number of drugs recommended by the present invention is 14.98, which is the average number of drugs closest to the actual medical records of 14.68 when compared with various deep learning methods.

[0134] GRAD-mkg represents the experimental results of the present invention without the drug interaction knowledge base. In the absence of the drug interaction knowledge base, the accuracy of the recommended drugs does not change much, but the DDI in the model-recommended drugs increases to 0.767, which shows that the method combines the knowledge of the drug interaction relationship with the query vector with historical medical information, which reduces the interaction rate in the recommended drugs and improves the safety of medication. Grad-tree represents a model generated by only using graph neural networks to learn the structural features of the patient's medical conditions and medication information. After the embedding of the medical code ontology structure, the accuracy of drug recommendations dropped significantly, which shows that the graph neural network used in this article has the ability to encode high-order structural features and can enrich the embedded representation of the medical ontology. In a certain sense, it makes up for the problem of sparse training data and improves the accuracy of drug recommendations.

[0135] Since each patient has a different number of visits, the impact of previous visits should be considered. For different time series lengths, the present invention outperforms all other methods. Figure 3 As shown in the figure, the F1 value of the present invention is the highest in all classifications based on the number of visits. In particular, for data with a large number of visits, it can still maintain a higher accuracy rate compared with other methods, which shows that the present method has a better modeling ability for long-term dependencies in patient medical records.

[0136] Table 2 Comparison of different DDI levels

[0137]

[0138]

[0139] Regarding the effect on drug interactions, the present invention has also conducted further experiments. The first 40, 60, 80, and 100 DDI types were used respectively to explore the impact of the present invention and the compared methods under the consideration of different numbers of DDIs. The results are shown in Table 2. Although the △DDI rate increased from -18.48 to -0.26%, when the number of DDI types considered changed from 40 to 100, GRAD was the only algorithm that could achieve DDI reduction, and no matter how many DDI types there were, the △DDI rate was always greater than zero. This shows that after introducing drug interaction knowledge, the present invention can reduce the interaction rate of recommended drugs and is safer.

[0140] Therefore, it can be concluded that the present invention has the following advantages: The proposed drug recommendation algorithm based on graph neural network and attention mechanism treats the structural characteristics of each patient's medical treatment or medication information as a node, uses graph neural network to capture the relationship between the nodes, and learns high-order features containing medical classification relationships. At the same time, the attention mechanism is used to better model the user's historical medical records and introduce drug interaction knowledge, which effectively improves the accuracy and safety of drug recommendations.

Claims

1. A drug recommendation method based on graph neural network and attention mechanism, characterized in that The following steps are involved: Step 1: Obtain historical electronic medical record data and perform structured processing: Obtain the patient's historical medical history and the corresponding medication information to build an electronic medical record, where the medical history includes diagnostic data and surgical status data; the patient's electronic medical record is represented by p = [x1, x2, ..., x t-1 ], t is the patient’s current number of visits, where the patient’s i-th visit is represented by x i =[d i ,p i ,m i ],i=1,2,...,t-1,d i represents the diagnosis data of the patient's i-th visit, p i represents the surgical status data of the patient's first visit in the medical record, m i represents the medication data of the ith visit; Step 2: Construct three graph neural networks to learn the structural features of patients’ medical treatment and medication information. The inputs of the three graph neural networks are the patients’ diagnosis data, surgical condition data, and medication data, and the corresponding outputs are d e 、p e 、m e ; Step 3: Build two GRU network models with attention mechanism, and input them as the output result d of step 2. e 、p e , the corresponding outputs are k with historical information d , k p ; Step 4: Construct two memory neural networks MANN with the same structure; The key-value pair stored in the first memory neural network is "the fusion information of the diagnosis data of the i-th visit ”-"Medication information using graph neural network "; the key-value pair stored in the second memory neural network is "fusion information of the surgical situation of the i-th visit ”-"Medication information using graph neural network ”; Step 5: Build a drug interaction knowledge base 5-1 Replace step 4 and Combined to get the query vector containing historical medical record information, the i-th diagnosis information and the i-th surgery information Where W s represents the comparative weight of diagnostic and surgical information; 5-2 Constructing drug coexistence relationship matrix and drug interaction relationship matrix in electronic medical records A * =D -1 (A * +I)D -1 (1) Where D represents A * The diagonal matrix of the transformation, D -1 is its inverse, I is an identity matrix, A * Represents the drug coexistence relationship matrix A in the electronic medical record C Or drug interaction matrix A D ; 5-3 Use graph convolutional neural networks to learn the relationship between drugs, combine the interaction and coexistence relationship of drugs into the embedding representation, and obtain the representation matrix Z of the drug co-occurrence graph C , and the drug interaction graph representation matrix Z D : Z c =A c fishy(A) c m e )W c (15) Z D =A D fishy(A) D m e )W D (16) Among them, W C ,W D are the parameter matrices of the drug contribution graph and drug interaction graph, respectively, e The set of key-value pairs obtained in step 4; Based on the matrix Z C , Z D and query vector Calculate attention λ i : Among them, W CD represents the comparative weights of drug coexistence relationships and interactions; Finally, the recommended drug list is obtained: Among them, W y Indicates the weight coefficient when calculating the recommended drug list; When the recommendation probability yi of a drug in the drug list is greater than the recommendation probability threshold ρ, the corresponding drug is recommended.

2. A drug recommendation method based on graph neural network and attention mechanism as claimed in claim 1, characterized in that The three graph neural networks in step 2 use the same structure, including nodes and edges. The nodes include leaf nodes and non-leaf nodes. Leaf nodes are input data, i.e., one of the patient's diagnosis data, surgical condition data, and medication data. Non-leaf nodes are the medical classifications of leaf nodes. Edges are the medical classification relationships between two nodes. Each non-leaf node is represented as the sum of its own vector representation and the vector representation of all its child nodes, which is calculated using the GAT graph attention mechanism: where g n represents the nth non-leaf node, K represents the total number of attentions, ReLU and LeakyReLU represent nonlinear functions, ch(n) represents the vector representation of the nth non-leaf node itself and all its child nodes, represents the weight calculation coefficient of the current non-leaf node itself and all its child nodes under the kth attention, W k represents the learning parameters of the non-leaf nodes under the kth attention, e * represents the vector representation of the node, a represents a learnable matrix, a T Transpose it; Each leaf node is represented by the sum of its own vector representation and that of all its ancestor nodes, which is also calculated using the GAT graph attention mechanism: where c′ n represents the nth leaf node, an(n) represents the vector representation of the nth leaf node itself and all its ancestor nodes, Represents the weight calculation coefficient of the current leaf node itself and all its ancestor nodes under the kth attention, W′ k Represents the learning parameters of the leaf node under the kth attention.

3. A drug recommendation method based on graph neural network and attention mechanism as described in claim 1 or 2, characterized in that The two GRU network models with attention mechanism in step 3 adopt the same structure, both of which include two parallel GRU networks and an attention mechanism module connected to the outputs of the two parallel GRU networks; The two parallel GRU models are specifically the first GRU network and the second GRU network. The first GRU network and the second GRU network use different activation functions to obtain hidden information of historical medical treatment conditions, as follows: H=GRU1(r) (5) w h =softmax(F h (H)) (6) H′=GRU2(r) (7) w′ h =tanh(F h′ (H′)) (8) Among them, H and H′ represent the hidden layer information output by the first GRU network and the second GRU network model respectively, and w h ,w′ h Respectively represent the attention mechanism weights obtained by the first GRU network and the second GRU network through the softmax and tanh activation functions, F h , F′ h Respectively represent the linear transformation matrix functions that can be learned by the first GRU network and the second GRU network, and r represents d e or p e ; The attention mechanism module calculates k with historical information according to formula (9): d , k p ,Right now Diagnostic information with historical information at different time scales, It is the surgical situation information with historical information at different time scales; Where t represents the total number of visits of the patient, W h (i), W′ h (i) represents the attention mechanism weights corresponding to the i-th visit obtained through the softmax and tanh activation functions, respectively. represents element-by-element multiplication; k * Represents k d or k p .

4. A drug recommendation method based on graph neural network and attention mechanism as described in claim 1 or 2, characterized in that In step 4, the memory neural network multiplies the i-th visit with its historical visit to calculate the weight of the i-th visit. in or Indicates the medical information of the i-th visit with historical information; By weight Get the historical medication vector The i-th medication is as follows: Further get the key of memory neural network in represents the learning weight, key The corresponding value is according to You can get and 5. A drug recommendation device based on graph neural network and attention mechanism that implements any of the methods described in claims 1-4, characterized in that include: The data preprocessing module is used to structure the patient's historical medical records and the corresponding medication information to construct the corresponding electronic medical record data; The graph neural network module is used to learn the structural characteristics of patients’ medical treatment and medication information. The inputs of the three graph neural networks are the patients’ diagnosis data, surgical condition data, and medication data, and the corresponding outputs are d e 、p e 、m e ; The GRU network model module with attention mechanism is used to extract features of the diagnostic data and surgical status data output by the graph neural network module through the GRU network, and then combine it with the current medical situation to obtain diagnostic data and surgical status data with historical information; A memory neural network MANN module is used to construct a key-value pair of the fusion information of the i-th visit diagnosis data output by the GRU network model module with an attention mechanism and the medication information of the graph neural network, and a key-value pair of the fusion information of the i-th visit surgical situation output by the GRU network model module with an attention mechanism and the medication information of the graph neural network; The drug interaction knowledge base module is used to learn drug co-occurrence relationships and drug interaction relationships using a graph convolutional neural network, combine the drug interactions and co-occurrence relationships into the drug embedding representation of the memory neural network MANN module, and generate a list of recommended drugs.

6. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute any one of the methods described in claims 1-4.

7. A computing device, characterized in that The method comprises a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Drug combination recommendation method based on time attention mechanism and graph convolutional network

    CN111798954A

  • Drug recommendation modeling method based on medical record data and drug interaction risks

    CN111968715A

  • Collaborative filtering recommendation method integrated with graph neural network and attention mechanism

    CN112084407A

  • Drug combination prediction method based on deep learning

    CN113223656A