Drug recommendation method based on beta variational auto-encoder
By combining the GRU network, two-way attention mechanism and β-variable autoencoder drug recommendation method, the problem of ignoring individualized differences in patients in the prior art is solved, and more accurate drug combination prediction and new patient condition treatment are achieved, and adverse drug interactions are reduced.
Patent Information
- Application Number
- CN202510528308.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-08-01
AI Technical Summary
Existing drug recommendation methods ignore individualized differences in patients, resulting in inappropriate combinations of recommended drugs, ineffective treatment of new patients and rare conditions, and failure to fully consider the complex associations and three-dimensional structural information between drugs.
The GRU network and bidirectional attention mechanism were used to extract the medical record characteristics, and a heterogeneous network was constructed based on drug SMILES. The drug characteristics were extracted using graph convolution and graph attention networks, and the heterogeneous hypergraph was constructed, and the β-variant autoencoder was encoded to optimize drug combination prediction.
It improves the accuracy and stability of drug recommendations, can better deal with new patients and rare conditions, retain drug combination information and individual patient differences, and reduce adverse drug interactions.
Smart Images

Figure CN120412892A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of digital medical technologies, and particularly to a drug recommendation method based on a β variational autoencoder. Background Art
[0002] At present, with the rapid growth of the population and the aggravation of population aging, the demand for high-quality medical services has been continuously rising, which has led to an increasing pressure on medical workers. Moreover, various public health emergencies have also posed huge challenges to medical workers. Such a situation has made people pay more attention to the field of healthcare. As an important task in the field of healthcare, drug recommendation has also attracted a large amount of research. The goal of drug recommendation is to provide a safe drug combination that can treat the diseases diagnosed in patients. At present, drug recommendation is mainly carried out by professional doctors, and professional doctors will recommend drug prescriptions for patients based on their professional knowledge and personal experience. However, since patients may have complex health conditions (for example, a patient is diagnosed with multiple diseases simultaneously), doctors need to screen suitable drugs for each disease and avoid possible harmful drug-drug interactions (ADDI) between the selected drugs. Therefore, when recommending drugs for patients with complex health conditions, doctors may, due to momentary negligence, prescribe drug prescriptions with ADDI for patients, causing harm to the patients' health and even endangering the patients' lives in severe cases.
[0003] To alleviate this problem, a drug recommendation method that uses computer-aided drug recommendation to assist doctors in making drug prescription decisions has emerged. Existing drug recommendation methods can be divided into case-based recommendation methods and longitudinal recommendation methods. Case-based drug recommendation methods only recommend drugs to patients based on the current patient's diagnosis, without considering the longitudinal patient medical history. Such methods have achieved poor performance because they do not consider the development process of the patient's condition. To solve this problem, longitudinal recommendation methods have been proposed. Longitudinal recommendation methods recommend drugs by combining the medical history information of the electronic medical records of the visiting patients, so that the characteristics of the patient's condition changes can be obtained through the patient's historical visit records. However, most of these methods do not consider the safety of the drugs used in the modeling, especially ignoring ADDI, which is more difficult to prevent than the adverse reactions of single drugs. Therefore, relevant researchers have begun to consider the issue of drug safety, and such methods can be divided into two categories: minimizing the drug ADDI rate and dynamically adjusting the drug ADDI rate. The method of minimizing the drug ADDI rate is to screen out the drug combinations that cause ADDI in the recommended drug combinations by introducing additional ADDI knowledge. However, such methods are likely to eliminate the drugs that play a key role in treating the patient's disease. To solve this problem, a method of dynamically adjusting the drug ADDI rate has been proposed. This method directly applies ADDI to the loss function or uses the ADDI gating mechanism to flexibly adjust the ADDI rate of the recommended drug combinations. The general steps of the existing drug recommendation methods are as follows: ① Extract the time-dependent information in the patient's diagnosis record and surgical record to obtain the patient's diagnosis characteristics and surgical characteristics, and splice them to obtain the patient representation; ② Based on the combined drug use information included in the electronic medical record and the additional ADDI knowledge introduced, extract the drug characteristics to obtain safe combined drug use information; ③ Calculate the similarity between the patient representation corresponding to the current visiting patient and the safe combined drug use information, and the similarity between the patient representation corresponding to the historical visiting patient, respectively, and assign recommendation weights to various drugs; ④ Set the recommendation drug weight threshold to obtain the final recommended drug combination.
[0004] Existing methods generally use methods such as Recurrent Neural Network (RNN) or Gated Recurrent Unit (GRU) that can capture temporal dependence information in sequences to extract patient representations. The patient representation mainly consists of two parts: the patient's diagnosis record and surgical record. Extracting the features of the diagnosis record alone may not fully reflect the impact of the surgery the patient underwent on the patient's condition. For example, the surgery the patient underwent may cause changes in the patient's condition, which in turn affects subsequent diagnoses. Extracting the features of the surgical record alone may not fully reflect the pre-surgical diagnosis and treatment situation. For example, the postoperative recovery situation in the surgical record may need to be evaluated in the context of the pre-operative diagnosis. This means there is a close connection between the patient's diagnosis record and surgical record. However, existing methods generally use two separate RNNs to extract features from the patient's diagnosis record and surgical record respectively, unable to capture the correlation between the diagnosis record and surgical record, resulting in information isolation and affecting the accuracy and generalization of the model.
[0005] When existing methods extract drug features, they generally use graph neural networks to extract the structural features of drugs from the two-dimensional molecular graphs of drugs. Such methods regard the atoms in the drug molecule as nodes and covalent bonds as edges to construct graph-structured data, and use the edges as a medium to transfer features between nodes. However, information such as the length and bond angle of covalent bonds is crucial for the three-dimensional structure and activity of drugs, and the stereochemical information of covalent bonds (such as chiral centers, stereoisomers) also makes great contributions to the biological activity and selectivity of drugs. Existing methods directly convert covalent bonds into weighted edges (assign a weight in the range of (0,1] if there is a covalent bond connection) during modeling. This approach results in the feature information of covalent bonds being greatly compressed, making the model significantly insufficient in capturing the structural complexity and functional diversity of drug molecules.
[0006] In addition, when existing methods recommend the required drug combinations for the current patient based on the patient's current health status, they generally calculate the similarity between the representations of the current patient and historical patients to assign drug weights to the current patient. This approach mainly obtains drug prescriptions by modeling the similarity between patients. However, when a new patient with a special condition appears, since there have been no patients with similar conditions before, the model is unable to effectively recommend appropriate drug combinations for the new patient. Moreover, the approach of modeling patient similarity will result in the drug combinations recommended by the model for patients having strong commonalities, ignoring the individual differences of each patient. Summary of the Invention
[0007] Based on the problems raised by the above background technology, the purpose of the present invention is to provide a drug recommendation method based on β variational autoencoder, which solves the problem that the individual differences of patients are ignored when recommending drugs using neural network models, resulting in inappropriate recommended drug combinations.
[0008] The present invention is achieved through the following technical solutions:
[0009] The first aspect of the present invention provides a drug recommendation method based on a β variational autoencoder, comprising the following steps:
[0010] Obtain the patient's medical record data, use the GRU network combined with the bidirectional attention mechanism to extract the representation of the medical record, and obtain the patient representation;
[0011] Constructing a drug heterogeneous network based on drug SMILES, extracting a drug structural feature vector from the drug heterogeneous network, and fusing the structural feature vector with the drug sequence feature vector to generate a drug feature vector;
[0012] Considering patients and drugs as nodes, and the patient's medication records as hyperedges, and constructing a heterogeneous hypergraph using the patient representation and the drug feature vector;
[0013] The heterogeneous hypergraph is encoded based on a β variational autoencoder, and drug node embedding and hyperedge embedding obtained by encoding are used to predict drug combinations for patients. Loss calculation is performed on the results of the drug combination prediction, and model optimization is performed based on the results of the loss calculation.
[0014] In the above technical solution, the GRU network is first combined with the bidirectional attention mechanism to extract and fuse the diagnostic information and surgical information in the medical record data, so as to explore the potential correlation between the diagnostic information and the surgical information, thereby forming a patient representation used to reflect the patient's condition.
[0015] Secondly, in the drug SMILES (Simplified Molecular-Input Line Entry System), the connection relationships of atoms and covalent bonds are represented by specific characters, which can clearly describe the structure of the molecule. Therefore, based on drug SMILES, this method also models the covalent bonds in the drug molecule as nodes to construct a drug heterogeneous network, and fully retains various characteristic information of the covalent bonds when extracting the drug structure features. The structure feature vectors of drugs are obtained from the drug heterogeneous network by combining a graph convolutional network and a graph attention network. In this method, the structure feature vectors of drugs include the three-dimensional structure features and bond function features of the drug molecule. At the same time, a convolutional network is used to extract the sequence features of the drug, and the structure features and sequence features of the drug are fused to generate drug feature vectors for reflecting the drug characteristics.
[0016] Then, based on the historical medication records of the visiting patients, the patients and drugs are regarded as nodes, and the medication records of the patients are regarded as hyperedges. On this basis, a heterogeneous hypergraph is constructed by combining the patient representations for reflecting the patient's condition and the drug feature vectors for reflecting the drug characteristics, maximizing the retention of drug combination information, patient individual differences, and the complex association relationships between patients and drugs, so that the model can better utilize the global network structure to discover potential drug combination patterns when dealing with new patients and rare diseases.
[0017] Finally, the heterogeneous hypergraph is encoded based on the β variational autoencoder, and the drug combination prediction for the patient is obtained by using the drug node embeddings and hyperedge embeddings obtained from the encoding. The result of the drug combination prediction is calculated for loss, and the recommended drug optimization model is determined according to the result of the loss calculation.
[0018] In an alternative embodiment, a GRU network combined with a bidirectional attention mechanism is used to extract the representation of the visit record, including the following steps:
[0019] Perform word embedding operations on the diagnosis record and surgical record in the visit record to obtain a diagnosis embedding vector and a surgical embedding vector;
[0020] Use a GRU network to extract temporal features from the diagnosis embedding vector and the surgical embedding vector to obtain diagnosis temporal features and surgical temporal features;
[0021] Use a bidirectional attention mechanism to enhance the attention of the diagnosis temporal features and the surgical temporal features to obtain diagnosis attention-enhanced features and surgical attention-enhanced features;
[0022] Calculate the interaction feature vector between the diagnostic attention enhancement feature and the surgical attention enhancement feature, and perform feature fusion on the diagnostic attention enhancement feature and the surgical attention enhancement feature through the interaction feature vector to obtain the patient representation.
[0023] In an alternative embodiment, constructing a drug heterogeneous network based on drug SMILES includes the following steps:
[0024] Extract the atomic features in the drug molecule, and splice the atomic features to generate an atomic node feature vector;
[0025] Extract the covalent bond features in the drug molecule, and splice the covalent bond features to generate a covalent bond node feature vector;
[0026] Construct an atomic similarity matrix and a covalent bond similarity matrix based on the atomic node feature vector and the covalent bond node feature vector;
[0027] Construct an association matrix using the connection relationship between atoms and covalent bonds, and comprehensively construct a drug heterogeneous network based on the atomic similarity matrix, the covalent bond similarity matrix, and the association matrix.
[0028] In an alternative embodiment, extracting the structural feature vector of a drug from the drug heterogeneous network includes the following steps:
[0029] Use a graph convolutional network to perform initial embedding on the atomic features and the covalent bond features respectively to obtain an atomic initial embedding feature matrix and a covalent bond initial embedding feature matrix;
[0030] Use a graph attention network to calculate the atomic attention coefficient and the covalent bond attention coefficient for the atomic initial embedding feature matrix and the covalent bond initial embedding feature matrix respectively;
[0031] Use the atomic attention coefficient and the covalent bond attention coefficient to perform feature fusion on the atomic initial embedding feature matrix and the covalent bond initial embedding feature matrix respectively to obtain an atomic fusion feature vector and a covalent bond fusion feature vector.
[0032] In an alternative embodiment, the extraction process of the sequence feature vector of the drug includes the following steps: [[ID=3!]]
[0033] Obtain the SMILES sequence of the drug, and use a multi-layer perceptron as an embedding layer to perform embedding processing on the SMILES sequence to obtain a SMILES embedding vector sequence;
[0034] Slide a convolutional kernel over the SMILES embedding vector sequence to extract local features, and integrate the local features to generate a sequence feature vector.
[0035] The sequence feature vector is sequentially subjected to dimensionality reduction and flattening processing, and the sequence feature vector after dimensionality reduction and flattening processing is fed into a fully connected layer to generate a sequence feature vector of the drug.
[0036] In an optional embodiment, fusing the structural feature vector with the drug's sequence feature vector includes: fusing the structural feature vector with the drug's sequence feature vector using a multi-layer perceptron, and the fusion process is as follows:
[0037]
[0038] Among them, x i is the drug feature vector of the i-th drug, MLP(·) represents the MLP processing layer; Represents the i-th atom fusion feature vector in the current drug molecule; Represents the i-th covalent bond fusion feature vector in the current drug molecule; x s The sequence feature vector of the current drug molecule; || represents the splicing operation.
[0039] In an optional embodiment, the heterogeneous hypergraph includes: a patient node and a drug node, each of the patient node and the drug node is provided with a sub-association matrix, and the sub-association matrix is used to represent the similarity relationship between nodes of the same type; the sub-association matrix is set as follows:
[0040]
[0041] in, Child association matrix representing the patient node The value of the element in row i and column j; h i represents the feature vector of the i-th patient; Represents the sub-association matrix of the drug node The value of the element in row i and column j, x j represents the characteristic vector of the j-th drug; cos(·) represents the cosine function; · represents the vector dot product operation; * represents the multiplication operation; || || represents the Euclidean norm of the vector.
[0042] In an optional embodiment, encoding the heterogeneous hypergraph based on a β variational autoencoder includes: encoding the nodes of the heterogeneous hypergraph and encoding the hyperedges of the heterogeneous hypergraph;
[0043] The step of encoding the nodes of the heterogeneous hypergraph includes:
[0044] Performing nonlinear mapping on the nodes of the heterogeneous hypergraph to obtain a projected node embedding vector;
[0045] Estimate the projected node embedding vectors using a fully connected layer to obtain the node variational posterior distribution;
[0046] Sample from the node variational posterior distribution to obtain the final node embedding vectors;
[0047] Among them, encoding the hyperedges of the heterogeneous hypergraph includes:
[0048] Perform a non-linear mapping on the hyperedges of the heterogeneous hypergraph to obtain projected embedding vectors;
[0049] Use a hyperedge attention module to perform differential learning on the projected embedding vectors to generate transformed embedding vectors;
[0050] Use type preference vectors to perform attention calculations on the transformed embedding vectors to obtain attention weights;
[0051] Fuse the attention weights with the projected embedding vectors to obtain fused hyperedge embedding vectors;
[0052] Estimate the fused hyperedge embedding vectors using a fully connected layer to obtain the hyperedge variational posterior distribution;
[0053] Sample from the hyperedge variational posterior distribution to obtain the final hyperedge embedding vectors.
[0054] In an alternative embodiment, using the drug node embeddings and hyperedge embeddings obtained by encoding for drug combination prediction for patients includes:
[0055]
[0056] Among them, f score (·) is the association score between the drug node and the hyperedge node, Sim(·) is the Euclidean distance similarity metric function, is the i-th drug node embedding, is the hyperedge embedding corresponding to the j-th patient node;
[0057] Set the drugs with the association scores greater than the association score threshold as new drugs, and integrate the new drugs to generate a drug recommendation sequence.
[0058] In an alternative embodiment, calculating the loss for the result of drug combination prediction includes the following steps:
[0059] Construct a binary cross-entropy loss function, and use the binary cross-entropy loss function to calculate the loss for the drug recommendation sequence to obtain a label loss value;
[0060] Construct a reconstruction loss function, and use the reconstruction loss function to calculate the reconstruction loss for the heterogeneous hypergraph to obtain a reconstruction loss value;
[0061] Construct a DDI matrix based on the adverse drug interactions between drugs, and use the DDI matrix to calculate the adverse drug interaction loss of the drug recommendation sequence to obtain a DDI loss value;
[0062] Integrate the label loss value, the reconstruction loss value, and the DDI loss value to obtain a drug prediction loss value.
[0063] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0064] 1. Combine the GRU network with the bidirectional attention mechanism to extract and fuse the diagnostic information and surgical information in the medical record data, so as to explore the potential correlation between the diagnostic information and the surgical information;
[0065] 2. Based on the medication records of historical patients, regard patients and drugs as nodes and the medication records of patients as hyperedges, so as to construct a heterogeneous hypergraph, and retain the drug combination information, patient individual differences, and the complex correlation between patients and drugs to the greatest extent, so that the model can better use the global network structure to discover potential drug combination patterns when dealing with new patients and rare diseases;
[0066] 3. Adopt the β - variational auto - encoder architecture to obtain the latent features of patients and drugs, and predict the drug combinations required by patients according to the embedding features of patients and drugs, improving the stability of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the following will briefly introduce the drawings required in the embodiments. It should be understood that the following drawings only show some embodiments of the present invention, so they should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts. In the drawings:
[0068] Figure 1 It is a schematic flowchart of a drug recommendation method based on a β - variational auto - encoder provided in Embodiment 1 of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0069] To make the purpose, technical solutions, and advantages of the present invention clearer, the following will further describe the present invention in detail with reference to the embodiments and the drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and do not limit the present invention.
[0070] Embodiment 1
[0071] Figure 1A flowchart of a drug recommendation method based on a β variational autoencoder provided in Example 1 of the present invention is shown as follows: Figure 1 As shown in Figure 1, a drug recommendation method based on β variational autoencoder includes the following steps:
[0072] Obtain the patient's medical record data, use the GRU network combined with the bidirectional attention mechanism to extract the representation of the medical record, and obtain the patient representation;
[0073] Constructing a drug heterogeneous network based on drug SMILES, extracting a drug structural feature vector from the drug heterogeneous network, and fusing the structural feature vector with the drug sequence feature vector to generate a drug feature vector;
[0074] Considering patients and drugs as nodes, and the patient's medication records as hyperedges, and constructing a heterogeneous hypergraph using the patient representation and the drug feature vector;
[0075] The heterogeneous hypergraph is encoded based on a β variational autoencoder, and drug node embedding and hyperedge embedding obtained by encoding are used to predict drug combinations for patients. Loss calculation is performed on the results of the drug combination prediction, and model optimization is performed based on the results of the loss calculation.
[0076] It should be noted that the current use of neural network models for drug recommendations ignores individual differences among patients, resulting in inappropriate recommended drug combinations. The drug recommendation method proposed in this embodiment addresses this problem. In this method, the diagnostic information and surgical information in the medical record data are first extracted and enhanced by combining a GRU network with a bidirectional attention mechanism. This method explores the potential correlation between the diagnostic information and the surgical information, thereby forming a patient representation that reflects the patient's condition. The patient representation is a feature vector.
[0077] Secondly, in the drug SMILES (Simplified Molecular-Input Line Entry System), the connections between atoms and covalent bonds are represented by specific characters that clearly describe the molecular structure. Therefore, based on the drug SMILES, this method also models the covalent bonds in drug molecules as nodes to construct a drug heterogeneous network. This method also fully retains the characteristic information of covalent bonds when extracting drug structural features. A graph convolutional network combined with a graph attention network is used to extract the structural feature vector of the drug from the drug heterogeneous network. In this method, the structural feature vector of the drug includes the three-dimensional structural features and bond functional characteristics of the drug molecule. Simultaneously, a convolutional network is used to extract the drug's sequence features, and the structural and sequence features of the drug are fused to generate a drug feature vector that reflects the drug's characteristics.
[0078] Then, based on the historical medication records of the patients seeking medical treatment, the patients and drugs are regarded as nodes, and the medication records of the patients are regarded as hyperedges. On this basis, a heterogeneous hypergraph is constructed by combining the patient representations reflecting the patients' conditions and the drug feature vectors reflecting the drug characteristics, so as to retain the drug combination information, patient individual differences, and the complex correlation relationships between patients and drugs to the greatest extent, enabling the model to better utilize the global network structure to discover potential drug combination patterns when dealing with new patients and rare conditions.
[0079] Finally, the heterogeneous hypergraph is encoded based on the β-variational autoencoder, and the potential features of the patients and drugs are obtained by using the encoded drug node embeddings and hyperedge embeddings. Then, the drug combinations required by the patients are predicted according to the embedded features of the patients and the embedded features of the drugs by using the encoded heterogeneous hypergraph, and the results of the drug combination prediction are obtained. And the loss of the results of the drug combination prediction is calculated, and the recommended drugs are determined according to the results of the loss calculation to optimize the model.
[0080] In an alternative embodiment, the process of using the GRU network combined with the bidirectional attention mechanism to extract the representation of the medical records is as follows:
[0081] Step 1: Perform word embedding operations on the diagnostic records and surgical records of the patients.
[0082] Among them, the electronic health record data of the patients records the comprehensive medical history information of the patients (such as diagnosis, surgery, and medication) in the form of vectors of medical codes. For the i-th patient, his / her historical medical records can be expressed as where t represents the number of historical medical visits of the current patient. The patient record generated by the patient at the t-th medical visit can be expressed as where, and represent the diagnostic record, surgical record, and medication record of the i-th patient at the t-th medical visit respectively, and they are all multi-hot vectors encoded in binary.
[0083] And the goal of obtaining drug recommendations in this embodiment is to predict the drug combination required by the patient according to the patient's diagnostic record and surgical record to predict the drug combination required by the patient
[0084] The process of performing word embedding operations on the diagnostic record and surgical record in the medical record to obtain the diagnostic embedding vector and the surgical embedding vector is as follows:
[0085]
[0086] where, W d and W pThe linear embedding matrices representing the diagnostic record and the surgical record respectively, which are randomly initialized and continuously updated through model learning. After the word embedding process, the patient record can be represented as
[0087] Step 2: Extract patient representations.
[0088] To extract the time-dependent information implicit in the patient's diagnostic record and surgical record, the present invention considers using two GRU networks combined with a bidirectional attention mechanism to extract features from the word-embedded diagnostic record and surgical record respectively.
[0089] First, use GRU networks to extract temporal features from the patient's diagnostic record and surgical record respectively, and the process is as follows:
[0090]
[0091] Among them, GRU d (·) and GRU p (·) respectively represent the GRUs used to extract temporal features from the patient's diagnostic embedding vector and surgical embedding vector.
[0092] Secondly, since there is a close association between the patient's diagnosis and surgery during the same visit, this embodiment uses a bidirectional attention mechanism to enhance the attention of the diagnostic temporal features and surgical temporal features.
[0093] The process of attention enhancement is as follows:
[0094] Use non-linear transformation activation functions to perform non-linear transformations on the diagnostic temporal features and surgical temporal features to capture the unique information of different sequences. Specifically:
[0095]
[0096] Among them, α d and α p are the attention scores for the diagnostic record and the surgical record respectively; tanh(·) and tanhshrink(·) are two different non-linear transformation activation functions; W α and b α are the attention weight matrix and the bias term respectively.
[0097] To ensure the non-negativity and normalization of the attention weights, after normalization using the Softmax function, attention enhancement is performed on the diagnostic temporal features and surgical temporal features. Specifically:
[0098]
[0099] Among them, softmax(·) represents the Softmax function; and represent the diagnostic attention-enhanced feature and the surgical attention-enhanced feature after bidirectional attention enhancement; γ is a weighting parameter.
[0100] Use a dense layer to calculate the interaction feature vector between the diagnostic attention-enhanced feature and the surgical attention-enhanced feature. Specifically:
[0101]
[0102] Among them, μ represents the interaction feature vector, tanh(·) represents the Tanh non-linear transformation activation function; ReLU(·) represents the ReLU non-linear activation function; Concat(·) represents the concatenation function; W1 and W2 are weight matrices; b1 and b2 are bias terms.
[0103] Perform feature fusion on the diagnostic attention-enhanced feature and the surgical attention-enhanced feature through the interaction feature vector. Specifically,
[0104]
[0105] Among them, W d,f and W p,f are fusion weight matrices; b d,f and b p,f are fusion bias terms; is the patient representation of the i-th patient at the t-th visit.
[0106] It should be noted that in this embodiment, for the sake of simplifying the symbols, h i is used to replace (that is, the visit times are not specifically distinguished, and only the patient representation itself is concerned).
[0107] In an alternative embodiment, a drug heterogeneous network is constructed based on the drug SMILES, a structural feature vector of the drug is extracted from the drug heterogeneous network, and the structural feature vector is fused with the sequence feature vector of the drug to generate a drug feature vector, including:
[0108] Step 3: Construct a drug heterogeneous network based on the drug SMILES.
[0109] Traditional graph neural networks generally use edges as the medium (the weight is 1 if the edge exists and 0 if the edge does not exist) to transfer the feature information of nodes in the graph. However, this approach cannot effectively utilize the features of edges (such as the type, length, bond angle, etc. of covalent bonds), resulting in the model mainly focusing on the features of nodes during the learning process, while the features of edges are implicitly represented during the transfer process.
[0110] To solve this problem, the present invention converts edges into covalent bond nodes, uses the connection relationship between atoms and covalent bonds as edges, and constructs a heterogeneous network between covalent bond nodes and atomic nodes accordingly. In this embodiment, based on the SMILES of a drug molecule, the RDKit tool is used to generate a two-dimensional undirected graph G=(V, E) corresponding to the drug molecule, where V is the set of nodes, representing the atoms that make up the drug, and E is the set of edges, representing the covalent bonds connecting the atoms.
[0111] First, for the initial features of atomic nodes, the RDKit is used to extract the atomic features in the drug molecule. In this embodiment, the atomic features include: atomic symbol (dimension 118, using one-hot encoding), atomic degree (dimension 10, using one-hot encoding), implicit valence electrons (dimension 7, using one-hot encoding), formal charge (dimension 1, using numerical encoding), number of radical electrons (dimension 1, using numerical encoding), hybridization state (dimension 5, using one-hot encoding), and aromaticity (dimension 1, using numerical encoding). The above seven atomic features are concatenated to generate the i-th atomic node feature vector with a dimension of 143.
[0112] Secondly, for the covalent bonds between atoms, the RDKit is used to extract the covalent bond features in the drug molecule. In this embodiment, the covalent bond features include: bond number (dimension 1, using numerical encoding), bond type (dimension 4, using one-hot encoding), bond length (dimension 1, using numerical encoding), bond angle (dimension 2, using numerical encoding), stereochemical property of the bond (dimension 6, using one-hot encoding), and ring information (whether the covalent bond participates in forming a ring, dimension 1, using numerical encoding). Among them, the bond angle involves two covalent bonds, so it needs to mark the number of the other covalent bond participating in the angle formation and the angle information, so its dimension is 2. The above six covalent bond features are concatenated to generate the j-th covalent bond node feature vector with a dimension of 14.
[0113] Through the above process, a set of atomic node feature vectors is formed. And a set of covalent bond node feature vectors. Calculate the set of atomic node feature vectors and the set of covalent bond node feature vectors, and calculate the cosine similarity between different atoms and different covalent bonds in the same drug molecule respectively, so as to construct an atomic similarity matrix S atom And a covalent bond similarity matrix S bond , which is constructed as follows:
[0114]
[0115] Among them, |V| and |E| represent the number of atoms and covalent bonds in the drug molecule respectively; (S atom ) ij represents the element value at the i-th row and j-th column of the similarity matrix S atom ; cos(·) represents the cosine function; · represents the vector dot product operation; * represents the multiplication operation; || || represents the Euclidean norm of the vector.
[0116] Construct an association matrix A ∈ R |V|×|E| using the connection relationship between atoms and covalent bonds. If there is a connection relationship between the i-th atom and the j-th covalent bond, then A ij = 1; otherwise, A ij = 0.
[0117] Construct a drug isomer network R formed by atoms and covalent bonds by integrating the atomic similarity matrix, covalent bond similarity matrix, and association matrix. The specific construction is as follows:
[0118]
[0119] Step 4: Extract atomic fusion features and covalent bond fusion features.
[0120] To fully extract the characteristic information of different atoms and covalent bonds in the drug isomer network R, in this embodiment, a combination of a graph convolutional network (Graph Convolutional Network, GCN) and a graph attention network (Graph Attention Network, GAT) is used for feature extraction and fusion.
[0121] First, use the graph convolutional network to perform initial embedding on the atomic features and covalent bond features respectively. Its hierarchical propagation formula is as follows:
[0122]
[0123] Among them, represents the input of the (l + 1)-th layer of the GCN network for extracting atomic features, represents the output of the (l + 1)-th layer; represents the input of the (l + 1)-th layer of the GCN network for extracting covalent bond features, represents the output of the (l + 1)-th layer; σ(·) is a non-linear activation function; D is the degree matrix of R; and are trainable weight matrices.
[0124] After being processed by two graph convolutional networks, the atomic initial embedding feature matrix and the covalent bond initial embedding feature matrix are obtained respectively. Among them, Xatom is the initial embedding feature matrix of atoms, and the vector corresponds to the feature vector of the i-th atom after embedding; X bond is the initial embedding feature matrix of covalent bonds, and the vector corresponds to the feature vector of the j-th covalent bond after embedding; |V| and |E| are the total number of atoms and covalent bonds in the drug molecule, respectively; P is the dimension of the atomic embedding feature vector and the covalent bond embedding feature vector.
[0125] Among them, the initial input is:
[0126]
[0127] Furthermore, after obtaining the initial features by processing through the graph convolutional network, in this embodiment, the graph attention network is used to analyze the atomic initial embedding feature matrix and the covalent bond initial embedding feature matrix to further learn the features of atoms and covalent bonds.
[0128] Among them, the purpose of designing the graph attention network feature extraction network in this embodiment is that covalent bonds are a way of interaction between atoms. The formation of covalent bonds depends on the electronic structure and chemical properties of atoms, and the properties of atoms change due to the formation of covalent bonds. Therefore, there is a very close connection between atoms and covalent bonds themselves. When extracting atomic features, covalent bond features are passed to atoms, and when extracting covalent bond features, atomic features are also passed to covalent bonds to achieve feature fusion.
[0129] Specifically, the input of the graph attention network is and the atomic attention coefficient between the i-th atom and the j-th atom the covalent bond attention coefficient between the i-th covalent bond and the j-th covalent bond The calculation is as follows:
[0130]
[0131] Among them, exp(·) represents the exponential function with the natural constant e as the base; LeakyReLU(·) represents the LeakyReLU activation function; a atom and a bond are weight vectors; and are weight matrices; N atom (i) represents the set of neighbor atoms of the i-th atom; N bond (i) represents the set of neighbor covalent bonds of the i-th covalent bond; || represents the concatenation operation.
[0132] On this basis, the atomic attention coefficient and the covalent bond attention coefficient are used to perform feature fusion on the atomic initial embedding feature matrix and the covalent bond initial embedding feature matrix respectively, and the atomic fusion feature vector and the covalent bond fusion feature vector are obtained as follows:
[0133]
[0134]
[0135] where, and are the fusion weight matrices; σ(·) is the non-linear activation function.
[0136] Step Five: Extract the sequence features of the drug.
[0137] In this embodiment, a convolutional layer is designed to extract the sequence features of the drug from the SMILES sequence of the drug.
[0138] where, assuming that the SMILES sequence of the current drug is S = {s1, s2,..., s L}(L is the length of the SMILES sequence), s i is the i-th character of the SMILES sequence. The multi-layer perceptron (MLP) is used as the embedding layer to perform the embedding operation on the SMILES sequence, and the SMILES embedding vector sequence S' = {s1', s'2,..., s' L} is obtained. Specifically:
[0139] S' = MLP(s1, s2,..., s L )
[0140] where, MLP(·) represents the MLP processing layer and is used for the embedding operation.
[0141] The convolutional layer slides a convolutional kernel over the embedding vector sequence S' = {s'1, s'2,..., s' L} to extract local features. Assuming that the size of the convolutional kernel is k, the convolutional operation can be expressed as:
[0142] f j = σ(W cnn S' j:j+k + b cnn )
[0143] where, S' j:j+k represents the subsequence of the embedding vector S' from the j-th to the j + k - 1-th elements; W cnn is the weight matrix; b cnnis the offset; σ(·) is the non-linear activation function. In this way, the local sequence feature f corresponding to the subsequence from the j-th to the (j + k - 1)-th elements of the embedded vector S′ can be obtained j , and form the sequence feature vector set F = {f1, f2,..., f L-k+1}.
[0144] Use the max pooling operation to reduce the dimension of the feature vectors. Specifically:
[0145] g j = Maxpooling(F j:j+p )
[0146] where F j:j+p is the local sequence feature vector from the j-th to the (j + p - 1)-th.
[0147] After flattening, it is fed into the fully connected layer to obtain the sequence feature vector x of the drug s , specifically:
[0148] x s = σ(W fc Flatten(g1, g2,..., g (L-k+1)-p+1 ) + b fc )
[0149] where Flatten(·) represents the flattening operation function; W fc is the weight matrix; b fc is the offset; σ(·) is the non-linear activation function.
[0150] Furthermore, in step four, the i-th atomic fusion feature vector of a drug molecule and the i-th covalent bond fusion feature vector In step five, the sequence feature vector x of the drug molecule is obtained s . Next, use a multi-layer perceptron to fuse the structural feature vector and the sequence feature vector of the drug. The fusion process is as follows:
[0151]
[0152] where x i is the drug feature vector of the i-th drug, and MLP(·) represents the MLP processing layer; represents the i-th atomic fusion feature vector in the current drug molecule; represents the i-th covalent bond fusion feature vector in the current drug molecule; x s is the sequence feature vector of the current drug molecule; || represents the concatenation operation.
[0153] In an alternative embodiment, regarding patients and drugs as nodes and the medication records of patients as hyperedges, and constructing a heterogeneous hypergraph using patient representations and drug feature vectors includes:
[0154] Step Seven: Construct a heterogeneous hypergraph of patients and drugs.
[0155] First, there are two types of nodes in the heterogeneous hypergraph, namely patient nodes and drug nodes, and the hyperedges are the drug treatment plans corresponding to patients. One hyperedge can only be associated with one patient node, but can be associated with multiple drug nodes. The multiple drug nodes associated under the same hyperedge correspond to the drug treatment plan of the only patient node under the current hyperedge. Inspired by the above modeling process, the present invention proposes to use patient nodes as the main nodes and drug nodes as the subordinate nodes. The main node is the node that can uniquely determine the hyperedge (drug treatment plan) based on the latent semantic relationship, and the subordinate node is the member node of the hyperedge (drug treatment plan). It combines with the main node to represent the complete semantics (i.e., patients and drug treatment plans). The subordinate node does not necessarily exist uniquely in a certain hyperedge. It may be shared among multiple hyperedges. Now, construct a heterogeneous hypergraph G h =(V h ={V p , V d}, E h ), where V h represents the node set of the heterogeneous hypergraph, which is composed of the patient node set V p and the drug node set V d ; E h represents the hyperedge set of the heterogeneous hypergraph. Each hyperedge contains one patient node and several drug nodes, representing the medication plan of the current patient. Then, each main node (patient node) is modeled in the form of a hyperedge, as well as the subordinate nodes (drug nodes) that are the member nodes of this hyperedge, to represent the complete semantics.
[0156] Then, the goal of this embodiment is to represent nodes and hyperedges in a low-dimensional vector space by learning a mapping function.
[0157] Reconstruct a scoring function between drug nodes and hyperedges based on the low-dimensional embedding.
[0158] Furthermore, to achieve this goal, the present invention proposes to use a β variational autoencoder to realize the embedding and correlation reconstruction of nodes and hyperedges in a heterogeneous hypergraph. In traditional heterogeneous hypergraph correlation reconstruction methods, the model usually obtains high-quality embeddings of nodes and hyperedges from the observation space (the sample data itself) and directly performs correlation reconstruction. However, such methods may be affected by the noise of the observed data, resulting in inaccurate reconstruction results. In contrast, variational inference allows the model to infer the random distribution of latent variables from the latent space (mapped from the sample data), which can not only provide more stable and reliable results but also capture the uncertainty in the embedding space. Through this mechanism, the model can more effectively learn the latent representations of nodes and hyperedges, thereby improving the accuracy of correlation prediction.
[0159] For the constructed abnormal hypergraph, it includes patient nodes and drug nodes, two types of nodes, and each type of node has a sub-correlation matrix, and each sub-correlation matrix represents the similarity relationship between that type of nodes. In this embodiment, the cosine similarity is used to construct the sub-correlation matrix of patient nodes and the sub-correlation matrix of drug nodes Specifically:
[0160]
[0161] Among them, represents the element value at the i-th row and j-th column in the sub-correlation matrix of patient nodes; h i represents the feature vector of the i-th patient; represents the element value at the i-th row and j-th column in the sub-correlation matrix of drug nodes, x j represents the feature vector of the j-th drug; cos(·) represents the cosine function; · represents the vector dot product operation; * represents the multiplication operation; || || represents the Euclidean norm of the vector.
[0162] Furthermore, the sub-correlation matrix of patient nodes and the sub-correlation matrix of drug nodes are binarized. If the element value is greater than 0.5, it is taken as 1, otherwise it is taken as 0.
[0163] In an alternative embodiment, the heterogeneous hypergraph is encoded based on a β variational autoencoder, the drug combination prediction for patients is performed using the drug node embeddings and hyperedge embeddings obtained by encoding, the loss of the drug combination prediction result is calculated, and the model is optimized according to the result of the loss calculation, including:
[0164] Step eight: Encode the nodes of the heterogeneous hypergraph.
[0165] Encoding of heterogeneous nodes first requires a non-linear mapping from the observed heterogeneous space to a common latent space. Specifically:
[0166]
[0167] Among them, is the projected patient node embedding vector, is the projected drug node embedding vector, and X is the initial feature matrix of the hyperedge, initialized as the identity matrix; and are non-linear activation functions; and and are the weight matrix and bias respectively.
[0168] Two separate fully connected layers are used to estimate the variational posterior distribution of the projected node embedding vector of the mean and variance Specifically:
[0169]
[0170]
[0171] Among them, and are learnable weight matrices; and are biases; and are the parameter sets to be learned.
[0172] Finally, sample from the node variational posterior distribution to obtain the final patient node embedding vector and the final drug node embedding vector Specifically:
[0173]
[0174] Among them, ε1 is a randomly initialized matrix that follows a normal distribution. And and are respectively the parameter sets composed of the learned parameters and constitute.
[0175] Step Nine: Encode the hyperedges of the heterogeneous hypergraph.
[0176] To encode the high-order semantics and complex relationships represented in the form of hyperedges, the heterogeneous hyperedges need to be encoded. First, the observed heterogeneous space and Perform a non - linear feature transformation to convert it into a common latent space, obtaining projection embedding vectors (projection patient embedding vectors and projection drug embedding vectors ). Specifically:
[0177]
[0178] Among them, and are the initial feature matrices of patient nodes and drug nodes respectively, initialized as the identity matrix; and are non - linear activation functions; and and are the weight matrix and bias respectively.
[0179] For a specific type of embedding of a given projection, introduce a hyper - edge attention module to learn the importance differences of different types of nodes in each hyper - edge, obtaining transformed embedding vectors (transformed patient embedding vectors and transformed drug embedding vectors ). Specifically:
[0180]
[0181] Among them, and are the learnable weight matrix and bias respectively, and tanh(·) represents the Tanh function.
[0182] Based on the transformed embeddings and Utilize the type preference vector p to calculate the attention weights of various types of nodes in all hyper - edges and perform normalization. Specifically:
[0183]
[0184] Among them, and represent the attention weights for patient nodes and drug nodes respectively; exp(·) represents the exponential function with the natural constant e as the base; the type preference vector p is randomly initialized and continuously updated during model training.
[0185] According to the learned attention weights and Through the specific type of embedding of the projection and The fused hyper - edge embedding vector
[0186]
[0187] Then, two separate fully-connected layers are used to estimate the hyperedge variational posterior distribution of the mean μ ε and variance σ ε , specifically:
[0188]
[0189] where, and are learnable weight matrices; and are bias terms; θ ε is the set of parameters to be learned.
[0190] Sample from the hyperedge variational posterior distribution to obtain the final hyperedge embedding vector Z ε :
[0191] Z ε = μ ε + σ ε ε2
[0192] where ε2 is also a randomly initialized matrix following a normal distribution, and its value will be continuously updated as the model learns. And θ ε is the set of parameters composed of the learning parameters .
[0193] Step ten: Decode the heterogeneous hypergraph.
[0194] The hypergraph decoder aims to decode and generate random variables based on the patient node embedding drug node embedding and hyperedge embedding Z ε , from which the topological structure of the original heterogeneous hypergraph can be reconstructed.
[0195] Since the observation spaces and store binary-valued data points, the distributions and
[0196]
[0197] where, represents the embedding vector of the i-th patient node; represents the embedding vector of the i-th drug node; T represents the transpose operation; sigmoid(·) represents the Sigmoid function; Ber(·) represents the Bernoulli distribution function; and are the parameters to be learned and optimized.
[0198] Through the above process, the estimated distribution can be utilized and to reconstruct the sub - association matrix H Vp and H Vd .
[0199] Step Eleven: Predict the drug combinations required by the patient.
[0200] Among them, predicting the drug combinations for the patient by using the encoded drug node embeddings and hyper - edge embeddings includes:
[0201]
[0202] where f score (·) is the association score between the drug node and the hyper - edge node, and Sim(·) is the Euclidean distance similarity metric function. is the embedding of the i - th drug node, is the hyper - edge embedding corresponding to the j - th patient node. In this embodiment, a hyper - edge contains one patient (the main node) and multiple drug nodes (the slave nodes, representing the patient's historical medication information). The association score is based on the drug node embedding and the hyper - edge embedding Z ε , and the association possibility between the i - th drug node and the j - th hyper - edge node is measured by the similarity between the embedding vectors.
[0203] Step Twelve: Model loss calculation.
[0204] Calculating the loss for the result of drug combination prediction, including: label loss, reconstruction loss of the β - variational auto - encoder architecture, and adverse drug interaction loss.
[0205] First, after calculating the association score between the drug node and the patient node, set the drugs with the association score greater than the association score threshold as the newly added drugs to obtain the drug recommendation sequence (if the i - th drug is newly added, then the i - th position of is 1, otherwise 0).
[0206] In this embodiment, the association score threshold is taken as 0.5.
[0207] For the label loss, the loss function is set as the binary cross - entropy loss function in the form of cumulative sum, specifically:
[0208]
[0209] where L bce is the label loss value, N is the total number of patients; M - N is the total number of drugs; y mis the label of the m-th drug in the real drug set; is the label of the m-th drug in the recommended drug sequence.
[0210] For the reconstruction loss of the β variational autoencoder architecture, what also needs to be considered in this embodiment is the reconstruction loss of the sub-correlation matrix and Specifically:
[0211]
[0212] where represents the reconstruction loss value, Ε q [·] represents the expectation function; KL(·) represents the KL divergence function; the prior distribution and p(Z ε ) = p0(Z ε ) is initialized by the parameter-free prior distribution p0(·); the values of β1, β2, and β3 are regularization weight parameters, which can help the model balance the regularization strength of different latent spaces, so as to better capture the structural characteristics of the heterogeneous hypergraph.
[0213] For the adverse drug interaction loss, the loss of drug adverse reactions also needs to be considered in this embodiment. According to the adverse DDI information between drugs, the DDI matrix A ddi is constructed. If the combination of the i-th drug and the j-th drug causes an adverse reaction, the element in the i-th row and j-th column of A ddi is 1, otherwise it is 0. Using the DDI loss, the situation of adverse DDI drug combinations in the model-recommended drug combinations is reduced. Specifically:
[0214]
[0215] where represents the predicted drug; is the label of the m-th drug in the recommended drug sequence; T represents the transpose operation; calculates the occurrence of adverse DDI drug combinations in the predicted drug combinations.
[0216] Combining the label loss, the reconstruction loss of the β variational autoencoder architecture, and the adverse drug interaction loss, the final drug prediction loss value L is obtained. Specifically:
[0217]
[0218] where ν1 and ν2 are weighting parameters.
[0219] The specific embodiments described above further elaborate on the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only the specific embodiments of the present invention and is not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A drug recommendation method based on a β variational autoencoder, characterized in that It includes the following steps: Obtain the medical record data of the patient, and use the GRU network combined with the bidirectional attention mechanism to extract the representation of the medical record to obtain the patient representation; Construct a drug heterogeneous network based on the drug SMILES, extract the structural feature vector of the drug from the drug heterogeneous network, and fuse the structural feature vector with the sequence feature vector of the drug to generate a drug feature vector; Regard the patient and the drug as nodes, and the medication record of the patient as a hyperedge, and construct a heterogeneous hypergraph using the patient representation and the drug feature vector; Encode the heterogeneous hypergraph based on the β variational autoencoder, and use the drug node embedding and hyperedge embedding obtained by the encoding to predict the drug combination for the patient, calculate the loss of the result of the drug combination prediction, and optimize the model according to the result of the loss calculation.
2. The drug recommendation method based on β variational autoencoder according to claim 1, wherein Using the GRU network combined with the bidirectional attention mechanism to extract the representation of the medical record includes the following steps: Perform word embedding operations on the diagnosis record and the surgical record in the medical record to obtain a diagnosis embedding vector and a surgical embedding vector; Use the GRU network to extract temporal features from the diagnosis embedding vector and the surgical embedding vector to obtain a diagnosis temporal feature and a surgical temporal feature; Use the bidirectional attention mechanism to enhance the attention of the diagnosis temporal feature and the surgical temporal feature to obtain a diagnosis attention-enhanced feature and a surgical attention-enhanced feature; Calculate the interaction feature vector between the diagnosis attention-enhanced feature and the surgical attention-enhanced feature, and fuse the features of the diagnosis attention-enhanced feature and the surgical attention-enhanced feature through the interaction feature vector to obtain the patient representation.
3. The drug recommendation method based on the β variational autoencoder according to claim 1, characterized in that, Constructing a drug heterogeneous network based on the drug SMILES includes the following steps: Extract the atomic features in the drug molecule, and splice the atomic features to generate an atomic node feature vector; Extract the covalent bond features in the drug molecule, and splice the covalent bond features to generate a covalent bond node feature vector; Construct an atomic similarity matrix and a covalent bond similarity matrix based on the atomic node feature vector and the covalent bond node feature vector; Use the connection relationship between atoms and covalent bonds to construct an association matrix, and comprehensively construct a drug heterogeneous network using the atomic similarity matrix, the covalent bond similarity matrix, and the association matrix.
4. The drug recommendation method based on β variational autoencoder according to claim 3, characterized in that Extracting the structural feature vector of the drug from the drug heterogeneous network includes the following steps: Use the graph convolutional network to perform initial embedding on the atomic feature and the covalent bond feature respectively to obtain an atomic initial embedding feature matrix and a covalent bond initial embedding feature matrix; Use the graph attention network to calculate the atomic attention coefficient and the covalent bond attention coefficient for the atomic initial embedding feature matrix and the covalent bond initial embedding feature matrix respectively; Use the atomic attention coefficient and the covalent bond attention coefficient to fuse the features of the atomic initial embedding feature matrix and the covalent bond initial embedding feature matrix respectively to obtain an atomic fusion feature vector and a covalent bond fusion feature vector.
5. A drug recommendation method based on a β variational autoencoder according to claim 3, characterized in that, The extraction process of the sequence feature vector of the drug includes the following steps: Obtain the SMILES sequence of the drug, and use a multi-layer perceptron as an embedding layer to perform embedding processing on the SMILES sequence to obtain a SMILES embedding vector sequence; Slide a convolution kernel over the SMILES embedding vector sequence to extract local features, and integrate the local features to generate a sequence feature vector; Perform dimensionality reduction processing and flattening processing on the sequence feature vector in sequence, and feed the sequence feature vector after dimensionality reduction processing and flattening processing into a fully connected layer to generate a sequence feature vector of the drug.
6. The drug recommendation method based on β variational autoencoder according to claim 4 or 5, characterized in that, Fuse the structural feature vector and the sequence feature vector of the drug, including: using a multi-layer perceptron to fuse the structural feature vector and the sequence feature vector of the drug, and the fusion process is as follows: where x i is the drug feature vector of the i-th drug, and MLP(·) represents the MLP processing layer; represents the fused feature vector of the i-th atom in the current drug molecule; represents the fused feature vector of the i-th covalent bond in the current drug molecule; x s is the sequence feature vector of the current drug molecule; || represents the concatenation operation.
7. The drug recommendation method based on a β variational autoencoder according to claim 1, wherein The heterogeneous hypergraph includes: patient nodes and drug nodes, and both the patient nodes and the drug nodes are provided with sub-association matrices, and the sub-association matrices are used to represent the similarity relationships of the same type of nodes; the sub-association matrices are set as follows: Among them, represents the element value of the i-th row and j-th column in the sub-association matrix representing the patient nodes; h i represents the feature vector of the i-th patient; represents the element value of the i-th row and j-th column in the sub-association matrix representing the drug nodes, x j represents the feature vector of the j-th drug; cos(·) represents the cosine function; · represents the vector dot product operation; * represents the multiplication operation; || || represents the Euclidean norm of the vector.
8. The drug recommendation method based on β variational autoencoder according to claim 1, characterized in that Encode the heterogeneous hypergraph based on the β variational autoencoder, including: encoding the nodes of the heterogeneous hypergraph and encoding the hyperedges of the heterogeneous hypergraph; Among them, encoding the nodes of the heterogeneous hypergraph includes: Perform a non-linear mapping on the nodes of the heterogeneous hypergraph to obtain a projected node embedding vector; Use a fully connected layer to estimate the projected node embedding vector to obtain a node variational posterior distribution; Sample the node variational posterior distribution to obtain a final node embedding vector; Among them, encoding the hyperedges of the heterogeneous hypergraph includes: Perform a non-linear mapping on the hyperedges of the heterogeneous hypergraph to obtain a projected embedding vector; Use a hyperedge attention module to perform differential learning on the projected embedding vector to generate a transformed embedding vector; Perform attention calculation on the transformed embedding vector using a type preference vector to obtain an attention weight; Fuse the attention weight and the projected embedding vector to obtain a fused hyperedge embedding vector; Use a fully connected layer to estimate the fused hyperedge embedding vector to obtain a hyperedge variational posterior distribution; Sample the hyperedge variational posterior distribution to obtain a final hyperedge embedding vector.
9. The drug recommendation method based on β variational autoencoder according to claim 8, characterized in that Use the encoded drug node embedding and hyperedge embedding to perform drug combination prediction for patients, including: Among them, f score (·) is the association score between the drug node and the hyperedge node, and Sim(·) is the Euclidean distance similarity metric function. is the embedding of the i-th drug node. is the hyperedge embedding corresponding to the j-th patient node. Set the drugs with the association score greater than the association score threshold as new drugs, and integrate the new drugs to generate a drug recommendation sequence.
10. A drug recommendation method based on a β variational autoencoder according to claim 9, characterized in that, Calculate the loss of the result of drug combination prediction, including the following steps: Construct a binary cross-entropy loss function, and use the binary cross-entropy loss function to calculate the loss of the drug recommendation sequence to obtain a label loss value; Construct a reconstruction loss function, and use the reconstruction loss function to calculate the reconstruction loss of the heterogeneous hypergraph to obtain a reconstruction loss value; Construct a DDI matrix based on the adverse drug interactions between drugs, and use the DDI matrix to calculate the adverse drug interaction loss of the drug recommendation sequence to obtain a DDI loss value; Integrate the label loss value, the reconstruction loss value and the DDI loss value to obtain a drug prediction loss value.
Citation Information
Cited By
Remote auxiliary diagnosis and treatment system and data processing method
CN121862355A