Construction method of drug recommendation model for relieving entity sparsity based on hierarchical algorithm

By constructing a drug recommendation model using a hierarchical algorithm and a dual-attribute graph network, the problem of long-tailed data distribution in drug recommendation is solved, thereby improving the accuracy and safety of drug recommendations and reducing the amount of computation.

CN120853798APending Publication Date: 2025-10-28YANSHAN UNIV

Patent Information

Application Number
CN202510957897.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-11
Publication Date
2025-10-28

AI Technical Summary

Technical Problem

Existing technologies fail to effectively solve the problem of long-tail data distribution in drug recommendations, resulting in entity sparsity and difficulty in balancing recommendation accuracy and security.

Method used

A hierarchical algorithm is used to construct a drug recommendation model. Patient health representation is obtained through the pre-training stage, drug relationships are modeled hierarchically, safety and accuracy are represented by a dual-attribute graph network, and the model training is optimized by combining a loss function.

Benefits of technology

It improves the accuracy and safety of drug recommendations, reduces the amount of computation, alleviates entity sparsity, and enhances the ability to model long-tail data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120853798A_ABST
    Figure CN120853798A_ABST
Patent Text Reader

Abstract

The invention discloses a drug recommendation model construction method for relieving entity sparsity based on a hierarchical algorithm, and belongs to the technical field of drug recommendation, and the method comprises the steps: building a pre-training module, and obtaining the health representation of a patient; performing correlation layering; constructing a dual-attribute graph network representation stage; aggregating the drug graph representing the safety and the bipartite graph used for representing the drug disease / operation accuracy into dual-attribute representation in a graph network; recommending related medicine combinations to adapt to long-term health conditions; constructing a loss function, wherein the loss function comprises a prediction probability based on recommended drugs and cross entropy loss and DDI loss of a real label; and training the deep learning model to obtain predicted drug recommendation representation. By layering historical record data of a patient, capturing a sequence relation and forming an accurate graph structure and a safe graph structure for drugs, diseases and operations, the drug recommendation performance can be improved, and the calculation amount is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of drug recommendation technology, and in particular to a method for constructing a drug recommendation model based on a hierarchical algorithm to alleviate entity sparsity. Background Technology

[0002] In recent years, artificial intelligence (AI) has developed rapidly, and its decision support capabilities have brought numerous conveniences to humanity. Particularly in the medical field, an increasing number of AI-assisted decision-making systems have emerged. Scientific and precise medication is crucial for patient treatment. However, current hospital medication decisions primarily rely on the personal experience and judgment of attending physicians, which can sometimes be unreliable. Therefore, it is hoped that AI algorithms can be used to uncover potential correlations from historical expert data, thereby providing more scientific and precise support for clinical medication decisions.

[0003] Current technologies use graph neural networks to encode relationships between medical entities to obtain information about these relationships. However, they do not consider the long-tailed distribution of the data. For example, Chinese patent CN115240811A discloses a method for constructing and applying an implicit relationship drug recommendation model based on graph neural networks. This invention improves node representation by refining the graph structure and, in turn, uses the graph structure to improve node representation, but it does not consider the long-tailed distribution of patient data. On the other hand, Chinese patent CN116153528A discloses a drug recommendation method based on attention mechanisms and global retrieval. It obtains patient representations through attention mechanisms and performs global retrieval by comparing patient similarity, but it does not balance the accuracy and safety of the recommendations. Summary of the Invention

[0004] The technical problem to be solved by this invention is to provide a method for constructing a drug recommendation model based on a hierarchical algorithm to alleviate entity sparsity. By hierarchically classifying patient historical data, capturing sequence relationships, and forming accurate and safe graph structures for drugs, diseases, and surgeries, the performance of drug recommendation can be improved and the amount of computation can be reduced.

[0005] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:

[0006] A method for constructing a drug recommendation model based on a hierarchical algorithm to alleviate entity sparsity includes the following steps:

[0007] S1. Construct a pre-training phase, establish a pre-training module, and use sequential recommendation technology to model the patient's disease and surgical history to obtain the patient's health representation;

[0008] S2, Relevance Hierarchy: In the previous stage, entity-level representations were obtained from a single visit.

[0009] S3. In the dual-attribute graph network representation stage, firstly, a complete drug graph is constructed to represent safety, and then a bipartite graph for drug-disease / surgery is constructed to represent accuracy.

[0010] S4. Aggregate the drug graph representing safety and the bipartite graph representing drug-disease / surgery accuracy into a dual-attribute representation in the graph network;

[0011] S5. By integrating the access level representation obtained from pre-training in S1 and the dual-attribute representation in the graph network in S4, relevant drug combinations are recommended to adapt to long-term health conditions.

[0012] S6. Construct the loss function, including cross-entropy loss and DDI loss based on the predicted probability of the recommended drug and the true label;

[0013] S7. Train the deep learning model by inputting the patient's disease information, surgical information, historical diagnosis information, historical surgical information, and historical drug representation into the trained deep learning model to obtain the predicted drug recommendation representation.

[0014] A further improvement to the technical solution of the present invention is that S1 specifically includes the following steps:

[0015] S11 constructs a data sample and builds relationships between entities based on the data sample. The data sample includes the patient's historical dataset and drug-related data. The historical data includes the patient's disease code and surgical code.

[0016] Pre-training involves doctors making medication recommendations during clinical visits by referring to the patient's medical history and considering the current disease and surgery.

[0017] S12 encodes the current disease and surgery in the data sample into the patient's current health status;

