A drug recommendation method based on machine learning, an electronic device and a computer readable storage medium
The PCCNet model, by combining GRU, D-MPNN, and GCN technologies, captures changes in patients' conditions and recommends drug combinations, solving the problem of high DDI in drug recommendation models and improving accuracy and safety.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-20
- Publication Date
- 2026-03-03
AI Technical Summary
Existing drug recommendation models tend to overestimate drug interactions and ignore changes in patient condition, leading to inaccurate recommendations.
The PatientConditionChangeNetwork (PCCNet) model is used to learn patients’ historical and current medical data through machine learning models. Combined with technologies such as GRU, D-MPNN and GCN, it captures changes in patients’ conditions and recommends drug combinations. It considers drug graph and EHR graph encoding to reduce the risk of drug interactions.
It effectively reduces drug interactions (DDI) of recommended drug combinations while providing accurate recommendations, enhancing the model's interpretability and ability to capture changes in patient condition.
Smart Images

Figure CN115240873B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of label classification and relates to a drug recommendation method, model, and training method based on machine learning. Background Technology
[0002] Drug recommendation, an important task in natural language processing, aims to recommend drug combinations based on a patient's condition and can also be viewed as a multi-label classification task. However, patients often suffer from multiple diseases simultaneously, and models must consider drug interactions (DDIs) of drug combinations when recommending medications, making the recommendation process more challenging. Existing work exploring changes in patient medications and disease progression is limited, but these changes may indicate future trends in the patient's condition, which is crucial for identifying core drugs.
[0003] Drug recommendation aims to provide patients with effective and safe drug combinations. Drug recommendations are typically based on a patient's electronic health record (EHR), which includes the patient's diagnostic history and the doctor's prescribing history. With the help of drug recommendation models, doctors can prescribe medication more quickly in actual treatment. In previous work, neural network-based drug recommendations can be divided into two categories:
[0004] The first approach does not consider the patient's historical information: instance-based methods (Gonge et al., 2021; Read et al., 2009; Zhang et al., 2017) recommend current diagnostic records based on the patient's historical information. This approach fully utilizes the patient's current diagnostic vector, but the lack of historical information may lead to poor recommendation results.
[0005] The second approach is based on patient longitudinal vector modeling. The longitudinal approach aims to capture the dependencies between patient history vectors and achieve better results.
[0006] Currently, most patient longitudinal vector-based modeling methods model from the perspective of medication, rarely from the perspective of the patient's condition. However, in real life, when a doctor prescribes medication, he does so based on the patient's past medical history. Similarly, a patient's current condition is largely related to their previous condition. Ignoring the changing trends of the patient's condition means the model cannot highlight the patient's core symptoms, potentially leading to an inflated DDI (Discretionary Indicator) in the model results.
[0007] • Rule-based methods (Readetal., 2009; Choietal., 2016) rely on rules designed by people to make recommendations. Typically, this approach requires a large number of doctors to design and is not easily transferable.
[0008] • Instance-based methods (Gonge et al., 2021; Zhang et al., 2017) use only the current patient's health information and do not consider the patient's historical health information. For example, LEAP encodes the current patient's diagnosis vector and then uses the vector obtained from the encoder to make recommendations. This approach may be more effective in the absence of historical patient health information, but may be less accurate due to the lack of historical patient health information.
[0009] • Longitudinal Methods (Leetal., 2018; Shangetal., 2019; Yang et al., 2021; Yang et al.; Wuetal., 2022) utilize patients' historical health information and mine correlations between each visit, most of which employ RNNs. For example, GAMENet uses patients' historical health information to build a GraphAugmentedMemoryModule and uses historical information to make medication recommendations for the current patient. However, most of these methods mine correlations from a drug perspective, rarely from a patient perspective. Summary of the Invention
[0010] To address the issue of excessively high Drug Recommendation Index (DDI) in drug recommendation models, this invention proposes the following technical solution:
[0011] In a first aspect, embodiments of the present invention propose a machine learning-based drug recommendation method, comprising: learning a patient's historical and current medical data through a machine learning model; the machine learning model outputting a core disease vector and a global drug vector for the patient based on the patient's historical and current medical data; the machine learning model encoding and outputting medical information based on a drug graph and an EHR graph; the machine learning model obtaining a model output based on the core disease vector, the global drug vector, and the medical information; and mapping the model output to obtain a recommended drug combination based on a threshold, wherein the drug combination includes a core drug and extended drugs.
[0012] In the second aspect, the machine learning model mentioned in the first aspect:
[0013] process vector and diagnostic vector The patient stated that the data was pieced together. , Let represent the patient representation for the i-th patient at the t-th visit;
[0014] The relationship between patient representations obtained from t patient visits is modeled using GRU. The input of GRU is the patient representation. The output of GRU is patient disease information. ;
[0015] Patient disease information Input attention module to obtain patient disease information Attention score ;
[0016] Use Note Score Multiplied by the patient's disease information Obtain the core disease vector of the output patient. ;
[0017] Analyze the patient's core condition vector The current patient's core condition vector The core query vector is obtained by inputting the linear layer. ;
[0018] The embeddings of all drugs in the drug molecule graph are obtained by encoding the drug molecule graph using D-MPNN;
[0019] The patient's EHR image embedding is obtained by encoding the EHR image using GCN;
[0020] Multiply the embeddings of all the drugs and the patient EHR map embedding to obtain medical information r;
[0021] The current patient is represented The global drug vector for the i-th patient at the current time is obtained by inputting the global drug linear layer. ;
[0022] The core query vector q i and the global drug vector Add them together to get the requested vector;
[0023] The model output for patient i is obtained by multiplying the request vector by the medical information r. It is expressed by the following formula:
[0024]
[0025] in: These are learnable parameters. It is element-wise multiplication.
[0026] On the third-party side, the machine learning model described in the second aspect: core query vector The length is 1×|M|, and the length of medical information is |M|×|M|.
[0027] The recommendation results are processed using the sigmoid function. The model output for patient i is compressed to the (0,1) interval. This is a recommended combination of drugs. The size is 1×|M|;
[0028] Each dimension in the vector represents a drug. If the value of a drug is greater than 0.5, the machine learning model will recommend the drug to the patient; otherwise, the machine learning model will not recommend the drug. The drug combination formed by the recommended drugs is the recommended drug of the machine learning model.
[0029] In the fourth aspect, the machine learning model mentioned in the second aspect: the modeling of the relationship between patient representations obtained from t patient visits using GRU, is expressed by the following formula:
[0030]
[0031] Where: σ is the sigmoid activation function; It is the product of elements; As an update gate in the GRU module, it controls the number of hidden states. Flowing into the next GRU to capture long-standing relationships; As a reset gate in the GRU module, it controls the number of hidden states. Candidate hidden state at inflow time t To capture short-term dependencies in a sequence; This is the hidden state of the t-th GRU module. The computation depends on the hidden state of the previous GRU module. , The model's input is fed into the t-th GRU module through its pathway; It is a parameter matrix; It is a parameter matrix, and nH is the hidden layer size.
[0032] In the fifth aspect, the machine learning model described in the second aspect: the attention function of the attention module, is expressed by the following formula:
[0033]
[0034] in: It is input Attention score; W is the parameter matrix; This is the current patient's condition information, calculated by... Information on the tth patient visit similarity to Assign attention scores.
[0035] In the sixth aspect, the machine learning model of the second aspect: the step of encoding the drug molecule map through D-MPNN specifically includes...
[0036] Based on the drug set M, a molecular image set G is obtained for each drug. The molecular image of a drug consists of atoms and atom-atom edges.
[0037] From the i-th drug G i The molecular image obtained is Figure G i The neighbor set N(v) of node v;
[0038] The calculation process of D-MPNN is as follows:
[0039]
[0040] in: The encoded message is between node v and node w in the t-th iteration; a k t represents the atomic characteristics of atom k; t represents the number of layers. It represents the hidden state between node k and node v; Wi is the learnable parameter matrix; It is the concatenation function of the atomic characteristics av of atom v; e vw It is the key feature e between nodes v and w; Represents the ReLU activation function;
[0041] Add all hidden states Obtain all drug embeddings from the drug molecule map:
[0042]
[0043] in: is a learnable parameter matrix; T is the total number of visits to patient i; hv is the embedding of node v; It is the initial molecular graph encoding obtained by adding the hidden states between all nodes.
[0044] In the seventh aspect, the machine learning model of the second aspect: the step of encoding the EHR map through GCN to obtain the patient's EHR embedding specifically includes...
[0045] Let C denote the drug feature vector matrix that the GCN algorithm needs to input, let A denote the patient's EHR graph matrix, and let GCN denote the GCN function. The calculation steps for EHR encoding are as follows:
[0046] The definition of the GCN function is as follows:
[0047]
[0048] in I is the identity matrix. It is a degree matrix;
[0049] The EHR map is input into a two-layer GCN to obtain the embedding G of the patient's EHR map. e The calculation formula is as follows:
[0050]
[0051] Here, W is a parameter matrix used to adjust the bias between the two GCN layers.
[0052] In one aspect, an electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the method described in the first to seventh aspects.
[0053] In one aspect, a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method described in the first to seventh aspects.
[0054] Beneficial Effects: This invention proposes PatientConditionChangeNetwork (PCCNet), which models the patient's current core medication by mining the spatiotemporal changes in the patient's medication sequence and state vector, and assigns some auxiliary medications as the currently recommended drug combination. Experimental results show that the proposed model achieves results no less than or lower than the existing state-of-the-art (SOTA) results while significantly reducing the recommended drug dosage index (DDI). Attached Figure Description
[0055] Figure 1 It is the model architecture of PPCNet. Detailed Implementation
[0056] To further illustrate the technical means and effects adopted by the present invention in order to achieve the intended purpose, the following description is provided in conjunction with the accompanying drawings and preferred embodiments.
[0057] Example: This invention proposes a machine learning model to capture changes in patient condition and recommend medications, called the Patient Condition Change Network (PCCNet). PCCNet can be divided into a Patient Condition Change module and an overall medication module. The Patient Condition Change module predicts the patient's core condition by learning from the patient's historical condition and recommends core medications. Core medications can be obtained from the patient's core condition. Core medications are those that play a key role in the patient's treatment. The Patient Condition Change module significantly reduces the DDI (Drug Interaction Intake) rate of the recommendations while maintaining Jaccard and F1 scores as much as possible. The overall medication module makes recommendations based solely on the patient's current patient representation, considering only the detailed information of the patient's current visit. Therefore, the main task of the overall medication module is to correct core medications and expand medication recommendations. The PCCNet model mines relationships from the patient's perspective, attempting to find the influence of the patient's historical core condition on the current condition, thereby providing medication recommendations.
[0058] Based on the above concept, the main contributions of this invention are as follows:
[0059] The drug recommendation model PCCNet proposed in this invention can effectively reduce drug interactions in recommended drug combinations while providing accurate recommendation results.
[0060] By mimicking the real-world process of doctors prescribing medication, a module for changes in patient condition is proposed, which enhances the interpretability of PCCNet.
[0061] Extensive experiments were conducted on the public dataset MIMIC-III to demonstrate the effectiveness of the PCCNet model of this invention.
[0062] To clearly define the present invention, the technical terms involved in the present invention are defined. For undefined technical terms, they should be understood in the general sense in the art.
[0063] Molecular Representation: The task of molecular representation is to embed molecules into molecular structure diagrams to obtain molecular representations. Research on molecular characterization has been ongoing for a long time. Molecular descriptors (Mauri et al., 2006) and drug fingerprints (Duvenau et al., 2015) are commonly used to represent drug molecules (Rogers and Hahn, 2010). With the development of deep learning, more and more deep learning models are being used to generate molecular representations (Huang et al., 2020b). (Huang et al., 2020a) proposed using graph-based neural network models to directly model molecular graphs. (Stokeset et al., 2020) proposed the D-MPNN model, which focuses more on the relationships between atoms. In this invention, inspired by (Stokeset et al., 2020), D-MPNN is used as the molecular encoder.
[0064] Electronic Health Record (EHR): A patient's EHR data includes detailed information about each visit, stored as a medical code and a longitudinal vector of the patient. Let i be the vertical vector of patient i, where This represents patient i's j-th visit, where n is the number of visits. i This indicates the number of times patient i has visited a doctor. This invention uses... The patient's longitudinal vector is represented by a triplet, by... ,in It is the j-th diagnosis record of the i-th patient. The explanation is similar. Let D, P, M represent the sets of elements for patients, where... This invention represents the diagnostic set for patient i, and similarly makes... The program set representing patient i, This indicates the drug group for patient i.
[0065] Safe Medication Recommendations: The goal of safe medication recommendations is to suggest safer (lower DDI) drug combinations for patients while ensuring accuracy. This is achieved through patient historical diagnostic data. i Patient history data P i And patient history medication data M i The model is trained so that it can recommend drug combinations M to patient i. i .
[0066] Historical diagnostic data D i This refers to the DIAGNOSES_ICD.csv file in the MIMIC-III dataset, which contains diagnostic data given by doctors for each patient visit.
[0067] Historical process data P i This refers to the PROCEDURES_ICD.csv file in the MIMIC-III dataset, which contains doctors' records of medication prescriptions and surgical procedures for each patient's hospitalization.
[0068] The main symbols used in the model described in this invention are explained below:
[0069]
[0070] In one embodiment, the PPCNet model structure is as follows: Figure 1As shown, the entire model consists of two modules: the first module is the patient's condition change module, which generates a core vector of the patient's current condition based on historical diagnostic data. The second module is the overall medication module, which aims to expand the recommended medication combinations for the patient, resulting in a medication expansion vector. Finally, the core condition vector and the medication expansion vector are added together and multiplied by the medication vector encoded by the drug graph encoder to obtain the final recommendation result.
[0071] In one approach, the model input is described as follows: Patient health information is converted into codes using a universal medical code, and the health information includes... After data processing, three embedding tables are obtained. Diagnosis embedding table... Each row represents the embedding vector of a diagnostic code. Process Embedding Table Each line represents the embedding vector of the procedural code. This represents a drug embedding table, where each row represents a drug code embedding vector.
[0072] As described above, the model structure of the present invention includes a patient condition change module, which achieves its purpose in the following manner.
[0073] In the first step, the patient condition change module extracts disease information from the user's historical diagnostic information to simulate the evolution of the patient's condition. First, the process vector... and diagnostic vector Patient characteristics were obtained by splicing. ,in This represents the patient representation for the i-th patient at the t-th visit.
[0074] In the second step, for the extraction of the patient's condition, GRU is used to model the relationships between different patient representations of a patient. For example, for the t patient representations formed from a patient's 1st to tth visits, the input of GRU is the patient representation. .
[0075] It is understandable that a patient's condition will change over time. Similarly, if a doctor wants to prescribe medication, they must consider the patient's disease progression to determine the trend of change. Therefore, the ability of the model to simulate disease evolution is the core of the patient's condition change module. Dynamic RNN technology can be used to explore the evolution trend of the patient's condition through the information pathways between GRUs while extracting the condition information, thereby obtaining the core condition of the patient.
[0076] GRU (Chungetal., 2014) is an improvement on RNN and LSTM, solving the gradient vanishing problem of RNN and being faster than LSTM.
[0077] This invention uses GRU to model the relationship between patient representations obtained from t patient visits, as shown in the following formula:
[0078]
[0079] Where σ is the sigmoid activation function. It is the product of elements. As an update gate in the GRU module, it controls the number of hidden states. The flow into the next GRU is used to capture long-standing relationships. As a reset gate in the GRU module, it controls the number of hidden states. Candidate hidden state at inflow time t To capture short-term dependencies in a sequence. This is the hidden state of the t-th GRU module. The computation depends on the hidden state of the previous GRU module. , The model's input is fed into the t-th GRU module through its pathway. It is a parameter matrix. These are also parameter matrices, which serve as learnable parameters to adjust the biases between different GRU modules. Where n H It is the size of the hidden layer. This is the patient representation of the i-th patient at the t-th visit, obtained previously by concatenating the process vector and the diagnostic vector. This invention utilizes GRU to extract patient disease information. ,in This represents the medical information of the i-th patient during the t-th visit. This allows the model to integrate the medical information from the previous visit with the information from each subsequent visit, thus enabling the model to express the evolution of the medical information during each visit.
[0080] In the third step, in order to obtain the patient's disease information Filter the results and obtain This is incorporated into an attention module. The attention mechanism focuses limited attention on key information, thus conserving resources and quickly acquiring the most effective information. In this problem, attention will further highlight the patient's core condition by assigning weights. The attention function used in this invention is expressed as:
[0081]
[0082] in It is input Attention score This is the current patient's condition information, calculated by... Information on the tth patient visit similarity to An attention score is assigned, where W is a parameter matrix used to control the output bias of the attention module.
[0083] In the fourth step, attention scores are used. Multiply by the output of GRU As output The calculation formula is as follows:
[0084]
[0085] in, Information about the patient's disease The core disease vector, refined and taking into account the historical evolution of the patient's condition, will be used in the subsequent analysis of experimental cases. Explain the function of .
[0086] In the fifth step, PCCNet finally uses only the current patient core condition vector. I would recommend it because It contains information about the patient's condition from the first visit to the current visit, while other core condition vectors do not contain much information about the current visit.
[0087] In the sixth step, The output of the patient's condition change module is obtained by inserting it into a linear layer; the core query vector is... .
[0088] The model structure of this invention also includes a drug and an EHR graph encoder, which achieves its purpose in the following manner.
[0089] The task of the drug graph encoder is to encode the drug molecule graph and obtain drug embeddings. This invention uses a Directed Message Passing Neural Network (D-MPNN) as the drug graph encoder. Unlike MPNN, D-MPNN focuses more on edge relationships, and it has achieved better results in molecular representation tasks. For molecular graph embedding, using drug molecule information alone or patient EHR information alone can affect the correspondence and association between patients, conditions, and drugs. The correspondence and association between patients, conditions, and drugs are expressed through the encoder, and this information is reflected in the calculation of core conditions and global drugs, which can significantly improve the model score, achieving the results shown in the experimental examples of this invention.
[0090] EHR Graph Encoder: An EHR graph is a matrix built from patient prescription records. Simply put, if drug i and drug j both appear in a single patient visit, we assign a value of 1 to the corresponding position in the EHR matrix. This means that there are synergistic relationships between drugs in the EHR graph, which often enhance drug effects. Therefore, these synergistic drugs may appear in the same drug combination. Encoding the EHR graph can highlight these co-occurrences, thereby improving the accuracy of recommendations.
[0091] Let C represent the drug feature vector matrix that the GCN algorithm needs to input, let A represent the patient's EHR graph matrix, and let GCN represent the GCN function. Then, in this invention, the calculation steps for EHR encoding are as follows:
[0092]
[0093] in I is the identity matrix. It is a degree matrix.
[0094] In this invention, a two-layer GCN is used for encoding to better extract information from the EHR map. To prevent overfitting, ReLU is placed between the two GCN layers as the activation function. Compared to traditional neural network activation functions, ReLU solves the problems of gradient explosion and gradient vanishing, and is also computationally faster. The EHR map is input into the two-layer GCN to model the synergistic effect of drugs in the EHR map, and the calculation formula is as follows:
[0095]
[0096] Here, W is a parameter matrix used to adjust the bias between the two GCN layers. Once the calculation is complete, the embedding G of the patient's EHR map can be obtained. e .
[0097] D-MPNN encodes drug molecule graphs: First, a set of drugs M used in the dataset is collected. Based on the drug set M, a set of molecular images G for each drug can be obtained. These molecular graphs consist of atoms and atom-atom edges. Starting from the i-th drug G... i The molecular image can be used to obtain Figure G i Let N(v) be the neighbor set of node v. Let av represent the characteristics of node v (atom v), and e vw The edge features (keys) between node v and node w are represented. The calculation process of D-MPNN is as follows:
[0098]
[0099] Where t is the layer number, a k It is an atomic characteristic of atom k. It is the hidden state between node k and node v. The encoded message is between node v and node w in the t-th iteration, where Wi is a learnable parameter matrix. It is the atomic characteristic a of atom v v The concatenation function, where the bond characteristics between nodes v and w are represented by e. vw The formula uses The function is a message-passing function. The function is the node update function, which is actually already written in the formula. This represents the ReLU activation function.
[0100] Add all hidden states To obtain molecular diagram embeddings:
[0101]
[0102] Among them is A learnable parameter matrix, h v It is the embedding of node v. It is the initial molecular graph encoding obtained by adding the hidden states between all nodes.
[0103] The above describes the use of D-MPNN to obtain the embeddings of all drugs, which can be used as drug information to compare with the patient EHR embeddings obtained from GCN. e Multiply the results to obtain the medical information r.
[0104] The model structure of this invention also includes an overall drug module, which achieves its purpose in the following way: Overall Drug Module: After the patient's condition change module, this invention obtains the patient's core condition vector. Recommending medication based on this vector can significantly reduce the DDI (Discretionary Intake) of recommended combinations. However, drug recommendations based on the core condition vector only yield the core drugs in the recommended combinations. Returning only this recommendation result would result in too few drugs in the recommended drug combinations, affecting the model's performance. Therefore, an overall drug module is needed to supplement the recommended combinations. In reality, when prescribing medication, doctors also prescribe core drugs based on the patient's primary disease and then provide a more refined drug combination based on the patient's condition. The overall drug module will only rely on the patient's description... Recommendations are made. This module will use the current health vector. The input is fed into the global drug linearization layer, and the result is obtained through the global drug linearization layer. ,in This represents the global drug vector for the i-th patient at the current time. Then, the core query vector qi and the global drug vector are... The request vector is obtained by adding the two parts, and then multiplied by the drug and the medication record output by the EHR map encoder to obtain the final result, as shown in the following formula:
[0105]
[0106] in These are learnable parameters. It is element-wise multiplication. This is the model output for patient i.
[0107] A general explanation, such as Figure 1 As shown, the PPCNet model architecture first integrates the patient's diagnostic vectors... and process vector The input h is obtained by concatenation. i (t) The model. After initially embedding a linear layer, the patients from the first n-1 visits are represented as... arrive The data is input into the patient state change module to obtain the core vector qi of the patient's condition, while medication information is input into the D-MPNN. Molecular graph encoding is performed. Finally, the core vector of the patient's condition is added to the current patient representation to obtain the request vector. The request vector is then multiplied by the medical information r to obtain the model output. Finally, a threshold is used to map the model output to 0 or 1 to obtain the recommended combination. .
[0108] For model training, this invention uses two loss functions: binary crossentropy and multi-label hinge loss.
[0109] Binary Cross-Entropy Loss (BCE). In classification tasks, cross-entropy is often used to measure the difference between the target and the output. This invention uses binary cross-entropy as the loss function. The formula for BCE is as follows:
[0110]
[0111] Multi-label hinge loss considers the error between the true class and other classes and is often used to measure the accuracy of multi-label classification. To improve model performance, this invention also uses multi-label hinge loss as the loss function, as shown in the following formula:
[0112]
[0113] The algorithm execution of the above-described model includes the following steps:
[0114] When recommending medication to the i-th patient, the algorithm first uses the patient's diagnostic information. Process information As the initial input to the model, these two pieces of information are first multiplied by their respective embedding tables. and This process yields a serialized vector, which is then concatenated to obtain the patient representation. ,in Let T represent the patient representation of the i-th patient during the t-th visit. That is, if patient i has a total of T visits, there will be T patient representations for patient i, where... The size is 256. Then... Disease information is obtained by inputting it into the GRU module. The output size of a single GRU module is 1×|M|, where |M| represents the length of the drug set M. Then... This is incorporated into the attention module, which processes all patient information. Sampling is performed to generate the disease vector for the t-th patient. Weights are assigned, which are used to estimate based on the patient's condition before and after. The extent of the impact on the patient's current condition. The model adjusts the current diagnosis by considering the patient's condition information from the previous T-1 test; therefore, the model's recommendations are based on... Proceed. After obtaining... After calculating the attention score, we multiply the score by... Obtain the core disease vector Then, it is put into a linear layer to obtain the core query vector q, where the input and output dimensions of the linear layer are both |M|.
[0115] The overall medication module makes recommendations based solely on the patient's current patient representation. The data is placed in a linear layer with an input size of 256 and an output size of 1×|M|. This linear layer uses linear fitting to find possible recommendation results, thus obtaining the global query vector q'. Finally, a learnable parameter is used. Multiply by q to adjust the size of q, and add it to q' to obtain the query vector for the recommendation model.
[0116] The model requires medical information for recommendations, using drug molecule information and patient EHR maps as patient information. For drug molecule information, the model uses the D-MPNN algorithm to perform graph encoding on the drug molecule images, where the drug molecule image information is obtained from the rdkit library. The model inputs the adjacency matrix of the drug molecule image into the D-MPNN, which encodes each vertex by passing information through the molecule image. Finally, all vertex codes are summed to obtain the graph encoding of the current drug molecule image. For a single drug graph encoding, the output size of the D-MPNN is |M|, and for the entire drug set, the output size of the D-MPNN is |M|×|M|. For patient EHR images, the model uses the GCN algorithm for graph encoding. The model inputs the patient EHR matrix into the GCN model. For the edge features required by the GCN model, this paper uses the identity matrix as the edge feature input. The model first calculates the degree matrix of the EHR matrix, and then performs graph convolution calculations similar to convolution transformation to obtain the patient EHR graph encoding, with an output size of |M|×|M|. After obtaining the drug molecular map encoding and the patient EHR map encoding, the model multiplies the two encodings to obtain medical information r, which has a size of |M|×|M|.
[0117] Finally, the query vector is multiplied by the medical information r, where the query vector has a length of 1 × |M| and the medical information has a length of |M| × |M|. After multiplication, the value is compressed to the (0,1) interval using the sigmoid function, yielding the model's recommendation result. Its size is 1×|M|. Each dimension in the vector represents a drug. If the corresponding value is greater than 0.5, the model will recommend the drug to the patient; otherwise, the model will not recommend the corresponding drug.
[0118] Experimental Example: The experiment is based on the public dataset MIMIC-III (Johnson et al., 2016), which contains nearly 60,000 ICU admission records. This invention evaluates its performance by comparing PCCNet with the following baseline methods:
[0119] •LR, standard logistic regression;
[0120] •ECC (Read et al., 2009), EnsembleClassifierChain (ECC);
[0121] •RETRIN (Choietal., 2016);
[0122] •LEAP (Zhang et al., 2017);
[0123] •DMNC (Leetal., 2018);
[0124] •GAMENet (Shang et al., 2019);
[0125] •MICRON (Yang et al., 2021);
[0126] •SafeDrug (Yangetal.);
[0127] •COGNet (Wuetal., 2022);
[0128] Shang et al., 2019; Yang et al., 2021; Yang et al.; Wu et al., 2022, used DDI rate, Jaccard similarity coefficient, F1 score and PRAUC as evaluation metrics for this invention.
[0129] Results Analysis: As shown in the table below, the PCCNet proposed in this invention significantly reduces the DDI of recommended drug combinations and outperforms state-of-the-art methods in both Jaccard and F1-score metrics. For methods that do not consider patient history information, namely LR, ECC, and LEAP, these methods recommend values based on current patient health information, leading to poor results. For methods that consider patient history information, namely RETAIN (Choie et al., 2016), DMNC (Leetal., 2018), GAMENet (Shange et al., 2019), SafeDrug (Yang et al.), MICRON (Yang et al., 2021), and COGNet (Wue et al., 2022), these methods achieve better results. SafeDrug further improves performance by incorporating the molecular structure of drugs, and its proposed LocalBipartiteEncoder significantly reduces the DDI of recommended drug combinations. The MICRON model is the first method to model changes in patient condition, but due to the lack of modeling of drug relationships and the relationship between drugs and disease, its results are slightly lower than SafeDrug. COGNet uses a transformer-like architecture (Vaswanie et al., 2017) to model patients and drugs, while also incorporating drug vectors and patient electrophysiological records, but its recommendation results have a high DDI.
[0130]
[0131] Sample Analysis: To explain the previously extracted core disease vectors To demonstrate the effectiveness of the model, this invention conducted a sample analysis. In the MIMIC-III dataset, this invention randomly selected one patient for analysis. This patient visited the hospital three times. During the first visit, the patient presented with cirrhosis and congestive heart failure; during the second visit, the patient was diagnosed with hepatic coma, acute respiratory failure, and congestive heart failure; and during the third visit, the patient was diagnosed with acute renal failure and esophagitis. Patient information and medication information are listed in the table below.
[0132] This invention uses ICD-9 (International Classification of Diseases-9) codes and ATC (Anatomy and Therapeutics) codes in place of patient diseases and medications used.
[0133] As can be seen from the description of the patient in this invention, the patient's condition may be the same as the finally diagnosed disease or some of the lesions based on it. In the PPCNet model, this invention only uses the patient's current core condition vector. This involves obtaining a core disease vector based on the patient's current diagnostic information and using its output to determine medication. To explore the core disease vector... The relationship between each, the present invention uses each Recommendations were made and recorded, and the results are shown in the table below. Each successfully recommended drug is indicated by an underline in the table.
[0134]
[0135] The table shows that the model can provide some correct medications in each recommendation, which demonstrates the effectiveness of the core disease vector for the recommendation task. Furthermore, the recommended combinations based on the core disease vector also include the medications prescribed for each patient visit. For example, the model provides J01C in each recommendation.
[0136] However, this invention discovered some unusual aspects in the recommendation results. For example, drug A12A appeared in every doctor's prescription, and every recommendation made using the core condition vector also hit A12A. This invention looked up the specific drug name of A12A and found that A12A actually represents other mineral supplements. This means that recommendations using the core condition vector may recommend not only core drugs but also some adjunctive therapies. Therefore, this invention studied this case and found that because the doctor prescribed nearly half of the medications as adjunctive therapies, each recommendation using the core condition vector resulted in three to four adjunctive therapies being prescribed. However, this situation does not affect the model's accuracy because these are also medications prescribed by the doctor, meaning these adjunctive medications are also needed by the patient.
[0137] The proposed drug recommendation model, PPCNet, utilizes patients' historical medical information to better capture the evolution of their disease, thereby providing more accurate and lower disease-independent (DDI) drug combinations. The model's performance was validated on the public dataset MIMIC-III. Results show that PCCNet can significantly reduce the DDI rate of recommended drug combinations while providing accurate recommendations. In fact, the starting point of PCCNet is to reduce the DDI of drug combinations. In some practical treatments, a low DDI rate is even more important than the accuracy of the drug combination itself. Finally, the effectiveness of each component in PCCNet is demonstrated through ablation experiments. Future work will focus on further exploring methods to reduce DDI while improving model scores.
[0138] This invention also provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the methods provided in the above embodiments. The electronic device provided by this invention can implement the various implementation methods in the above method embodiments, and the corresponding beneficial effects.
[0139] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the method provided in this invention and achieves the same technical effect.
[0140] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0141] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A method for drug recommendation based on machine learning, characterized in that, comprising learning historical and current medical data of a patient by a machine learning model; outputting a core disease vector and a global drug vector of the patient by the machine learning model according to the historical and current medical data of the patient; The machine learning model encodes the drug graph and The graph encodes the medical information output; obtaining a model output by the machine learning model according to the core disease vector and the global drug vector, and the medical information; mapping the model output according to a threshold to obtain a recommended drug combination, the drug combination including a core drug and an extended drug; wherein the machine learning model outputs medical information based on the drug graph and The graph encodes output medical information, including By encoding the drug molecule graph results in embeddings of all drugs of the drug molecule graph; By To Encoding the graph yields a patient Embedding of the graph; Embedding of all drugs and patients Multiplication of the embeddings of the graphs results in medical information ; wherein the steps are performed by encoding a drug molecule graph, specifically comprising According to the drug set get a set of molecular images for each drug , the molecular graph of a drug consists of atoms and atom-atom edges; From the first kind of drug molecular image, a graph is obtained in which the neighbor set of a node ; The calculation process is as follows: wherein: is an encoded message at the th iteration between nodes and nodes ; is an atomic feature of an atom ; is a number of layers; is a layer hidden state between nodes and nodes ; is a concatenation function of atomic features of atoms ; is a learnable parameter matrix; is a concatenation function of atomic features of atoms ; is a bond feature between nodes ; denotes an activation function; add all hidden states obtain embeddings for all drugs of the drug molecule graph wherein: is a learnable parameter matrix; is a patient total number of visits; is a node embedding; is an initial molecular graph encoding obtained by summing the hidden states between all nodes; is a layer hidden state between node and node The steps are performed by The steps are performed by Encoding the graph results in an embedding of the patient The steps are performed by Let denote the drug feature vector matrix input to the algorithm, let denote the patient's graph matrix, denote the function, the calculation steps of EHR encoding are as follows: The definition of the function is as follows: wherein , is the identity matrix, is the degree matrix; will be described below with reference to the accompanying drawings. Figure input two layers The patient in the middle gets Embedding of the figure The formula is as follows: wherein, is a parameter matrix used to adjust the bias between the two layers.
2. The machine learning-based drug recommendation method of claim 1, wherein the machine learning model: process vector and diagnosis vector concatenated to obtain patient representation , denotes the patient representation for the i-th patient at the t-th visit; modeling relationships between patient representations obtained at t visits of a patient by a GRU, the input of the GRU being the patient representations , the output of the GRU being the patient disease information ; patient disease information inputting an attention module to obtain patient disease information an attention score ; Using attention scores Multiplying the patient disease information Obtaining an output patient core condition vector ; current patient core condition vector in the patient core condition vector current patient core condition vector in the patient core condition vector input linear layer to get core query vector ; encodes a drug molecule graph by a D-MPNN to obtain an embedding of all drugs of the drug molecule graph; encodes an EHR graph by a GCN to obtain an embedding of the patient EHR graph; multiplies the embedding of all drugs and the embedding of the patient EHR graph to obtain medical information r; representing the current patient inputting the global drug linear layer to obtain a global drug vector of the i-th patient at the current time ; adding the core query vector q i and the global drug vector results in a request vector; multiplying the request vector with the medical information r results in a model output for patient i is represented by the following equation: wherein: are learnable parameters, is an element-wise multiplication.
3. The machine learning-based drug recommendation method of claim 2, wherein Core query vector Length 1 x |M|, medical information length |M| x |M|; recommendation results are passed through a sigmoid function value is compressed into the interval (0, 1), the model output for patient i is the drug combination recommendation result, of size 1 x |M|; Each dimension in the vector represents a drug, and if the corresponding value for a drug is greater than 0.5, the machine learning model will recommend the drug for the patient, otherwise the machine learning model does not recommend the drug, and the recommended drugs form a drug combination that is the recommended drug of the machine learning model. 4.The machine learning based drug recommendation method of claim 2, wherein, the relationship between the patient representations obtained from the t visits of the patient is modeled by a GRU, and is represented by the following formula: where: σ is the sigmoid activation function; is the element-wise product; As the update gate in the GRU module, controls how much of the hidden state flows into the next GRU to capture long-term dependencies; As the reset gate in the GRU module, controls how much of the hidden state flows into the candidate hidden state at time t to capture short-term dependencies in the sequence; is the hidden state of the t-th GRU module, the computation of depends on the hidden state of the previous GRU module , is input to the t-th GRU module through the model's pathway; is a parameter matrix; is a parameter matrix, nH is the size of the hidden layer. 5.The machine learning based drug recommendation method of claim 2, wherein, the attention function of the attention module is represented by the following formula: in: It is input Attention score; W is the parameter matrix; This is the current patient's condition information, calculated by... Information on the tth patient visit similarity to Assign attention scores.
6. An electronic device, comprising: comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps in the method of any one of claims 1-5 when executing the computer program.
7. A computer-readable storage medium, characterized in that, The computer program is stored on the computer readable storage medium, and the computer program is executed by the processor to implement the steps in the method of any one of claims 1-5.