Drug recommendation methods and related equipment based on drug representation and user dynamic modeling
By employing a drug recommendation method based on attention mechanisms and graph neural networks, we have addressed the issues of inaccurate representation of dynamic changes in user health and drug function in drug recommendation, thereby achieving more accurate and safer drug combination recommendations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XIAN HOSPITAL OF TRADITIONAL CHINESE MEDICINE
- Filing Date
- 2026-04-07
- Publication Date
- 2026-06-30
AI Technical Summary
Existing drug recommendation methods struggle to accurately capture dynamic changes when dealing with the temporal evolution of user health status. Drug functional representations do not adequately model long-range dependencies between motifs, and the integration of user and drug representations is insufficient, affecting the quality of drug combination output.
We designed a dynamic user representation module based on an attention mechanism, combining a Transformer encoder and a graph neural network. By constructing a drug motif heterogeneity graph, we used a hybrid encoder to deeply fuse user and drug representations, generating fused features between drugs and users.
It improves the accuracy and safety of drug recommendations, enabling more precise reflection of changes in user health and drug function, and generating safe and effective drug combinations that meet user needs.
Smart Images

Figure CN122314232A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of healthcare informatics technology, and more specifically, to a drug recommendation method and related equipment based on drug representation and user dynamic modeling. Background Technology
[0002] With the deep application of artificial intelligence in the medical field, combination drug recommendations based on electronic health records (EHRs) have become a key tool for achieving precision medicine. The core challenge of this task lies in the fact that it not only needs to recommend a set of drugs based on the complex user's historical health records, but also must strictly ensure the safety of the recommended drug set, that is, to minimize drug-drug interactions (DDIs).
[0003] Early recommendations relied on experienced physicians manually formulating rules to guide medication decisions. However, the effectiveness of these rules highly depended on the completeness of expert experience and the size of the rule base, thus limiting their adaptability in complex clinical scenarios. To improve recommendation efficiency, instance-based recommendations emerged, generating recommendations by mining co-occurrence relationships between drugs and symptoms. However, these methods only focus on the current user's visits, ignoring historical visits that can provide information for personalization, resulting in lower recommendation accuracy. Summary of the Invention
[0004] This application provides a drug recommendation method and related equipment based on drug representation and user dynamic modeling, which can at least partially solve the problem of low accuracy in drug recommendations.
[0005] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0006] According to one aspect of this application, a drug recommendation method based on drug representation and user dynamic modeling is provided, comprising: generating user features based on acquired user historical health records and current health status, the user features including diagnostic features, program features, and drug features; sequentially inputting the diagnostic features and program features into a GRU network and a Transformer network, respectively, to generate user representations through dynamic modeling; inputting the drug features into a pre-constructed graph attention network to construct a heterogeneous graph between drug attributes and molecular motifs, and generating drug representations by message propagation and stacking on the heterogeneous graph; inputting the user representations and drug representations into a pre-constructed feedforward neural network to output fusion features between drugs and users; generating probabilities from the fusion features through an activation function, and generating recommendation information based on the target drugs corresponding to the probabilities.
[0007] In this application, based on the aforementioned scheme, the step of generating user features based on the acquired user's historical health records and current health status includes: acquiring the user's historical health records and current health status; extracting user features from the historical health records and current health status, wherein the user features include diagnostic features, program features, and drug features.
[0008] In this application, based on the aforementioned scheme, the step of sequentially inputting the diagnostic features and the program features into a GRU network and a Transformer network, respectively, and generating a user representation through dynamic modeling includes: weighting the diagnostic features to generate weight features; inputting the weight features into the GRU network and the Transformer network, respectively, and outputting the GRU hidden state and the first layer output of the Transformer; inputting the GRU hidden state and the first layer output into an encoder to generate a diagnostic representation; synchronously processing the program features in the above manner to generate a program representation corresponding to the program features; and fusing the diagnostic representation and the program representation to generate a user representation.
[0009] In this application, based on the aforementioned scheme, the step of generating weighted features by weighting the diagnostic features includes: extracting current diagnostic features from the current health status; generating weights corresponding to the diagnostic features of the user when predicting the number of medical visits based on the current diagnostic features; and weighting the diagnostic features using the weights to generate weighted features.
[0010] In this application, based on the aforementioned scheme, the step of inputting the drug features into a pre-constructed graph attention network to construct a heterogeneous graph between drug properties and molecular motifs, and generating a drug characterization by performing message propagation and stacking on the heterogeneous graph, includes: inputting the drug features into a pre-constructed graph attention network and outputting local representations of at least two drug substructures; constructing a heterogeneous graph between drug properties and molecular motifs based on the local representations; performing multi-layer message propagation on the heterogeneous graph and taking the output of the last layer as the final drug embedding; and stacking the final drug embeddings of all drugs row by row to generate a drug characterization.
[0011] In this application, based on the aforementioned scheme, the step of inputting the user representation and the drug representation into a pre-constructed feedforward neural network and outputting the fusion feature between the drug and the user includes: constructing a feedforward neural network based on an artificial neural network structure; inputting the user representation and the drug representation into the feedforward neural network and outputting the fusion feature between the drug and the user.
[0012] In this application, based on the aforementioned scheme, the step of generating probabilities from the fusion features through an activation function and generating recommendation information based on the target drugs corresponding to the probabilities includes: generating the probability of each drug appearing in the prescription through an activation function from the fusion features; generating recommendation information based on target probabilities greater than a set threshold; and sending the recommendation information to the user terminal.
[0013] According to one aspect of this application, a drug recommendation device based on drug representation and user dynamic modeling is provided, comprising: The feature module is used to generate user features based on the acquired user's historical health records and current health status. The user features include diagnostic features, program features, and drug features. The user module is used to input the diagnostic features and the program features into the GRU network and the Transformer network respectively in sequence, and generate user representations through dynamic modeling. The drug module is used to input the drug features into a pre-constructed graph attention network to construct a heterogeneous graph between drug properties and molecular motifs, and generate drug characterization by performing message propagation and stacking on the heterogeneous graph. The fusion module is used to input the user representation and the drug representation into a pre-constructed feedforward neural network and output the fusion feature between the drug and the user. The recommendation module is used to generate probabilities from the fused features through an activation function, and generate recommendation information based on the target drugs corresponding to the probabilities.
[0014] According to one aspect of this application, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the drug recommendation method based on drug representation and user dynamic modeling as described in the above embodiments.
[0015] According to one aspect of this application, an electronic device is provided, comprising: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement the drug recommendation method based on drug representation and user dynamic modeling as described in the above embodiments.
[0016] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the drug recommendation method based on drug representation and user dynamic modeling provided in the various alternative implementations described above.
[0017] This application's technical solution designs a dynamic user representation module based on an attention mechanism, integrating dynamic temporal modeling and a Transformer encoder. By assigning appropriate attention weights to each visit, it accurately captures the temporal evolution of the user's health status. Secondly, it constructs a motif-aware drug representation module. By building a drug motif heterogeneity graph and utilizing graph neural networks to learn long-range dependencies between motifs, it obtains a more accurate and interpretable representation of drug function. Finally, it designs a recommendation module based on a hybrid encoder, deeply fusing user and drug representations through multiple attention mechanisms to optimize the final drug combination output. The differences and technical effects of this application's technical solution compared to existing technologies are mainly in the following aspects: First, existing technologies often struggle to accurately capture the dynamic changes between each medical visit when processing the temporal evolution of a user's health status. This application designs a dynamic user representation module based on an attention mechanism, integrating dynamic temporal modeling and a Transformer encoder to rationally allocate attention weights for each medical visit. This allows the model to focus on key medical information, accurately capture the temporal patterns of health status, and, compared to existing technologies, reflect user health changes more nuancedly, thus improving recommendation accuracy.
[0018] Second, existing methods do not adequately model long-range dependencies between motifs in drug function representation, resulting in imprecise and uninterpretable representations. This application constructs a motif-aware drug characterization module by building a drug motif heterogeneity graph and utilizing graph neural networks to learn long-range dependencies between motifs. This approach fully explores the relationship between drugs and motifs, obtaining more accurate and interpretable drug function representations, providing a more reliable basis for drug recommendations, and outperforming existing technologies.
[0019] Third, existing technologies lack sufficient depth in feature interaction when integrating user and drug representations, affecting the quality of drug combination output. This application designs a recommendation module based on a hybrid encoder, employing multiple attention mechanisms to deeply integrate user and drug representations. This fully explores the potential correlation between the two, optimizes drug combination output, and compared to existing technologies, generates drug recommendations that better meet user needs and are safer and more effective, thus improving the overall recommendation performance.
[0020] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0021] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0022] Figure 1 The flowchart illustrating a drug recommendation method based on drug representation and user dynamic modeling in one embodiment of this application is shown.
[0023] Figure 2 The flowchart illustrating the generation of user representations through dynamic modeling is shown in one embodiment of this application.
[0024] Figure 3 The illustration shows a schematic diagram of the comparison of model test results in one embodiment of this application.
[0025] Figure 4 The illustration shows a schematic diagram of the comparison of model test results in one embodiment of this application.
[0026] Figure 5 The illustration shows a schematic diagram of the comparison of model test results in one embodiment of this application.
[0027] Figure 6 The illustration shows a schematic diagram of the comparison of model test results in one embodiment of this application.
[0028] Figure 7 The illustration shows a schematic diagram of a drug recommendation device based on drug representation and user dynamic modeling in one embodiment of this application.
[0029] Figure 8 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown. Detailed Implementation
[0030] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.
[0031] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.
[0032] It should be noted that the data acquisition or information collection in this embodiment is performed after authorization by the user or the object of collection, and its process and purpose strictly follow the relevant regulations.
[0033] The block diagrams shown in the attached figures are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, or in one or more hardware modules composed of smart chips and AI chips, smart integrated circuits, or application-specific integrated circuits (ASICs), or in different network and / or processor devices and / or microcontroller devices.
[0034] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0035] The implementation details of the technical solution of this application are described below: The technical solution of this application constructs a MoTRA-Net drug recommendation model, which consists of three main modules: a dynamic user representation module based on an attention mechanism, a drug representation module, and a drug recommendation module. Specifically, in the user representation module, a comprehensive user representation is generated by hybrid encoding of multiple medical records of the user, including diagnostic and procedural features. This characterization effectively captures a user's historical health status, providing a basis for personalized drug recommendations; the drug characterization module generates a characteristic representation of a drug by constructing a graph structure of the drug and its motifs, combined with molecular properties. This module can fully consider the structural information of drugs, thereby improving the accuracy of recommendations. In the drug recommendation module, a hybrid encoder combined with an attention mechanism and DDI safety gating is used to generate the final drug recommendation results, thereby achieving dual-objective optimization of efficacy and safety.
[0036] Figure 1 A flowchart illustrating a drug recommendation method based on drug representation and user dynamic modeling according to an embodiment of this application is shown. (Refer to...) Figure 1 As shown, this drug recommendation method based on drug representation and user dynamic modeling includes at least steps S110 to S150, which are described in detail below: S110, Based on the obtained historical health records and current health status of the user, user characteristics are generated, including diagnostic characteristics, program characteristics and drug characteristics.
[0037] In this embodiment, the user's historical health records and current health status data are first read from multiple data sources. These data, originating from different sources and in various formats, are cleaned, missing and outlier values are removed, and the format is standardized. Natural language processing (NLP) techniques are used to analyze the text in the historical health records, extracting key information such as disease names and symptoms. This information is then combined with the current health status to determine the current disease situation and potential risks, forming diagnostic features. Information on various medical procedures, including examinations and treatments, received by the user is compiled from the data, analyzing their execution time, frequency, and results. Based on the current health status, the need for subsequent procedures is assessed, generating procedure features. Drug usage records are collected, including name, dosage, and frequency. Data mining is used to analyze drug responses and interactions, predicting future medication use based on the current situation, and integrating drug features. Finally, user features encompassing diagnostic, procedure, and drug characteristics are generated.
[0038] In one embodiment of this application, user characteristics are generated based on the obtained historical health records and current health status of the user, including: The user's historical health records and current health status are obtained; User characteristics are extracted from the historical health records and current health status, including diagnostic characteristics, program characteristics, and drug characteristics.
[0039] First, the user's historical health records and current health status data are read from the storage system. This data exists in various formats, such as electronic medical record documents, database records, or real-time data streams transmitted from sensors. After reading, data preprocessing operations are performed to fill in missing values. For example, if blood pressure data is missing in a physical examination record, it can be reasonably estimated based on the average of the user's historical blood pressure data. Outliers are corrected. For example, if a blood glucose test value is found to be far above the normal range, it is determined whether it is a measurement error based on the user's recent diet and medication, and then corrected. At the same time, the data format is standardized, transforming data from different sources into a standardized structure that is easy to process, preparing for subsequent feature extraction.
[0040] For the preprocessed data, natural language processing (NLP) techniques are used to analyze the text information in historical health records. By identifying keywords and key phrases in the text, such as disease names and symptom descriptions, the types of diseases the user has previously been diagnosed with are determined. For example, keywords such as hypertension, diabetes, epilepsy, and Alzheimer's disease are identified from medical record text and included as part of the diagnostic features. Simultaneously, combined with current health status data, the system analyzes whether the user still suffers from these diseases or whether new signs of disease have emerged. This information is integrated to form a complete diagnostic feature that comprehensively reflects the user's disease diagnosis status.
[0041] Information on medical procedures related to historical health records is extracted, including various examination items such as blood tests and imaging examinations, as well as treatment procedures such as surgery and rehabilitation training. By analyzing the execution time, frequency, and results of these procedures, the medical interventions received by the user are understood. For example, the number of cardiac ultrasound examinations performed by the user in the past year and the trend of changes in the results of each examination are recorded; the time of joint surgery and postoperative recovery are also recorded. Combined with the current health status, it is determined whether the user needs to continue certain procedures or has new procedure requirements. This information on medical procedures is compiled into procedure features to characterize the user's characteristics and needs in terms of medical procedures.
[0042] Medication usage information is collected from historical health records and current health status data, including drug names, dosages, frequency of use, and duration of use. Analyzing these records helps understand user responses to different medications, such as the effectiveness of a particular antihypertensive drug and whether adverse reactions occurred. Data mining techniques are used to discover drug interactions, such as the potential for certain drugs to enhance or weaken their effects when used concurrently. Combining current health status and diagnostic characteristics, future medications that users may need are predicted. This drug-related information is integrated into drug characteristics, resulting in a comprehensive user profile that includes diagnostic, procedural, and drug characteristics, providing a complete basis for subsequent medical decisions.
[0043] In this embodiment, the goal of combination drug recommendation is to recommend the most suitable combination of drugs based on each user's historical health records and the diagnosis and procedures of the current medical visit, in order to achieve precision treatment. Assume there is an electronic health record dataset containing N users. The medical records of user x are represented as sequences. ,in This represents the user characteristics corresponding to user x's i-th medical visit data. This is the total number of medical visits. Specifically, each medical visit... It can be represented as a triple. ,in, These represent diagnostic features, procedural features, and drug features, respectively, where d, p, and m represent the identifiers of diagnostic features, procedural features, and drug features, respectively; and D, P, and M represent the code sets of diagnostic features, procedural features, and drug features, respectively.
[0044] Based on this, the goal of the task is to provide the user's previous... Health Records x, and the diagnostic features of this case. With program features Predicted drug combination recommended for this visit The challenge of this task lies in the non-linear dynamic nature of the temporal evolution of users' health conditions, and the need for drug recommendations to simultaneously satisfy both optimal efficacy and safety constraints.
[0045] The above process, by comprehensively collecting users' past and present health data, provides rich material for subsequent feature extraction, ensuring that the complete process of changes in users' health status can be captured. Diagnostic, procedural, and drug features are accurately extracted from complex health information, transforming massive amounts of raw data into structured and meaningful feature representations, reducing data dimensionality, highlighting key information, and facilitating subsequent model processing.
[0046] S120, the diagnostic features and the program features are sequentially input into the GRU network and the Transformer network, respectively, and user representations are generated through dynamic modeling.
[0047] In this embodiment, a pre-built Gated Recurrent Unit (GRU) network is activated, and diagnostic feature data is sequentially input into it. Leveraging its unique reset and update gate mechanisms, the GRU network dynamically determines the amount of information to forget and retain based on the current input and the previous hidden state when processing each diagnostic feature. This gradually captures the dynamic patterns of diagnostic features evolving over time, outputting a first intermediate representation that reflects the dynamic changes in the diagnostic features. Next, program feature data is fed into a pre-built Transformer network. This network utilizes a self-attention mechanism to calculate the similarity between program features and perform weighted summation, mining complex relationships between program features from multiple dimensions. After multiple layers of processing, a second intermediate representation reflecting the inherent connections between program features is output. Finally, these two intermediate representations are fused using a specific fusion strategy to organically combine them, thereby generating a comprehensive and accurate user representation that reflects the user's health status.
[0048] In this embodiment, the GRU network is an improved variant of the recurrent neural network, mainly composed of two gating structures: a reset gate and an update gate. The reset gate controls the contribution of the previous hidden state to the current candidate hidden state, while the update gate determines the proportion of the previous hidden state retained in the current time step. Through this gating mechanism, GRU can effectively capture short-term dependencies in sequence data, while alleviating the gradient vanishing problem of traditional recurrent neural networks (RNNs), thus improving the ability to model temporal information while maintaining computational efficiency.
[0049] The Transformer network is an auditing network architecture based entirely on self-attention mechanisms. It abandons recurrent structures and consists of stacked multi-head self-attention layers and feedforward neural networks. The self-attention mechanism calculates attention weights between all positions in the input sequence, enabling each position to aggregate global information. The multi-head design allows the model to learn multiple associations in parallel from different representation subspaces. The Transformer does not rely on sequence order processing, thus enabling efficient parallel computation. By incorporating sequence position information through positional encoding, it excels at capturing long-distance dependencies and is widely used in natural language processing and temporal modeling tasks.
[0050] like Figure 2 As shown, in one embodiment of this application, the diagnostic features and the program features are sequentially input into a GRU network and a Transformer network, respectively, to generate a user representation through dynamic modeling, including: S210, the diagnostic features are weighted to generate weighted features, and the weighted features are input into the GRU network and the Transformer network respectively, and the hidden state of GRU and the first layer output of Transformer are output respectively. S220, The hidden state of the GRU and the first layer output-input encoder are used to generate a diagnostic characterization; S230, The program features are synchronized using the above method to generate a program representation corresponding to the program features; S240, the diagnostic representation and the program representation are fused to generate a user representation.
[0051] Specifically, in one embodiment of this application, the diagnostic features are weighted to generate weighted features, including: Extract current diagnostic features from the current health status; Based on the current diagnostic features, generate weights corresponding to the diagnostic features when predicting the number of medical visits for a user; The diagnostic features are weighted using the weights to generate weighted features.
[0052] In combination drug recommendation systems, accurately modeling the dynamic changes in a user's health status is a key factor in improving recommendation effectiveness. Therefore, this embodiment constructs a dynamic user representation module based on an attention mechanism and designs a dynamic weighting mechanism to quantify the importance of historical medical visits, specifically for the diagnostic features of the i-th visit. Its weight Through historical diagnostic characteristics Compared with current diagnostic features The similarity is determined by the following formula: in, Current diagnostic features Historical diagnostic characteristics similarity, is a trainable parameter used to adjust the sharpness of the weight distribution, k is the summation index used to traverse all of the user's historical medical records, and T represents the total number of historical diagnoses.
[0053] Next, the diagnostic features are weighted to generate weighted features. .
[0054] Next, the weight features are input into the GRU network and the first-layer Transformer network respectively to model short-term temporal dependencies, resulting in the following formulas: In the above formula, It is the i-th diagnostic feature after dynamic weighting, i.e., the GRU hidden state; This represents the hidden state that the GRU retains after processing the previous i-1 visits; This represents the output features of the first layer of the Transformer network.
[0055] Subsequently, to further capture global dependencies, the output features of the first layer of the Transformer network were... With GRU hidden state The data is then concatenated and input into a Transformer encoder to generate diagnostic representations. As shown in the formula below: It should be noted that the program representation in this embodiment... Generate using the same process described above.
[0056] Then, the diagnostic representation and the program representation are fused to generate a user representation. This design significantly improves the ability to model long-term management of chronic diseases and acute symptom mutations by dynamically focusing on key medical events.
[0057] The above process determines the weights of historical diagnostic features based on current diagnostic features, enabling the model to focus more on recent or important diagnostic information, highlighting the impact of key diagnoses on user health, and enhancing feature targeting. A GRU network processes diagnostic feature weights to capture their time-varying patterns; a Transformer network processes procedural features, uncovering their complex relationships, and outputting hidden states and first-layer outputs respectively, providing a foundation for subsequent encoding. The encoder integrates the GRU hidden states and the Transformer first-layer output to generate diagnostic representations; similarly, it generates procedural representations, transforming scattered features into compact, representative vectors for easier fusion. By fusing diagnostic and procedural representations, and integrating user diagnostic and medical procedure information, the model comprehensively reflects the user's health dynamics and generates a more accurate and complete user representation.
[0058] S130, the drug characteristics are input into a pre-constructed graph attention network to construct a heterogeneous graph between drug properties and molecular motifs. Drug characterization is generated by message propagation and stacking on the heterogeneous graph.
[0059] In this embodiment, drug features are input into a pre-built graph attention network. Based on elements such as atoms, chemical bonds, and molecular motifs in the drug properties, a heterogeneous graph containing different types of nodes is constructed to present the correlation structure between drug properties and molecular motifs. Message propagation is initiated, and each node collects information from its neighboring nodes. The graph attention network assigns attention weights according to the importance of relationships between nodes, allowing nodes with important relationships to pass on more information, enabling nodes to gradually update their states to aggregate useful features. Subsequently, a stacking operation is performed, repeating message propagation multiple times to allow nodes to acquire broader information. Finally, the updated states of each node are integrated to extract a feature vector that comprehensively reflects the chemical structure and molecular motif characteristics of the drug, generating an accurate drug characterization.
[0060] In this embodiment, a dynamic graph attention network (GAT) is introduced based on a graph neural network architecture to replace the traditional, fixed weighted averaging method. When processing graph-structured data, neighbor nodes are weighted and aggregated. For each target node in the graph, GAT first calculates the attention coefficient between it and all its neighbor nodes. This coefficient evaluates the importance of neighbor nodes to the target node through a shared attention mechanism (e.g., a single-layer feedforward neural network). Subsequently, these coefficients are normalized using the Softmax function to obtain the final attention weights. During message passing, nodes dynamically and adaptively update their own feature representations by weighting and summing the features of their neighbors according to these weights. This mechanism allows the model to focus on more critical information in the graph without relying on pre-known graph structures, resulting in strong expressive power and generalization ability.
[0061] In one embodiment of this application, the drug characteristics are input into a pre-constructed graph attention network to construct a heterogeneity graph between drug properties and molecular motifs. Drug characterization is generated by message propagation and stacking on the heterogeneity graph, including: The drug features are input into a pre-constructed graph attention network, which outputs local representations of at least two drug substructures. Based on the local representation, an isomerism graph between drug properties and molecular motifs is constructed; Multi-layer message propagation is performed on the heterogeneous graph, and the output of the last layer is taken as the final drug embedding. The final drug embeddings of all drugs are stacked row by row to generate drug characterization.
[0062] In practical applications, drug properties are closely related to the topological structure of their molecular motifs. To fully capture this information, this module first inputs drug features (drug properties and their molecular motifs) into a graph attention network (GAT) to obtain a local representation of each drug substructure, which may include... and .in, It is the first feature vector extracted from drug characteristics through GAT, which encodes drug properties such as chemical structure and properties at the atomic level; This represents the second feature vector extracted from each motif subgraph using GAT. Motifs consist of small structural units composed of molecules with specific chemical properties and functions, such as benzene rings and carboxyl groups. These units combine in different ways to form complete drug molecules and determine the macroscopic function of the drug.
[0063] Subsequently, the local representation output by GAT is combined with drug features to construct a heterogeneous graph G=(V,E) between drug properties and their molecular motifs, where node V=(D,S) represents the set of nodes composed of drug properties and molecular motifs, and E is the edge corresponding to the chemical bond. Nodes include drug property nodes and molecular formula nodes, and edges are used to represent the propagation relationship between two nodes.
[0064] In this embodiment, the lightweight recommendation framework LightGCN based on GNN is selected to learn the representation of drug properties and molecular motifs on a heterogeneous graph (DS graph). Specifically, multi-layer message propagation is performed on the DS graph, and the embedding information obtained by the message propagation at the k-th layer can be represented by the following formula: In the above formula, These represent the drug embedding and molecular formula embedding in the k-th layer, respectively. express l A 3D real vector space, l Indicates the length of the embedding; This represents the set of molecular formula nodes connected to the drug attribute node d. This represents the set of nodes that are connected to the drug properties of the molecular formula node s. This indicates the size of the node set, i.e., the number of nodes. The superscript DS indicates a heterogeneous graph.
[0065] Specifically, embedding information is the process of mapping discrete molecular structures (drugs, motifs) into low-dimensional real vectors. These vectors are continuously optimized during training under the guidance of a loss function, ultimately encoding the chemical properties and functional information of the drug, providing a foundation for subsequent recommendations. Drug embedding is learned from drug molecular structures through graph neural networks and includes the drug's chemical properties and functional information; molecular formula embedding represents the characteristics of a molecular motif, and the motif can better correspond to the pharmacological function of the drug. After one round of message propagation, the heterogeneous graph is stacked, with each round based on the updated state of the nodes from the previous round. As the number of stacking operations increases, nodes receive information from a wider range of nodes, thus more comprehensively integrating various characteristics of the drug's chemical formula and molecular motif. After multiple stacking operations, each node contains rich drug-related information. The final states of these nodes are integrated and processed to extract a feature vector that comprehensively reflects the overall characteristics of the drug. This feature vector is the generated drug characterization, which accurately depicts key information about the drug's chemical structure and molecular motif, providing strong support for subsequent drug analysis and applications.
[0066] After k layers of propagation, the output of the last layer is taken as the final drug embedding. The final embeddings of all drugs are stacked row-wise to form an embedding table. That is, drug characterization, in which Let v be the total number of drugs and v be the embedding dimension.
[0067] Optional, drug embedding The training process is also constrained by drug interaction losses (DDIs), which keep interacting drugs far apart in the representation space, thus ensuring that the embedding table contains drug interaction information. This embedding table is then used as input to the drug recommendation module, which fuses it with the user representation module to generate recommendation probabilities.
[0068] Specifically, a key issue in the drug recommendation process of this embodiment is ensuring the safety of the recommended drugs, especially considering potential drug interactions (DDIs). Adverse drug interactions are an important issue in personalized medicine; therefore, a DDI loss is explicitly incorporated into the training objective. To mitigate such risks, DDI losses As shown in the formula below: in, Indicates drug and The known degree of interaction between them and They represent drugs and Recommended to users The loss function predicts the recommended probability value. It ensures that drug combinations with known dangerous interactions are penalized, thereby reducing unsafe drug recommendations.
[0069] The above process uses a graph attention network to process drug features, outputting local representations of drug substructures and mining local structural and attribute information to provide basic elements for constructing a heterogeneous graph. Based on these local representations, a heterogeneous graph is constructed to clarify the relationship between drug attributes and molecular motifs, presenting the complex chemical information of the drug in a visually intuitive graph structure, facilitating the model's understanding of the drug's intrinsic connections. Multi-layer message propagation allows nodes to aggregate more information, and stacking operations enhance the model's learning depth of drug features. Ultimately, the drug embedding integrates multifaceted drug information, generating a comprehensive and accurate drug characterization.
[0070] S140, the user representation and the drug representation are input into a pre-constructed feedforward neural network, and the fusion feature between the drug and the user is output.
[0071] In this embodiment, the pre-user representation and the drug representation are simultaneously input into a pre-constructed feedforward neural network. The two representations are integrated into a vector containing comprehensive information about the user and the drug, and a fusion feature vector that can comprehensively reflect the potential relationship and interaction between the drug and the user is output.
[0072] In one embodiment of this application, the user representation and the drug representation are input into a pre-constructed feedforward neural network to output a fusion feature between the drug and the user, including: Based on the artificial neural network structure, a feedforward neural network is constructed. The user representation and the drug representation are input into the feedforward neural network, and the fusion feature between the drug and the user is output.
[0073] In this embodiment, a feedforward neural network (FNN) is constructed based on an artificial neural network structure. It propagates information unidirectionally layer by layer, consisting of an input layer, several hidden layers, and an output layer. Each layer contains multiple neurons, and layers are fully connected by weights, but neurons within the same layer are not connected. Its workflow consists of two steps: First, data enters from the input layer, undergoes weighted summation and transformation by a non-linear activation function, and is then propagated layer by layer to the output layer, generating a prediction result—this process is called forward propagation. Then, by calculating the error between the output result and the true label, the weight parameters in the network are adjusted layer by layer from the output layer to the input layer using the backpropagation algorithm (i.e., the chain rule). Through continuous iteration of these two steps, the network learns the complex mapping relationships in the data.
[0074] In this embodiment, user representation and drug characterization As input, a feedforward neural network is applied. To fuse user representations and drug information. The input to this network layer is... The vector obtained by concatenating the embeddings of each drug is output as the fusion feature of that drug. As shown in the formula below: .
[0075] The above process, by constructing a feedforward neural network, provides a suitable model structure for fusing user and drug characterizations, ensuring effective processing of input data and output of fused features. The feedforward neural network integrates user and drug characterizations, uncovering their potential correlations and interactions to generate fused features, providing a more comprehensive and accurate basis for drug recommendations.
[0076] S150, the fusion features are used to generate probabilities through an activation function, and recommendation information is generated based on the target drugs corresponding to the probabilities.
[0077] In this embodiment, the fused features are input into an activation function for processing. The activation function performs a non-linear transformation on the fused features based on the numerical values of each dimension, mapping the original values to a specific probability interval, thereby generating a set of probability values. These probability values reflect the likelihood of different target drugs matching the user. Then, the target drugs are sorted in descending order of probability values, and drugs with higher probability values and greater matching likelihood are selected. These drugs are then combined with a pre-set recommendation information template, and their relevant information, such as name, efficacy, and applicable symptoms, is filled into the template to ultimately generate personalized drug recommendation information for the user.
[0078] In one embodiment of this application, the fusion features are used to generate probabilities through an activation function, and recommendation information is generated based on the target drugs corresponding to the probabilities, including: The fusion features are used to generate the probability of each drug appearing in the prescription through an activation function; Recommendation information is generated based on the target probability greater than a set threshold; The recommendation information is sent to the user's terminal.
[0079] In one embodiment of this application, after generating the fused features, the fused features are input into a fully connected layer and a sigmoid activation function is used, as shown in the following formula: In the above formula, This represents the probability of each drug appearing in a prescription.
[0080] After that, select For drugs with a median value greater than a predefined threshold, a prediction result vector is generated based on the drug identifier. In this way, MoTRA-NET can more accurately capture the interaction between a user's health status and drug function, thereby improving the accuracy of recommendations.
[0081] Furthermore, to ensure the high performance and stability of the MoTRA-Net model in the drug recommendation task, an advanced training and optimization strategy was adopted. This includes detailed selection strategies for the loss function and optimization methods, as well as extensive experimental validation to verify the model's robustness.
[0082] First, in the multi-label classification loss, the recommendation task is treated as a multi-label classification task. Since multi-label classification involves predicting multiple drug labels for a given user, two common multi-label classification loss functions are used: binary cross-entropy loss (BCE) and multi-margin loss. Binary cross-entropy loss... The definition is shown in the following formula: in, Indicates drug For users The true label (0 or 1). This represents the predicted probability that a drug will be recommended to a user.
[0083] In this embodiment, multi-label edge loss The model's discriminative ability is enhanced by maximizing the score difference between positive and negative samples, as defined in the following formula: Where p iterates through all drugs with a true positive value, and q iterates through all drugs with a true negative value; This represents the true label (0 or 1) of drug p for user i. This represents the true label of drug q for user i; and They represent drugs and Recommended to users The predicted probability. Multi-margin loss encourages the model to predict the probability of a positive drug higher than that of a negative drug by at least one margin (here, the margin is set to 1), thereby improving the orthodoxy of the recommendations.
[0084] Furthermore, to effectively integrate multi-label classification loss and DDI loss, a combined loss function is proposed. This combined loss is achieved through hyperparameters. To control the relative importance of classification loss and DDI loss, the following formula is used: in, and These are hyperparameters used to adjust the weights of different components of the loss function. The weights of the multi-label classification task were controlled, and The weights for ensuring DDI security were adjusted. Experiments explored the trade-off between accuracy and security, and the results showed that optimization... and This can significantly improve the accuracy of recommendations and drug safety.
[0085] Furthermore, since the DDI loss may dominate the model during training, leading to poor performance on multi-label classification tasks, a dynamic adjustment mechanism is proposed to gradually reduce the weight of the DDI loss during training, allowing the model to focus more on improving prediction accuracy. Specifically, a dynamic weighting mechanism is defined. The adjustment strategy is shown in the following formula: in, This is the current DDI rate. It is a threshold parameter. This is a hyperparameter that controls the adjustment rate. When the DDI rate is low, the model prioritizes improving the accuracy of multi-label tasks; when the DDI rate increases, it can be adjusted... This allows for a greater focus on ensuring drug safety. This dynamic adjustment mechanism enables the model to effectively balance accuracy and safety.
[0086] The above process maps the fused features to the probability of each drug's appearance through an activation function, quantifying the degree of drug-user matching and providing an intuitive and comparable indicator for recommendations. Based on a set threshold, target probabilities are filtered to generate recommendation information, highlighting the drugs most likely suitable for the user, thus improving the targeting and practicality of recommendations. The recommendation information is then sent to the user's terminal, providing timely personalized drug suggestions, facilitating access to medical services, and enhancing the user experience.
[0087] For example, in embodiments related to brain diseases, for patients with chronic brain diseases such as epilepsy, Alzheimer's disease, or Parkinson's disease who require long-term medication monitoring, diagnostic features such as EEG, neuroimaging, and cognitive assessment scales from multiple visits, as well as procedural features such as neuromodulation therapy and rehabilitation training, can be extracted from their electronic health records. A GRU network in the dynamic user representation module can capture short-term temporal changes in the frequency of seizures or cognitive decline, and a Transformer network can be used to model global dependencies in the long-term disease course, generating a user representation that accurately reflects the progression of the brain disease. Simultaneously, the molecular features of brain disease treatment drugs such as antiepileptic drugs and cholinesterase inhibitors are input into a graph attention network to construct an isomorphic graph between drug atoms and functional motifs (such as benzene rings and carboxyl groups). Message propagation is used to mine the influence of molecular structure on blood-brain barrier penetration or receptor selectivity, generating a drug representation rich in pharmacological information. Subsequently, the user representation and drug representation are input into a feedforward neural network and fused to output the applicability probability of each drug for the current brain symptoms, ultimately generating a personalized recommendation plan to provide medication suggestions that balance efficacy and neurological safety for complex brain diseases.
[0088] During validation, the MIMIC-III (Medical Information Mart for IntensiveCare III) dataset was used as the experimental dataset. This dataset contains electronic health records (EHRs) of adult users in the Intensive Care Unit (ICU) of Beth Israel Deaconess Medical Center in the United States from 2001 to 2012. The MIMIC-III dataset includes data from approximately 40,000 users, covering more than 60,000 hospitalization records. Each user's EHR data includes clinical diagnosis, laboratory test results, medication records, progress notes, vital signs, and other information. Diagnostic and procedural information is annotated based on the ICD-9 (International Classification of Diseases, Ninth Revision) coding system. The dataset also includes users' demographic information, such as age, sex, and ethnicity.
[0089] In terms of data preprocessing, the MIMIC-III data were standardized, incomplete or erroneous data records were removed, and relevant clinical information was extracted according to research needs. The data was divided into training, validation, and test sets in a ratio of 8:1:1. Because the MIMIC-III dataset is completely anonymized and all data access has undergone privacy protection measures and ethical approval, data security and privacy protection during the research process can be guaranteed.
[0090] To investigate the effectiveness of MoTRA-Net under different numbers of medical visits, user B was selected as the research subject. User B had 4 medical visit records. Simultaneously, four models—GAMENet, MoleRec, DEPOT, and MoTRA-Net—were introduced for drug recommendation. GAMENet integrates a Drug Interaction (DDI) knowledge graph into its memory module using a Graph Convolutional Network (GCN) and uses the user's longitudinal historical records as queries to achieve safe and personalized drug combination recommendations. MoleRec employs substructure-aware molecular representation learning, improving the accuracy and safety of recommendations by modeling the interactions between drug substructures and the correlation between substructures and the user's condition. DEPOT, from a motif-aware perspective, divides drug molecules into semantic motif trees through chemical decomposition and uses a structure-aware graph transformer to capture the collaborative relationships between motifs, thereby deeply exploring the impact of motifs on drug efficacy.
[0091] The results are as follows Figures 3-6 As shown, the horizontal axis represents the number of recommended drugs, "Correct" indicates drugs that were accurately predicted, "Missed" refers to drugs that existed in the actual prescription but were not predicted by the model, and "Unseen" indicates drugs predicted by the model but not present in the actual prescription. Figures 3-6 As can be seen, MoTRA-Net still maintained high performance when dealing with user B with a rich medical history. This indicates that the model can be applied to different user characteristics, and also proves that the MoTRA model can effectively handle complex conditions, achieving an excellent balance between "accuracy" and "safety", providing strong data support for its widespread application in real medical scenarios.
[0092] Based on the above experimental results, this application proposes a drug recommendation model, MoTRA-Net, based on an attention mechanism, aiming to improve the accuracy and safety of recommendations. This model introduces a dynamic modeling method for user health status based on an attention mechanism to capture real-time changes in the patient's condition; simultaneously, it utilizes a graph neural network (GNN) to model the key motif structures of drug molecules, enhancing the representation of drug features. By designing a hybrid encoder that integrates two types of attention mechanisms, it effectively combines heterogeneous information from users and drugs. Experimental results on the MIMIC-III dataset show that the proposed model outperforms the comparison model in several metrics: compared to the 4SDrug model, the Jaccard coefficient is improved by 5.38%, and the F1 score by 5.88%; compared to the GAMENet model, the Jaccard coefficient is improved by 2.78%, and the F1 score by 3.68%. Furthermore, it achieves the lowest DDI rate, thus improving safety.
[0093] The following describes embodiments of the drug recommendation device based on drug representation and user dynamic modeling of this application, which can be used to execute the drug recommendation method based on drug representation and user dynamic modeling in the above embodiments of this application. It is understood that the drug recommendation device based on drug representation and user dynamic modeling can be a computer program (including program code) running on a computer device. For example, the drug recommendation device based on drug representation and user dynamic modeling can install application software to achieve cloud computing of big data through an industrial cloud platform. The drug recommendation device based on drug representation and user dynamic modeling can be used to execute the corresponding steps in the method provided in the embodiments of this application. For details not disclosed in the embodiments of the drug recommendation device based on drug representation and user dynamic modeling of this application, please refer to the embodiments of the drug recommendation method based on drug representation and user dynamic modeling of this application described above.
[0094] Figure 7 A block diagram of a drug recommendation device based on drug representation and user dynamic modeling according to an embodiment of this application is shown.
[0095] Reference Figure 3 As shown, a drug recommendation device based on drug representation and user dynamic modeling according to an embodiment of this application includes: Feature module 310 is used to generate user features based on the acquired user's historical health records and current health status, the user features including diagnostic features, program features and drug features; User module 320 is used to input the diagnostic features and the program features into the GRU network and the Transformer network respectively in sequence, and generate user representations through dynamic modeling. Drug module 330 is used to input the drug features into a pre-constructed graph attention network to construct a heterogeneous graph between drug properties and molecular motifs, and generate drug characterization by performing message propagation and stacking on the heterogeneous graph; The fusion module 340 is used to input the user representation and the drug representation into a pre-constructed feedforward neural network and output the fusion feature between the drug and the user. The recommendation module 350 is used to generate probabilities from the fused features through an activation function, and generate recommendation information based on the target drugs corresponding to the probabilities.
[0096] In this application, based on the aforementioned scheme, the step of generating user features based on the acquired user's historical health records and current health status includes: acquiring the user's historical health records and current health status; extracting user features from the historical health records and current health status, wherein the user features include diagnostic features, program features, and drug features.
[0097] In this application, based on the aforementioned scheme, the step of sequentially inputting the diagnostic features and the program features into a GRU network and a Transformer network, respectively, and generating a user representation through dynamic modeling includes: weighting the diagnostic features to generate weight features; inputting the weight features into the GRU network and the Transformer network, respectively, and outputting the GRU hidden state and the first layer output of the Transformer; inputting the GRU hidden state and the first layer output into an encoder to generate a diagnostic representation; synchronously processing the program features in the above manner to generate a program representation corresponding to the program features; and fusing the diagnostic representation and the program representation to generate a user representation.
[0098] In this application, based on the aforementioned scheme, the step of generating weighted features by weighting the diagnostic features includes: extracting current diagnostic features from the current health status; generating weights corresponding to the diagnostic features of the user when predicting the number of medical visits based on the current diagnostic features; and weighting the diagnostic features using the weights to generate weighted features.
[0099] In this application, based on the aforementioned scheme, the step of inputting the drug features into a pre-constructed graph attention network to construct a heterogeneous graph between drug properties and molecular motifs, and generating a drug characterization by performing message propagation and stacking on the heterogeneous graph, includes: inputting the drug features into a pre-constructed graph attention network and outputting local representations of at least two drug substructures; constructing a heterogeneous graph between drug properties and molecular motifs based on the local representations; performing multi-layer message propagation on the heterogeneous graph and taking the output of the last layer as the final drug embedding; and stacking the final drug embeddings of all drugs row by row to generate a drug characterization.
[0100] In this application, based on the aforementioned scheme, the step of inputting the user representation and the drug representation into a pre-constructed feedforward neural network and outputting the fusion feature between the drug and the user includes: constructing a feedforward neural network based on an artificial neural network structure; inputting the user representation and the drug representation into the feedforward neural network and outputting the fusion feature between the drug and the user.
[0101] In this application, based on the aforementioned scheme, the step of generating probabilities from the fusion features through an activation function and generating recommendation information based on the target drugs corresponding to the probabilities includes: generating the probability of each drug appearing in the prescription through an activation function from the fusion features; generating recommendation information based on target probabilities greater than a set threshold; and sending the recommendation information to the user terminal.
[0102] In one embodiment of this application, the drug recommendation method based on drug representation and user dynamic modeling can be deployed, either entirely or partially, on a neural processing unit (NPU) or field-programmable gate array (FPGA) chip specifically designed for medical edge computing. The intelligent chip first uses a hardware-accelerated parallel computing architecture to receive and process encrypted historical health records and current health status transmitted from wearable devices or hospital information systems in real time. Data cleaning and feature extraction are performed internally to generate diagnostic, procedural, and drug features. Subsequently, pre-installed GRU and Transformer hardware cores on the chip dynamically model the diagnostic and procedural features in a pipelined manner, utilizing the high-bandwidth on-chip memory to quickly access the user's time sequence. The system generates user representations from patient visit data. Simultaneously, a dedicated graph attention network acceleration engine processes drug features in parallel, constructing a heterogeneous graph of drug attributes and molecular motifs through an on-chip network. Multi-layer message propagation and stacking are completed at the hardware level to generate drug representations. Finally, a feedforward neural network hardware unit deeply integrates user and drug representations, generating recommendation probabilities through an activation function. A built-in security encryption module pushes the recommended drug information to the doctor's workstation or user terminal in real time. By integrating this recommendation method at the smart chip level, millisecond-level end-to-end inference latency is achieved, and offline medical scenarios are supported with low power consumption. This provides safe, accurate, and privacy-protected localized drug recommendation decisions for remote areas or emergency environments.
[0103] This application's technical solution generates user features based on the acquired user's historical health records and current health status. These user features include diagnostic features, program features, and drug features. The diagnostic and program features are sequentially input into a GRU network and a Transformer network, respectively, to generate user representations through dynamic modeling. The drug features are input into a pre-constructed graph attention network to construct a heterogeneous graph between drug attributes and molecular motifs. Message propagation and stacking are performed on this heterogeneous graph to generate drug representations. The user representation and drug representation are then input into a pre-constructed feedforward neural network, outputting a fusion feature between the drug and the user. The fusion feature is used to generate probabilities through an activation function, and recommendation information is generated based on the target drugs corresponding to these probabilities. This approach integrates the user's historical health records and current status to generate comprehensive user features. It utilizes GRU and Transformer networks for dynamic modeling to generate accurate user representations and a graph attention network to generate drug representations. The two are then input into a feedforward neural network for fusion, finally generating probabilities and recommending drugs. This method accurately matches user health needs and provides personalized and effective drug recommendations.
[0104] Figure 8 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown.
[0105] It should be noted that the computer system of the electronic device in this embodiment is only an example and should not impose any limitations on the function and scope of use of the embodiments of this application.
[0106] In this embodiment, the computer system includes a central processing unit 401, which can perform various appropriate actions and processes based on programs stored in read-only memory 402 or programs loaded from storage section 408 into random access memory 403, such as executing the drug recommendation method based on drug representation and user dynamic modeling described in the above embodiment. The random access memory 403 also stores various programs and data required for system operation, thereby realizing big data storage and big data management. The central processing unit 401, read-only memory 402, and random access memory 403 are interconnected via bus 404. Input / output interface 405 is also connected to bus 404.
[0107] The following components are connected to the input / output interface 405: an input section 406 including a keyboard, mouse, etc.; an output section 407 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the input / output interface 405 as needed. A removable medium 411, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 410 as needed so that computer programs read from it can be installed into the storage section 408 as needed.
[0108] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 409, and / or installed from removable medium 411. When the computer program is executed by central processing unit 401, it performs various functions defined in the system of this application.
[0109] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0110] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0111] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0112] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various alternative implementations described above.
[0113] In another aspect, this application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to implement the drug recommendation method based on drug representation and user dynamic modeling described in the above embodiments.
[0114] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0115] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the methods according to the embodiments of this application.
[0116] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0117] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A drug recommendation method based on dynamic modeling of drug representation and user, characterized in that, The method comprises the following steps: generating user features based on the obtained historical health records and current health status of the user, the user features including diagnosis features, procedure features, and drug features; inputting the diagnosis features and the procedure features into GRU networks and Transformer networks respectively in sequence to generate user representations through dynamic modeling; inputting the drug features into a pre-constructed graph attention network to construct a heterogeneous graph between drug attributes and molecular motifs, and generating drug representations through message propagation and stacking on the heterogeneous graph; inputting the user representations and the drug representations into a pre-constructed feedforward neural network to output fusion features between drugs and users; generating probabilities through an activation function based on the fusion features, and generating recommendation information based on target drugs corresponding to the probabilities.
2. The method of claim 1, wherein the method is based on a drug representation and user dynamics modeling. Generating user features based on the obtained historical health records and current health status of the user, comprising: obtaining the historical health records and current health status of the user; extracting user features from the historical health records and current health status, the user features including diagnosis features, procedure features, and drug features. 3.The method of claim 1, wherein, Inputting the diagnosis features and the procedure features into GRU networks and Transformer networks respectively in sequence to generate user representations through dynamic modeling, comprising: performing weighted processing on the diagnosis features to generate weight features, and inputting the weight features into GRU networks and Transformer networks respectively to output GRU hidden states and the first layer output of Transformer respectively; inputting the GRU hidden states and the first layer output into an encoder to generate diagnosis representations; synchronously processing the procedure features in the above manner to generate procedure representations corresponding to the procedure features; fusing the diagnosis representations and the procedure representations to generate user representations.
4. The method of claim 3, wherein the drug recommendation is based on a drug representation and user dynamics modeling. Performing weighted processing on the diagnosis features to generate weight features, comprising: extracting current diagnosis features from the current health status; based on the current diagnosis features, generating weights corresponding to the diagnosis features of the user when predicting the number of visits; performing weighted processing on the diagnosis features through the weights to generate weight features.
5. The method for drug recommendation based on dynamic modeling of drug representation and user according to claim 1, wherein, Inputting the drug features into a pre-constructed graph attention network to construct a heterogeneous graph between drug attributes and molecular motifs, and generating drug representations through message propagation and stacking on the heterogeneous graph, comprising: inputting the drug features into a pre-constructed graph attention network to output local representations of at least two drug substructures; based on the local representations, constructing a heterogeneous graph between drug attributes and molecular motifs; performing multi-layer message propagation on the heterogeneous graph, and taking the output of the last layer as the final drug embedding; stacking the final drug embeddings of all drugs in rows to generate drug representations. 6.The drug recommendation method based on dynamic modeling of drug representation and user according to claim 1, wherein, Inputting the user representations and the drug representations into a pre-constructed feedforward neural network to output fusion features between drugs and users, comprising: based on an artificial neural network structure, constructing a feedforward neural network; inputting the user representations and the drug representations into the feedforward neural network to output fusion features between drugs and users.
7. The method of claim 1, wherein the method further comprises: generate a probability of each drug appearing in the prescription by an activation function on the fusion feature; generate a recommendation information based on a target probability greater than a set threshold; send the recommendation information to a user terminal. comprise:
8. A drug recommendation apparatus based on dynamic modeling of drug representations and users, characterized by, a feature module configured to generate user features based on the obtained historical health records and current health status of the user, the user features comprising diagnosis features, procedure features, and drug features; a user module configured to input the diagnosis features and the procedure features into a GRU network and a Transformer network respectively in sequence, and generate user representations by dynamic modeling; a drug module configured to input the drug features into a pre-constructed graph attention network, construct a heterogeneous graph between drug attributes and molecular motifs, and generate drug representations by message propagation and stacking on the heterogeneous graph; a fusion module configured to input the user representations and the drug representations into a pre-constructed feedforward neural network, and output fusion features between drugs and users; a recommendation module configured to generate a probability by an activation function on the fusion features, and generate a recommendation information based on a target drug corresponding to the probability. The computer program, when executed by a processor, implements the drug recommendation method based on drug representation and user dynamic modeling according to any one of claims 1 to 7.
9. A computer readable medium having stored thereon a computer program, characterized in that comprise:
10. An electronic device, comprising: one or more processors; a storage device configured to store one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement the drug recommendation method based on drug representation and user dynamic modeling according to any one of claims 1 to 7.