[0018] First, extract the disease set d(t) = {d} from the access v(t). i d j ...} and the surgery set p(t) = {p k ,p i Define two learnable embedding tables E, ...}; d ∈R |D|×dim and E p ∈R |p|×dim These correspond to disease and surgery, respectively, where dim is the embedding size; serving as a shared entity-level representation in the global data. It is by passing on the disease d i / surgery p k Generated by mapping to the embedding space; combined access to all disease / surgery embeddings in v(t) to obtain a disease / surgery set demonstration ed (t) and e p (t);

[0019] Disease / Surgery Collection Demo e d (t) and e p (t) is:

[0020] e d (t)=d(t)E d e p (t)=p(t)E p

[0021] S13 encodes the medications used during the last medical visit in the data sample as the patient's historical health status.

[0022] Because potential underlying conditions must be considered, medications from the last visit are included in v(t-1) to reflect the patient's historical health status; shared medication embeddings are shown in Table E. m ∈R |M|×dim The purpose is to encode the drug vector v(t-1) from the last visit; if the patient is visiting the hospital for the first time and has no prior medical history, their historical medication record is represented by a zero vector;

[0023] The previous medical visit information is embedded as follows:

[0024] e m (t-1)=m(t-1)E m

[0025] S14 integrates the patient’s current health status and the patient’s historical health status into an access level table;

[0026] Concatenate three vectors of equal length into a single vector three times the length of the original vector. This concatenated vector forms the access level table e′. v (t)∈R 1×3dim ;

[0027] Access Level Table e′ v (t) is:

[0028] e′ v (t)=CONCAT(e d (t),e p (t),e m (t-1))

[0029] Then, vector e′ v (t) The dimension of the dataset is transformed to |M|, which is the total number of drugs in the dataset, through a multilayer perceptron, and then the final prediction representation is obtained through the sigmoid activation function.

[0030] The final prediction is:

[0031]

[0032] As a result of pre-training, the obtained entity-level representation e d e p e m This information is input into subsequent models; additionally, the access level representation e′ generated during training is also included. v It is used as the source of residual networks in the recommendation stage of model methods.

[0033] A further improvement to the technical solution of the present invention is that S2 specifically includes the following steps:

[0034] S21 Designs a hierarchical approach to model drug relevance;

[0035] Define a drug relationship bucket B m-m It captures all drug pairs in the global dataset and records the co-occurrence frequency of each drug combination.

[0036] Where i is the specific layer index, n m-m Represents the total number of floors. |B represents the number of relations within a specific layer. m-m | represents the total number of relationships in the drug relationship bucket, and |M| is the total number of drugs in the global dataset;

[0037]

[0038] Using this co-occurrence data, the isomorphic independent probability distribution of drug correlations can be inferred;

[0039] S22 adjusts the steep gradient within the drug correlation distribution to a relatively flat pyramid-shaped hierarchical structure. In this drug safety pyramid, the top layer contains the fewest but highly correlated relationships, while the base layer is characterized by a large number of weakly correlated relationships.

[0040] Among them, the steep gradient on the drug co-occurrence probability distribution curve shows a rapid decay trend from high-frequency relationships to low-frequency relationships, that is, the frequency of the first few drug combinations is extremely high, while the frequency of a large number of subsequent combinations is very low, resulting in an extremely skewed distribution.

[0041] Set the top-level data size to q m-m Together with the gradient coefficient i, it determines the data distribution within the bucket and the number of elements in any layer k, denoted as:

[0042]

[0043] Based on the two equations above, determine the number of layers n in the stratification. m-m :

[0044]

[0045] To ensure the accuracy of the required relationships, heterogeneous correlation bucket B is constructed. m-d and B m-p During this period, in addition to establishing the top layer, a bottom layer was also introduced;

[0046] The lowest-level correlations represent extremely low co-occurrence rates between the drug and the disease / surgery, and will be removed in the following stratification stages:

[0047]

[0048] Where |D| and |P| represent the total number of diseases and surgeries in the dataset, respectively, and c m-d and c m-p Represents the co-occurrence count between the drug and the disease / surgery; θ is defined as an excessively low co-occurrence threshold, set at 0.03% of the total visits, and |{c m-d <θ}| is the amount of data to be set at the underlying level;

[0049] S23 applies a layered approach similar to security-related methods, setting the top two layers q. m-d and q m-p The amount of data is calculated, and the amount of data for each layer is calculated in combination with the gradient coefficient k;

[0050]

[0051] Based on the two equations above, determine the number of layers n in the stratification. m-d and n m-p :

[0052]

[0053] After reorganizing the three sets of relations, a more evenly distributed and gently sloping hierarchical structure was achieved; correlations were assigned to the relations within these layers to maintain consistency with the subsequent graph network; the correlation of security relations within a given layer i was determined.

[0054]

[0055] in, and The correlation of relationships within a given layer is given by p, where the predefined maximum correlations for drug-disease and drug-surgery are p, respectively. m-d and p m-p .

[0056] A further improvement to the technical solution of the present invention is that S3 specifically includes the following steps:

[0057] To represent security, S31 first defines an undirected complete graph. Where M(t-1) is the set of all drugs visited, v(t-1), and a m-m It is a 0-1 adjacency matrix representing the edge set; each specific node m∈M(t) is associated with the corresponding drug embedding e. m Related; establish a weighted embedding vector in GCN-SW Each one-dimensional embedding in this vector maps to a relation at a specific layer;

[0058] Use the correlation corresponding to the relationship as the initial weight w′ of the edge in the graph. m-m :

[0059]

[0060] Where i and j represent the indices of the two drugs, This indicates the relationship between two drugs. express The layer to which it belongs in the relationship bucket. This indicates the relevance generated for the relationship at this layer during the layering phase;

[0061] In addition, some drugs have drug interactions and cannot be used together;

[0062] S32 also needs to consider this insecurity relationship when modeling drug combination diagrams, so it uses a drug-drug interaction diagram and combines it with a drug-drug safety diagram;

[0063] The final weight of the edges between drugs is:

[0064]

[0065] in, This refers to the interaction relationship mentioned in the previous section, where λ is a learnable parameter. It is the final weight of the edges between drugs;

[0066] A GCN-based graph network is used to deliver the drug graph, as shown below:

[0067]

[0068] in, Indicates from m i to m j The message vector being transmitted This represents the embedding representation of the drug obtained after training on access v(t-1). During training, the message passing function MESSAGE1(·) and the node update function UPDATE1(·) are used to update the representation of each entity. The function AGGREGATION1(·) is used to aggregate the drug nodes updated in this iteration to form a drug set representation reflecting safety.

[0069]

[0070] To ensure accuracy, S32 defines two binary fully connected Gs. m-d (t)={D(t), M(t-1), A m-d} and G m-p (t)={P(t), M(t-1), A m-p In a bipartite graph, different types of entities are interconnected; each edge is a directed edge that begins with a drug and ends with a disease / surgery, where D(t) / P(t) is the set of all drugs in visit v(t), and A m-d / A m-p Let D(t) / P(t) be a 0–1 adjacency matrix representing the edge set, where each node in D(t) / P(t) is associated with a corresponding disease / surgery embedding e. d / e p Related;

[0071] To enhance the symptomatic efficacy of medication and overcome the different embedding spaces of various entities, a graph network based on mapping features is applied; an embedding table is constructed. As attribute a m-d and a m-p Plot drug-disease / surgery features, with each row of the table independently mapping the type of correlation in the layer of the correlation bucket; initialize and update the two bipartite graphs respectively.

[0072]

[0073] Where i, j, and k represent indicators of drugs, diseases, and surgeries, ultimately yielding... and

[0074] Then pass the message and update the bipartite graph:

[0075]

[0076] in, This refers to the embedding of the i-th drug obtained from the (t)-th visit. This refers to the embedding of the j-th disease during the (t-1)th visit. This refers to the embedding of the k-th surgery during the (t-1)th access; This refers to the weight between the i-th drug and the j-th disease node. This refers to the weight between the i-th drug and the k-th surgical node;

[0077] After using the embedding space of drugs to describe diseases and surgeries, these are ultimately aggregated to formulate disease set representations and surgery set representations, thereby capturing the accuracy of recommendation results:

[0078]

[0079]

[0080] During the message passing and update phases, the GCN graph network is used to process graph data.

[0081] A further improvement of the technical solution of the present invention is that: in S4, after processing by a graph neural network, the accuracy of drug-induced disease / surgery and the safety of drug are integrated to obtain a comprehensive representation of the level of medical care;

[0082] The dual-attribute representation in a graph network is as follows:

[0083] e v (t)=CONCAT(e d (t),e p (t),e m (t-1)).

[0084] A further improvement to the technical solution of the present invention is that S5 specifically includes the following steps:

[0085] S51 will represent the access level e′ obtained from pre-training. v (t) and the two-attribute representation e in the graph network v Adding (t) together, we get e″ v (t); Subsequently, based on the three information sources of disease, surgery, and medication, it is divided into three corresponding parts: e″ d (t), e″ p (t) and e″ m (t);

[0086] e″ v (t)=e v (t)+e v (t)

[0087] e″ d (t),e″ p (t),e″ m (t-1) = SEGMENT(e″) v (t))

[0088] To accommodate patients' long-term health status, three RNNs were used to model historical medical visits, generating three segmented representations at the patient level:

[0089]

[0090] A gated recurrent unit is used as the core structure of the recurrent neural network;

[0091] S52 combines the results from the three RNNs and passes them to a multilayer perceptron to obtain the final patient representation. h , representing the probability of each drug in the prescription; select drugs with a probability value greater than a predefined threshold to obtain the recommended drug combination;

[0092]

[0093] in, This represents a multi-hot vector of the predicted drug set, where the subscript i indicates the i-th entry in the vector. Indicates recommended medication m i , Indicates that medication is not recommended. i .

[0094] A further improvement to the technical solution of this invention lies in: in S6, the recommendation task is regarded as a multi-label binary classification task; two loss functions are used, namely the binary cross-entropy loss L. bce and multi-label edge loss L multi ;

[0095]

[0096] Where, m i This represents the actual value of drug i in the prescription. This represents the predicted value in the model. This indicates the probability that drug i and drug j will interact.

[0097] The loss function for drug interactions is:

[0098]

[0099] A further improvement to the technical solution of this invention is as follows: In S7, the data in the database is divided into a training set, a validation set, and a test set, with a ratio of 4:1:1. During training, the patient's disease information, surgical information, drug information, and all learnable weights in the model are input into the deep learning model. Training is performed through forward propagation, loss calculation, and backpropagation to update the learnable parameters. After processing this information, the deep learning model generates drug recommendations, calculates the loss function, and updates each parameter through backpropagation to reduce the loss between the true and predicted values. Then, the hyperparameters in the model are adjusted through the validation set, and the best hyperparameters are determined based on the performance of several sets of validation set data on the model. During testing, some data that did not appear during training and validation are selected as input to the model to obtain the predicted drug recommendation representation.

[0100] The technological advancements achieved by this invention due to the adoption of the above technical solutions are as follows:

[0101] 1. This invention achieves fine modeling and reinforcement of low- and medium-frequency relationships by constructing a hierarchical correlation structure, integrating the frequency distribution of training data, and setting up an enhancement mechanism. This achieves the technical effect of alleviating entity sparsity and improving the modeling ability of long-tail data.

[0102] 2. This invention, by setting up a dual-attribute graph network, captures the relationships between drugs and diseases, and drugs and surgeries respectively, and integrates safety graph and accuracy graph representations, thereby achieving comprehensive modeling of key medical entities in patient medical records and improving the technical effect of drug recommendation accuracy and medication safety. Attached Figure Description

[0103] Figure 1 This is a flowchart of the method for constructing a drug recommendation model based on a hierarchical algorithm to alleviate entity sparsity in this invention;

[0104] Figure 2 This is a schematic diagram of the mechanism of the algorithm model in this invention. Detailed Implementation

[0105] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments:

[0106] like Figure 1 As shown, a method for constructing a drug recommendation model based on a hierarchical algorithm to alleviate entity sparsity includes the following steps:

[0107] S1. Construct a pre-training phase, establish a pre-training module, and use sequential recommendation technology to model the patient's disease and surgical history to obtain the patient's health representation;

[0108] S11 constructs a data sample and builds relationships between entities based on the data sample. The data sample includes the patient's historical dataset and drug-related data. The historical data includes the patient's disease code and surgical code.

[0109] Pre-training is used in clinical practice where doctors make medication recommendations by referring to the patient's medical history and considering the current disease and surgery. To simulate this actual clinical process, a pre-training method is introduced to capture the complexity of biomedical data and obtain entity-level representations.

[0110] S12 encodes the current disease and surgery in the data sample into the patient's current health status;

[0111] Specifically, firstly, extract the disease set d(t) = {d} from the access v(t). i d j ...} and the surgery set p(t) = {p k p l Both are heat vectors mentioned in the problem definition; define two learnable embedding tables E d ∈R |D|×dim and E p ∈R |p|×dim These correspond to disease and surgery, respectively, where dim is the embedding size; serving as a shared entity-level representation in the global data. It is by passing on the disease d i / surgery p k Generated by mapping to the embedding space; combined access to all disease / surgery embeddings in v(t) to obtain a disease / surgery set demonstration e d (t) and e p (t);

[0112] Disease / Surgery Collection Demo e d (t) and e p (t) is:

[0113] e d (t)=d(t)E d e p (t)=p(t)E p

[0114] S13 encodes the medications used during the last medical visit in the data sample as the patient's historical health status.

[0115] Because potential underlying conditions must be considered, medications from the last visit are included in v(t-1) to reflect the patient's historical health status; similar to diseases, shared medication embeddings are included in table E. m ∈R |M|×dimThe purpose is to encode the drug vector v(t-1) from the last visit; if the patient is visiting the hospital for the first time and has no prior medical history, their historical medication record is represented by a zero vector;

[0116] The previous medical visit information is embedded as follows:

[0117] e m (t-1)=m(t-1)E m

[0118] S14 integrates the patient’s current health status and the patient’s historical health status into an access level table;

[0119] Concatenate three vectors of equal length into a single vector three times the length of the original vector. This concatenated vector forms the access level table e′. v (t)∈R 1×3dim ;

[0120] Access Level Table e′ v (t) is:

[0121] e′ v (t)=CONCAT(e d (t),e p (t),e m (t-1))

[0122] Then, vector e′ v (t) The dimension of the dataset is transformed to |M|, which is the total number of drugs in the dataset, through a multilayer perceptron (MLP), and then the final prediction representation is obtained through the sigmoid activation function.

[0123] The final prediction is:

[0124]

[0125] As a result of pre-training, the obtained entity-level representation e d e p e m This information is input into subsequent models; additionally, the access level representation e′ generated during training is also included. v It is used as the source of residual networks in the recommendation stage of model methods.

[0126] S2, Relevance Hierarchy: In the previous stage, entity-level representations were obtained from a single visit.

[0127] However, entity-level representations based on single visits lack a global perspective and face challenges in terms of security and accuracy. Capturing relationships between entities is difficult due to data sparsity. This step strengthens relationships between undesirable biomedical entities, balances the relevance of relationships, and improves model representativeness. Co-occurrence frequencies are statistically analyzed, and relevance buckets are constructed using independent and joint drug distributions. For the long-tail distribution of medical data, a pyramid-style hierarchical algorithm is designed to decompose relationships into generalized layers and redistribute relevance, laying the foundation for accurate propagation and updating of biomedical entities.

[0128] Observations revealed that a high co-occurrence frequency between two drugs indicates they are generally suitable for the same condition and are less likely to cause adverse interactions. Conversely, a low co-occurrence frequency suggests these drugs are complementary options for the same condition or correspond to completely different diseases, and are more likely to interact. Therefore, the safety correlation between drugs is considered to stem from their co-occurrence frequency.

[0129] S21 Designs a hierarchical approach to model drug relevance;

[0130] Define a drug relationship bucket B m-m It captures all drug pairs in the global dataset and records the co-occurrence frequency of each drug combination.

[0131] Where i is the specific layer index, n m-m Represents the total number of floors. |B represents the number of relations within a specific layer. m-m | represents the total number of relationships in the drug relationship bucket, and |M| is the total number of drugs in the global dataset;

[0132]

[0133] Using this co-occurrence data, the isomorphic independent probability distribution of drug correlations can be inferred;

[0134] S22 adjusts the steep gradient within the drug correlation distribution to a relatively flat pyramid-shaped hierarchical structure. In this drug safety pyramid, the top layer contains the fewest but highly correlated relationships, while the base layer is characterized by a large number of weakly correlated relationships.

[0135] The steep gradient on the drug co-occurrence probability distribution curve shows a rapid decay trend from high-frequency relationships to low-frequency relationships; that is, the first few drug combinations have extremely high frequencies, while the frequencies of many subsequent combinations are very low, resulting in an extremely skewed distribution.

[0136] Set the top-level data size to q m-m Together with the gradient coefficient i, it determines the data distribution within the bucket and the number of elements in any layer k, denoted as:

[0137]

[0138] Based on the two equations above, the number of layers n in the stratification can be determined. m-m :

[0139]

[0140] Unlike traditional recommendation algorithms that rely on homogeneous historical data to predict current data, the unique nature of the drug recommendation framework lies in generating recommendations based on heterogeneous current data. Therefore, improving the accuracy of drug recommendations depends on accurately capturing the mapping correlation between drugs and diseases / surgeries.

[0141] The relationship between drugs is similar, with the mapping correlation between drugs and diseases / surgeries considered to stem from their co-occurrence frequency. However, the interpretation of the low co-occurrence rate between drugs and diseases differs from that between drugs. When the co-occurrence rate is extremely low, it indicates that there is almost no relationship between the drug and the disease. However, at medium to low frequencies, some kind of relationship usually exists, and this relationship appears sparse due to the scarcity of data. The stratification strategy aims to broaden the representativeness of this relationship.

[0142] To ensure the accuracy of the required relationships, heterogeneous correlation bucket B is constructed. m-d and B m-p During this period, in addition to establishing the top layer, a bottom layer was also introduced;

[0143] The lowest-level correlations represent extremely low co-occurrence rates between the drug and the disease / surgery, and will be removed in the following stratification stages:

[0144]

[0145] Where |D| and |P| represent the total number of diseases and surgeries in the dataset, respectively, and c m-d and c m-p This represents the co-occurrence count between the drug and the disease / surgery; θ is defined as an excessively low co-occurrence threshold, set at 0.03% of the total visits in this study, and |{c m-d <θ}| is the amount of data to be set at the underlying level;

[0146] S23 applies a layered approach similar to security-related methods, setting the top two layers q. m-d and q m-p The amount of data is calculated, and the amount of data for each layer is calculated in combination with the gradient coefficient k;

[0147]

[0148] Based on the two equations above, determine the number of layers n in the stratification. m-d and n m-p :

[0149]

[0150] After reorganizing the three sets of relations, a more evenly distributed and gently sloping hierarchical structure was achieved; correlations were assigned to the relations within these layers to maintain consistency with the subsequent graph network; the correlation of security relations within a given layer i was determined.

[0151]

[0152] in, and It represents the relevance of relationships within a given layer. The predefined maximum relevance representations for med-diag (drug-disease) and med-proc (drug-surgery) are ρ, respectively. m-d and ρ m-p .

[0153] S3. In the dual-attribute graph network representation stage, firstly, a complete drug graph is constructed to represent safety, and then a bipartite graph for drug-disease / surgery is constructed to represent accuracy.

[0154] To represent security, S31 first defines an undirected complete graph. Where M(t-1) is the set of all drugs visited, v(t-1), and a m-m It is a 0-1 adjacency matrix representing the edge set; each specific node m∈M(t) is associated with the corresponding drug embedding e. m Related; Establish a weight embedding vector in GCN-SW (safety weight graph convolutional network). Each one-dimensional embedding in this vector maps to a relation at a specific layer;

[0155] Use the correlation corresponding to the relationship as the initial weight w′ of the edge in the graph. m-m :

[0156]

[0157] Where i and j represent the indices of the two drugs, This indicates the relationship between two drugs. express The layer to which it belongs in the relationship bucket. This indicates the relevance generated for the relationship at this layer during the layering phase;

[0158] In addition, some drugs have a drug-durg interaction (DDI) and cannot be used together.

[0159] S32 also needs to consider this insecurity relationship when modeling drug combination diagrams, so it uses a Med-Med interaction diagram and combines it with a Med-Med safety diagram;

[0160] The final weight of the edges between drugs is:

[0161]

[0162] in, This refers to the interaction relationship mentioned in the previous section, where λ is a learnable parameter. It is the final weight of the edges between drugs;

[0163] A GCN-based graph network is used to deliver the drug graph, as shown below:

[0164]

[0165] in, Indicates from m i to m j The message vector being transmitted This represents the embedding representation of the drug obtained after training on access v(t-1). During training, the message passing function MESSAGE1(·) and the node update function UPDATE1(·) are used to update the representation of each entity. The function AGGREGATION1(·) is used to aggregate the drug nodes updated in this iteration to form a drug set representation reflecting safety.

[0166]

[0167] To ensure accuracy, S32 defines two binary fully connected Gs. m-d (t)={D(t),M(t-1),A m-d} and G m-p (t)={P(t),M(t-1),A m-p In a bipartite graph, different types of entities are interconnected; each edge is a directed edge that begins with a drug and ends with a disease / surgery, where D(t) / P(t) is the set of all drugs in visit v(t), and A m-d / A m-p Let D(t) / P(t) be a 0–1 adjacency matrix representing the edge set, where each node in D(t) / P(t) is associated with a corresponding disease / surgery embedding e. d / e p Related;

[0168] To enhance the symptomatic efficacy of medication and overcome the different embedding spaces of various entities, such as Figure 2 As shown, a graph network based on mapping features (GCN-MF) is applied to construct an embedding table. As attribute a m-d and a m-p Plot drug-disease / surgery features, with each row of the table independently mapping the type of correlation in the layer of the correlation bucket; similar to the Med-Med safety graph method, initialize and update the two bipartite graphs separately:

[0169]

[0170] Where i, j, and k represent indicators of drugs, diseases, and surgeries, ultimately yielding... and

[0171] Then pass the message and update the bipartite graph:

[0172]

[0173] in, This refers to the embedding of the i-th drug obtained from the (t)-th visit. This refers to the embedding of the j-th disease during the (t-1)th visit. This refers to the embedding of the k-th surgery during the (t-1)th access; This refers to the weight between the i-th drug and the j-th disease node. This refers to the weight between the i-th drug and the k-th surgical node;

[0174] After using the embedding space of drugs to describe diseases and surgeries, these are ultimately aggregated to formulate disease set representations and surgery set representations, thereby capturing the accuracy of recommendation results:

[0175]

[0176] During the message passing and update phases, a GCN graph network is used to process graph data. Traditional GCNs consider both their own and neighbor features, but to meet model requirements, the modified GCN-MF focuses only on neighbor information. This is because the model aims to express the relationship between med and diag / proc, and since node neighbors are heterogeneous, more attention needs to be paid to neighbors rather than merging node information. Therefore, GCN-MF uses only one layer of the graph network to avoid introducing unnecessary self-considerations from multiple layers. These adjustments help to effectively model and capture the characteristics of graph data.

[0177] S4. Aggregate the drug graph representing safety and the bipartite graph representing drug-disease / surgery accuracy into a dual-attribute representation in the graph network;

[0178] After processing by a graph neural network, drug disease / surgery accuracy and drug safety are integrated to obtain a comprehensive representation of the level of medical care.

[0179] The dual-attribute representation in a graph network is as follows:

[0180] e v (t)=CONCAT(e d (t),e p (t),e m (t-1))

[0181] S5. By integrating the access level representation obtained from pre-training in S1 and the dual-attribute representation in the graph network in S4, relevant drug combinations are recommended to adapt to long-term health conditions.

[0182] Taking v(t) as an example, the residual method is used in the representation of access levels;

[0183] S51 will represent the access level e′ obtained from pre-training. v (t) and the two-attribute representation e in the graph network v Adding (t) together, we get e″ v (t); Subsequently, based on the three information sources of disease, surgery, and medication, it is divided into three corresponding parts: e″ d (t), e″ p (t) and e″ m (t);

[0184] e″ v (t)=e v (t)+e′ v (t)

[0185] e″ d (t),e″ p (t),e″ m (t-1) = SEGMENT(e″) v (t))

[0186] To accommodate patients' long-term health status, three Recurrent Nueral Networks (RNNs) were used to model historical medical visits, generating three segmented representations at the patient level:

[0187]

[0188] Specifically, the gated recurrent unit (GRU) is used as the core structure of the recurrent neural network. GRU was chosen because it has stronger modeling capabilities than traditional RNNs and can better capture the temporal dependencies in time series data, while avoiding some potential problems in Long Short-Term Memory (LSTM) networks. GRU's relatively simpler structure and faster training speed make it more suitable for the task. The input to GRU is the embedding of three types of information (diag / proc / med, disease / surgery / medication) from the patient's complete medical history. The model's output is the final representation of this type of information from the current medical visit, which carries the model's understanding and summary of the patient's entire medical history.

[0189] S52 combines the results from the three RNNs and passes them to the MLP to obtain the final patient representation. h , representing the probability of each drug in the prescription; select drugs with a probability value greater than a predefined threshold to obtain the recommended drug combination;

[0190]

[0191] in, This represents a multi-hot vector of the predicted drug set, where the subscript i indicates the i-th entry in the vector. Indicates recommended medication m i , Indicates that medication is not recommended. i .

[0192] S6. Construct the loss function, including cross-entropy loss and DDI loss based on the predicted probability of the recommended drug and the true label;

[0193] The recommendation task is treated as a multi-label binary classification task; two loss functions are used, namely the binary cross-entropy loss L. bce and multi-label edge loss L multi The specific calculations are as follows:

[0194]

[0195] Where, m i This represents the actual value of drug i in the prescription. This represents the predicted value in the model. This indicates the probability that drug i and drug j will interact.

[0196] The loss function for drug interactions is:

[0197]

[0198] S7. Train the deep learning model by inputting the patient's disease information, surgical information, historical diagnosis information, historical surgical information, and historical drug representation into the trained deep learning model to obtain the predicted drug recommendation representation.

[0199] The data in the database is divided into training, validation, and test sets in a 4:1:1 ratio. During training, patient disease information, surgical information, drug information, and all learnable weights in the model are input into the deep learning model. Training is performed through forward propagation, loss calculation, and backpropagation to update the learnable parameters. After processing this information, the deep learning model generates drug recommendations, calculates the loss function, and updates each parameter through backpropagation to reduce the loss between the true and predicted values, making the model's predicted values ​​closer to the true values, thus achieving the learning objective. Then, the hyperparameters in the model are adjusted using the validation set, and the best performance of the hyperparameters is determined based on the performance of several sets of data on the model in the validation set. During testing, some data not encountered during training and validation are selected as input to the model to obtain the predicted drug recommendation representation.

[0200] In summary, this invention improves drug recommendation performance and reduces computational load by stratifying patient historical data, capturing sequence relationships, and forming accurate graph structures and safety graph structures for drugs, diseases, and surgeries.

Claims

1. A method for constructing a drug recommendation model based on a hierarchical algorithm to alleviate entity sparsity, characterized in that: Includes the following steps: S1. Construct a pre-training phase, establish a pre-training module, and use sequential recommendation technology to model the patient's disease and surgical history to obtain the patient's health representation; S2, Relevance Hierarchy: In the previous stage, entity-level representations were obtained from a single visit. S3. In the dual-attribute graph network representation stage, firstly, a complete drug graph is constructed to represent safety, and then a bipartite graph for drug-disease / surgery is constructed to represent accuracy. S4. Aggregate the drug graph representing safety and the bipartite graph representing drug-disease / surgery accuracy into a dual-attribute representation in the graph network; S5. By integrating the access level representation obtained from pre-training in S1 and the dual-attribute representation in the graph network in S4, relevant drug combinations are recommended to adapt to long-term health conditions. S6. Construct the loss function, including cross-entropy loss and DDI loss based on the predicted probability of the recommended drug and the true label; S7. Train the deep learning model by inputting the patient's disease information, surgical information, historical diagnosis information, historical surgical information, and historical drug representation into the trained deep learning model to obtain the predicted drug recommendation representation.

2. The method for constructing a drug recommendation model based on a hierarchical algorithm to alleviate entity sparsity according to claim 1, characterized in that: S1 specifically includes the following steps: S11 constructs a data sample and builds relationships between entities based on the data sample. The data sample includes the patient's historical dataset and drug-related data. The historical data includes the patient's disease code and surgical code. Pre-training involves doctors making medication recommendations during clinical visits by referring to the patient's medical history and considering the current disease and surgery. S12 encodes the current disease and surgery in the data sample into the patient's current health status; First, extract the disease set d(t) = {d} from the access v(t). i d j ...} and the surgery set p(t) = {p k p l Define two learnable embedding tables E, ...}; d ∈R |D|×dim and E p ∈R |p|×dim These correspond to disease and surgery, respectively, where dim is the embedding size; serving as a shared entity-level representation in the global data. It is by passing on the disease d i / surgery p k Generated by mapping to the embedding space; combined access to all disease / surgery embeddings in v(t) to obtain a disease / surgery set demonstration e d (t) and e p (t); Disease / Surgery Collection Demo e d (t) and e p (t) is: e d (t)=d(t)E d ,e p (t)=p(t)E p S13 encodes the medications used during the last medical visit in the data sample as the patient's historical health status. Because potential underlying conditions must be considered, medications from the last visit are included in v(t-1) to reflect the patient's historical health status; shared medication embeddings are shown in Table E. m ∈R |M|×dim The purpose is to encode the drug vector v(t-1) from the last visit; if the patient is visiting the hospital for the first time and has no prior medical history, their historical medication record is represented by a zero vector; The previous medical visit information is embedded as follows: e m (t-1)=m(t-1)E m S14 integrates the patient’s current health status and the patient’s historical health status into an access level table; Concatenate three vectors of equal length into a single vector three times the length of the original vector. This concatenated vector forms the access level table e′. v (t)∈R 1×3dim ; Access Level Table e′ v (t) is: e′ v (t)=CONCAT(e d (t),e p (t),e m (t-1)) Then, vector e′ v (t) The dimension of the dataset is transformed to |M|, which is the total number of drugs in the dataset, through a multilayer perceptron, and then the final prediction representation is obtained through the sigmoid activation function. The final prediction is: As a result of pre-training, the obtained entity-level representation e d e p e m This information is input into subsequent models; additionally, the access level representation e′ generated during training is also included. v It is used as the source of residual networks in the recommendation stage of model methods.

3. The method for constructing a drug recommendation model based on a hierarchical algorithm to alleviate entity sparsity according to claim 1, characterized in that: S2 specifically includes the following steps: S21 Designs a hierarchical approach to model drug relevance; Define a drug relationship bucket B m-m It captures all drug pairs in the global dataset and records the co-occurrence frequency of each drug combination. Where i is the specific layer index, n m-m Represents the total number of floors. |B represents the number of relations within a specific layer. m-m | represents the total number of relationships in the drug relationship bucket, and |M| is the total number of drugs in the global dataset; Using this co-occurrence data, the isomorphic independent probability distribution of drug correlations can be inferred; S22 adjusts the steep gradient within the drug correlation distribution to a relatively flat pyramid-shaped hierarchical structure. In this drug safety pyramid, the top layer contains the fewest but highly correlated relationships, while the base layer is characterized by a large number of weakly correlated relationships. Among them, the steep gradient on the drug co-occurrence probability distribution curve shows a rapid decay trend from high-frequency relationships to low-frequency relationships, that is, the frequency of the first few drug combinations is extremely high, while the frequency of a large number of subsequent combinations is very low, resulting in an extremely skewed distribution. Set the top-level data size to q m-m Together with the gradient coefficient i, it determines the data distribution within the bucket and the number of elements in any layer k, denoted as: Based on the two equations above, determine the number of layers n in the stratification. m-m : |M|×|M| To ensure the accuracy of the required relationships, heterogeneous correlation bucket B is constructed. m-d and B m-p During this period, in addition to establishing the top layer, a bottom layer was also introduced; The lowest-level correlations represent extremely low co-occurrence rates between the drug and the disease / surgery, and will be removed in the following stratification stages: Where |D| and |P| represent the total number of diseases and surgeries in the dataset, respectively, and c m-d and c m-p Represents the co-occurrence count between the drug and the disease / surgery; θ is defined as an excessively low co-occurrence threshold, set at 0.03% of the total visits, and |{c m-d <θ}| is the amount of data to be set at the underlying level; S23 applies a layered approach similar to security-related methods, setting the top two layers q. m-d and q m-p The amount of data is calculated, and the amount of data for each layer is calculated in combination with the gradient coefficient k; Based on the two equations above, determine the number of layers n in the stratification. m-d and n m-p : After reorganizing the three sets of relations, a more evenly distributed and gently sloping hierarchical structure was achieved; correlations were assigned to the relations within these layers to maintain consistency with the subsequent graph network; the correlation of security relations within a given layer i was determined. in, and The correlation of relationships within a given layer is given by ρ, where the predefined maximum correlations for drug-disease and drug-surgery are denoted as ρ. m-d and ρ m-p .

4. The method for constructing a drug recommendation model based on a hierarchical algorithm to alleviate entity sparsity according to claim 1, characterized in that: S3 specifically includes the following steps: To represent security, S31 first defines an undirected complete graph. Where M(t-1) is the set of all drugs visited, v(t-1), and a m-m It is a 0-1 adjacency matrix representing the edge set; each specific node m∈M(t) is associated with the corresponding drug embedding e. m Related; establish a weighted embedding vector in GCN-SW Each one-dimensional embedding in this vector maps to a relation at a specific layer; Use the correlation corresponding to the relationship as the initial weight w′ of the edge in the graph. m-m : Where i and j represent the indices of the two drugs, This indicates the relationship between two drugs. express The layer to which it belongs in the relationship bucket. This indicates the relevance generated for the relationship at this layer during the layering phase; In addition, some drugs have drug interactions and cannot be used together; S32 also needs to consider this insecurity relationship when modeling drug combination diagrams, so it uses a drug-drug interaction diagram and combines it with a drug-drug safety diagram; The final weight of the edges between drugs is: in, This refers to the interaction relationship mentioned in the previous section, where λ is a learnable parameter. It is the final weight of the edges between drugs; A GCN-based graph network is used to deliver the drug graph, as shown below: in, Indicates from m i to m j The message vector being transmitted This represents the embedding representation of the drug obtained after training on access v(t-1). During training, the message passing function MESSAGE1(·) and the node update function UPDATE1(·) are used to update the representation of each entity. The function AGGREGATION1(·) is used to aggregate the drug nodes updated in this iteration to form a drug set representation reflecting safety. To ensure accuracy, S32 defines two binary fully connected Gs. m-d (t)={D(t),M(t-1),A m-d } and G m-p (t)={P(t),M(t-1),A m-p In a bipartite graph, different types of entities are interconnected; each edge is a directed edge that begins with a drug and ends with a disease / surgery, where D(t) / P(t) is the set of all drugs in visit v(t), and A m-d / A m-p Let D(t) / P(t) be a 0–1 adjacency matrix representing the edge set, where each node in D(t) / P(t) is associated with a corresponding disease / surgery embedding e. d / e p Related; To enhance the symptomatic efficacy of medication and overcome the different embedding spaces of various entities, a graph network based on mapping features is applied; an embedding table is constructed. As attribute a m-d and a m-p Plot drug-disease / surgery features, with each row of the table independently mapping the type of correlation in the layer of the correlation bucket; initialize and update the two bipartite graphs respectively. Where i, j, and k represent indicators of drugs, diseases, and surgeries, ultimately yielding... and Then pass the message and update the bipartite graph: in, This refers to the embedding of the i-th drug obtained from the (t)-th visit. This refers to the embedding of the j-th disease during the (t-1)th visit. This refers to the embedding of the k-th surgery during the (t-1)th access; This refers to the weight between the i-th drug and the j-th disease node. This refers to the weight between the i-th drug and the k-th surgical node; After using the embedding space of drugs to describe diseases and surgeries, these are ultimately aggregated to formulate disease set representations and surgery set representations, thereby capturing the accuracy of recommendation results: During the message passing and update phases, the GCN graph network is used to process graph data.

5. The method for constructing a drug recommendation model based on a hierarchical algorithm to alleviate entity sparsity according to claim 1, characterized in that: In S4, after processing by a graph neural network, drug disease / surgery accuracy and drug safety are integrated to obtain a comprehensive representation of the level of care. The dual-attribute representation in a graph network is as follows: e v (t)=CONCAT(e d (t),e p (t),e m (t-1))。 6. The method for constructing a drug recommendation model based on a hierarchical algorithm to alleviate entity sparsity according to claim 1, characterized in that: S5 specifically includes the following steps: S51 will represent the access level e′ obtained from pre-training. v (t) and the two-attribute representation e in the graph network v Adding (t) together, we get e″ v (t); Subsequently, based on the three information sources of disease, surgery, and medication, it is divided into three corresponding parts: e″ d (t), e″ p (t) and e″ m (t); e″ v (t)=e v (t)+e′ v (t) e″ d (t),e″ p (t),e″ m (t-1)=SEGMENT(e″ v (t)) To accommodate patients' long-term health status, three RNNs were used to model historical medical visits, generating three segmented representations at the patient level: A gated recurrent unit is used as the core structure of the recurrent neural network; S52 combines the results from the three RNNs and passes them to a multilayer perceptron to obtain the final patient representation. h , representing the probability of each drug in the prescription; select drugs with a probability value greater than a predefined threshold to obtain the recommended drug combination; in, This represents a multi-hot vector of the predicted drug set, where the subscript i indicates the i-th entry in the vector. Indicates recommended medication m i , Indicates that medication is not recommended. i .

7. The method for constructing a drug recommendation model based on a hierarchical algorithm to alleviate entity sparsity according to claim 1, characterized in that: In S6, recommendation tasks are treated as multi-label binary classification tasks; Using two loss functions, the binary cross-entropy loss L bce and multi-label edge loss Where, m i This represents the actual value of drug i in the prescription. This represents the predicted value in the model. This indicates the probability that drug i and drug j will interact. The loss function for drug interactions is:

8. The method for constructing a drug recommendation model based on a hierarchical algorithm to alleviate entity sparsity according to claim 1, characterized in that: In S7, the data in the database is divided into training, validation, and test sets in a 4:1:1 ratio. During training, patient disease information, surgical information, drug information, and all learnable weights in the model are input into the deep learning model. Training is performed through forward propagation, loss calculation, and backpropagation to update the learnable parameters. After processing this information, the deep learning model generates drug recommendations, calculates the loss function, and updates each parameter through backpropagation to reduce the loss between the true and predicted values. The hyperparameters in the model are then adjusted using the validation set, and the best hyperparameters are determined based on the performance of several sets of data on the model. During testing, some data that did not appear during training and validation are used as input to the model to obtain the predicted drug recommendation representation.

Citation Information

Patent Citations

  • Construction method and application of implicit relation drug recommendation model based on graph neural network

    CN115240811A

  • Drug recommendation method based on attention mechanism and global retrieval

    CN116153528A

Cited By

  • Drug recommendation model construction method, drug recommendation method, device and equipment

    CN121075538A