
==== Front
Brief Bioinform
Brief Bioinform
bib
Briefings in Bioinformatics
1467-5463
1477-4054
Oxford University Press

10.1093/bib/bbae464
bbae464
Review
AcademicSubjects/SCI01060
DrugDoctor: enhancing drug recommendation in cold-start scenario via visit-level representation learning and training
Kuang Yabin College of Information Science and Engineering, Hunan Normal University, 36 Lushan Road, Yuelu District, Changsha 410081, China

Xie Minzhu College of Information Science and Engineering, Hunan Normal University, 36 Lushan Road, Yuelu District, Changsha 410081, China
Key Laboratory of Computing and Stochastic Mathematics (Ministry of Education), Changsha 410081, China
College of Mathematics and Statistics, Hunan Normal University, 36 Lushan Road, Yuelu District, Changsha 410081, China

Corresponding author. College of Information Science and Engineering and College of Mathematics and Statistics, Hunan Normal University, 36 Lushan Road, Yuelu District, Changsha 410081, China. E-mail: xieminzhu@hunnu.edu.cn
11 2024
23 9 2024
23 9 2024
25 6 bbae46422 5 2024
13 8 2024
05 9 2024
© The Author(s) 2024. Published by Oxford University Press.
2024
https://creativecommons.org/licenses/by/4.0/ This is an Open Access article distributed under the terms of the Creative Commons Attribution License (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted reuse, distribution, and reproduction in any medium, provided the original work is properly cited.

Abstract

Medication recommendation is a crucial application of artificial intelligence in healthcare. Current methodologies mostly depend on patient-level longitudinal representation, which utilizes the entirety of historical electronic health records for making predictions. However, they tend to overlook a few key elements: (1) The need to analyze the impact of past medications on previous conditions. (2) Similarity in patient visits is more common than similarity in the complete medical histories of patients. (3) It is difficult to accurately represent patient-level longitudinal data due to the varying numbers of visits. To our knowledge, current models face difficulties in dealing with initial patient visits (i.e. in cold-start scenarios) which are common in clinical practice. This paper introduces DrugDoctor, an innovative drug recommendation model crafted to emulate the decision-making mechanics of human doctors. Unlike previous methods, DrugDoctor explores the visit-level relationship between prescriptions and diseases while considering the impact of past prescriptions on the patient’s condition to provide more accurate recommendations. We design a plug-and-play block to effectively capture drug substructure-aware disease information and effectiveness-aware medication information, employing cross-attention and multi-head self-attention mechanisms. Furthermore, DrugDoctor adopts a fundamentally new visit-level training strategy, aligning more closely with the practices of doctors. Extensive experiments conducted on the MIMIC-III and MIMIC-IV datasets demonstrate that DrugDoctor outperforms 10 other state-of-the-art methods in terms of Jaccard, F1-score, and PRAUC. Moreover, DrugDoctor exhibits strong robustness in handling patients with varying numbers of visits and effectively tackles “cold-start” issues in medication combination recommendations.

medication recommendation
electronic health record
recommendation system
National Natural Science Foundation of China 10.13039/501100001809 62172028 61772197
==== Body
pmcIntroduction

The increasing availability of comprehensive health data, such as electronic health records (EHRs), has paved the way for predictive models in clinical decision-making [1–3]. The recommendation of effective and safe medication combinations plays a crucial role in providing appropriate and effective treatment decisions for patients with multiple diseases. Extensive research efforts have been dedicated to the field of medication recommendation [4–9]. Existing methods can be divided into three types: rule-based methods, instance-based methods, and longitudinal methods.

Rule-based methods use predefined rules designed by medical experts to guide the recommendation process [10, 11]. For instance, Chen et al. [11] utilized knowledge patterns to code the clinical guidelines for chronic diseases, which serve as rules for medication recommendation. However, rule-based methods heavily rely on expert knowledge and lack generalization capabilities. Instance-based methods focus primarily on the patient’s current health status. LEAP [12] treats the recommendation as a sequential decision-making process. It leverages attention mechanisms to capture dependencies between medication labels in the current visit, and then automatically determines the appropriate medication combinations. Instance-based methods may suffer from lower accuracy due to the insufficient usage of historical visit data.

To overcome this limitation, longitudinal methods incorporate the patient’s historical health records to obtain a more comprehensive understanding of patients’ conditions. Among them, GAMENet [13], SafeDrug [14], and MoleRec [15] utilize Dual-RNN modules to learn patients’ representations from their historical diagnoses and procedure data. However, they all ignore the value of historically prescribed medication information. COGNet [16] develops a novel copy-or-predict mechanism to decide whether to copy a medicine from previous recommendations or to predict a new one. COGNet demonstrates the relevance of historical medications to current prediction. More recently, SHAPE [17] investigates the relationship within the medical events using a compact intra-visit set encoder. It then employs a soft curriculum learning method and makes predictions based on the patient-level representation learned by an inter-visit longitudinal encoder.

Although previous works have shown promising results, they still face two critical limitations: (1) Challenges in the cold-start scenario: These models typically rely on patient-level representation derived from the entire historical diagnosis and procedure information of a specific patient. However, similarities among patients may only be evident in certain individual visits rather than across their complete medical histories. As a result, methods based on patient-level representation may not effectively capture the associations between diseases and drugs at the visit level. It means that they hardly generalize known prescription results at the visit level to similar conditions of other patients. Consequently, their predictive performance and application scenarios are limited, particularly when dealing with new patients. (2) Insufficient utilization of historical prescription information: Existing methods often focus on using historical diagnosis and procedure information for historical representation, overlooking the impact of historical prescriptions on the patient’s condition. However, it is necessary to recognize that a patient’s current health condition is commonly related to the last treatments, following the administration of previously prescribed medications.

In clinical practice, the prescription process of doctors for patients typically involves the following steps:

Initially, the doctor evaluates the patient’s health condition based on the diagnosis and procedure information of the current visit. They also consider similar cases they have encountered before (according to their professional experience) to provide an initial prescription.

Subsequently, the doctor takes into account the patient’s previous prescriptions and the effectiveness of medications in improving the patient’s condition. By incorporating this information, doctors determine the most suitable prescription or combination of medications for the patient’s current visit.

Motivated by this process, we developed a visit-level model named DrugDoctor to address the aforementioned limitations. DrugDoctor focused on extracting correlation information between diseases and drugs prescribed by doctors at the visit level while also investigating the impact of historical medications on the patient’s condition. Specifically, transformer-based encoders were introduced to explore the intrinsic relationship within different medical information. A plug-and-play block named CA-MHSA was proposed to extract information with specific awareness, which incorporates cross-attention and multi-head self-attention mechanisms. We utilized the medication substructure information extracted by a graph neural network as a query to the CA-MHSA block to explore the associations between diseases and medications in the current visit. Additionally, we employed a recurrent neural network and another CA-MHSA block to determine the contributions of historical medications to the present prediction. Different from previous works, to better align with the real-world workflow of doctors, we trained the model in a visit-by-visit manner. The experiments conducted on several widely used datasets showed that DrugDoctor outperformed 10 state-of-the-art methods, especially in the challenging cold-start scenario.

Problem formulation

 

0.1 Electronic health records

EHRs are digitally stored and managed personal health information, aiming at providing centralized access and improved decision support. Formally, EHR for patient \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $i$\end{document} can be represented as a time-based sequence \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $V_{i}=[v_{i}^{(1)},v_{i}^{(2)},\ldots ,v_{i}^{(N_{i})}]$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $v_{i}^{(t)}$\end{document} represents the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $t$\end{document}th visit of patient \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $i$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $N_{i}$\end{document} is the total number of visits of patient \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $i$\end{document}. We omit the patient index \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $i$\end{document} to simplify the notation if there is no confusion. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $v^{(t)}$\end{document} consists of \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{D}^{(t)}, \mathcal{P}^{(t)}$\end{document}, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{M}^{(t)} $\end{document}, which are, respectively, the set of diagnosis, procedures, and medications that appeared in \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $t$\end{document}th visit. It can be further denoted as a concatenation of multi-hot vectors \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $v_{}^{(t)}=[\mathbf{d}_{}^{(t)},\mathbf{p}_{}^{(t)},\mathbf{m}_{}^{(t)}]$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{d}_{}^{(t)}\in \{0,1\}^{|\mathcal{D}|},\mathbf{p}_{}^{(t)}\in \{0,1\}^{|\mathcal{P}|},\ and\ \mathbf{m}_{}^{(t)}\in \{0,1\}^{|\mathcal{M}|}$\end{document}. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{D},\mathcal{P},\ and\ \mathcal{M} $\end{document} refer to the set of all appeared diagnoses, procedures, and medications, respectively. Figure 1 described the visit-level EHR data.

Figure 1 The EHR data of a patient consist of a sequence of visits \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $V_{(0)},V_{(1)},...,V_{(t)}$\end{document}; each visit contains a set of medical codes (i.e. the diagnosis code \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{D}^{(t)}$\end{document}, the procedure code \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{P}^{(t)}$\end{document}, and the medication code \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{M}^{(t)}$\end{document}) ; the red box and purple box denote the available information of the current visit and the last visit, respectively,; the green box represents the entire historical prescriptions; \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{M}_{pre}^{(t)}$\end{document} is the predicted medication combinations at current visit.

 

0.2 Known DDI relation matrix

In real-world clinical practice, it is common to encounter drug–drug interactions (DDIs). DDIs can yield both positive and negative outcomes. However, medication recommendation systems must prioritize patient safety by actively managing the DDI rate, particularly when the potential effects of such interactions remain uncertain. This precautionary approach ensures that the recommended drug combinations are as safe as possible. To achieve this, we utilize a symmetric matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{D}\in \{0,1\}^{|\mathcal{M}|\times |\mathcal{M}|}$\end{document} as prior knowledge to describe the known DDI relation between pairs of drugs. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{D}_{ij}=1$\end{document} indicates the presence of an interaction between drug \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $i$\end{document} and drug \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $j$\end{document}.

 

0.3 Medication combination recommendation problem

For a patient, given his current diagnosis \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{D}^{(t)}$\end{document}, procedures \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{P}^{(t)}$\end{document}, historical EHR sequence \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $[v^{(1)},v^{(2)},\ldots ,v^{(t-1)}]$\end{document}, and the DDI relation matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{D}$\end{document}, medication combination recommendation is to recommend an appropriate combination of medications \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{\hat{M}}^{(t)}$\end{document} for the patient.

Methods

As illustrated in Fig. 2, DrugDoctor comprises of three main components: (1) A visit-level representation module that captures the relationship between drugs’ substructures and disease information of the current visit and generates an initial recommendation. (2) A historical visits learning module provides further prediction results by learning all available historical prescriptions and the nearest health condition of the patient after the last administration. (3) A recommendation prediction module calculates the final recommendation results according to the suggestions from the above modules.

Figure 2 An overview of DrugDoctor; (A) visit-level representation module; it provides the preliminary recommendation \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{{m}}_{c}^{(t)}$\end{document} by exploring the disease–medication associations in the current visit; (B) historical visits learning module; it takes all historical prescriptions and the nearest historical diagnosis and procedure information as input and generates the recommendation based on historical visits, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{{m}}_{h}^{(t)}$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{{m}}_{p}^{(t)}$\end{document}; in the end, the final prediction results \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $ {\hat{\mathbf m}}^{(t)}$\end{document} are obtained; the details of our proposed CA-MHSA block are also presented in the picture.

 

0.4 Input representations

We use three learnable embedding tables, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathrm{E}_{d}\in \mathbb{R}^{|\mathcal{D}|\times dim},\mathrm{E}_{p}\in \mathbb{R}^{|\mathcal{P}|\times dim}$\end{document}, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathrm{E}_{m}\in \mathbb{R}^{|\mathcal{M}|\times dim}$\end{document} (corresponding to diagnosis, procedure, and medication, respectively), to project corresponding multi-hot vectors into corresponding embedding spaces. Here, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $dim$\end{document} is the embedding size. Specifically, each row of \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathrm{E}_{d}$\end{document} serves as a unique representation vector corresponding to a specific diagnosis code. For the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $t$\end{document}th visit, when passed through the embedding table \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathrm{E}_{d}$\end{document}, the diagnosis set \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{D}^{(t)}$\end{document} is transformed into diagnosis representation \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{D}_{t}\in \mathbb{R}^{|\mathcal{D}^{(t)}|\times dim}$\end{document}. Similarly, we obtain the representations of procedure set and medication: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{P}_{t}\in \mathbb{R}^{|\mathcal{P}^{(t)}|\times dim}$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{M}_{t}\in \mathbb{R}^{|\mathcal{M}^{(t)}|\times dim}$\end{document}, respectively.

 

0.5 Visit-level representation module

The professional knowledge of doctors is fundamental for prescribing medication to patients. Likewise, in the context of a computational model, it is essential for the model to effectively learn the relationship between diseases and medications. Here, we extract the intrinsic representation of disease information by analyzing the diagnosis and procedure information at the visit level. Usually, there exists a significant correlation between the codes within the diagnosis set (as well as the procedure set).

To capture this intrinsic correlation and obtain more accurate representations, a Transformer-based [18] encoder is introduced to further represent the diagnosis information, which can successfully capture the dependencies between elements in the sequence. To be precise, the encoder consists of two major sub-layers, Multi-head Self-attention layer \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathrm{MH}(\cdot ,\cdot ,\cdot )$\end{document} and Position-wise Feed-Forward Layer \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathrm{FFN}(\cdot )$\end{document}. Residual connections are used around each sub-layer, followed by layer normalization. Formally, the Transformer-based encoder can be defined as

(1) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \begin{aligned} \mathrm{Enc}(\mathbf{X})&=\mathrm{LayerNorm}(\mathbf{H}+\mathrm{FFN}(\mathbf{H}))\\ \text{where H} & =\text{Layer}\mathrm{Norm}(\mathbf{X}+\mathrm{MH}(\mathbf{X},\mathbf{X},\mathbf{X}))\end{aligned}, \end{aligned}\end{align*}\end{document}

where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{X}$\end{document} is the input (e.g. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{D}_{t}$\end{document}). \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathrm{MH}(\cdot ,\cdot ,\cdot )$\end{document} is defined as follows:

(2) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \mathrm{MH}(\mathbf{Q},\mathbf{K},\mathbf{V})=[\mathrm{head}_{1};...;\mathrm{head}_{h}]\mathbf{W}^{O}, \\ \text{head}_{i}=\text{Attention}(\mathbf{QW}_{i}^{Q},\mathbf{KW}_{i}^{K},\mathbf{VW}_{i}^{V}), \end{aligned}\end{align*}\end{document}

where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{W}_{i}^{Q},\mathbf{W}_{i}^{K},\mathbf{W}_{i}^{V}\in \mathbb{R}^{dim\times (dim/h)}\text{ and} \mathbf{W}^{O}\in \mathbb{R}^{dim\times dim}$\end{document} are the learnable parameters. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $h$\end{document} is the number of heads. Attention\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $(\cdot ,\cdot ,\cdot )$\end{document} is calculated as

(3) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \mathrm{Attention}(\mathbf{Q},\mathbf{K},\mathbf{V})=\mathrm{Softmax}\left(\frac{\mathbf{Q}\mathbf{K}^{\top}}{\sqrt{dim}}\right)\mathbf{V}, \end{aligned}\end{align*}\end{document}

where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{Q}\in \mathbb{R}^{n_{q}\times dim},\mathbf{K}\in \mathbb{R}^{n_{k}\times dim},\mathrm{~and~}\mathbf{V}\in \mathbb{R}^{n_{v}\times dim}$\end{document}. Another sub-layer \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathrm{FFN}(\cdot )$\end{document} is comprised of two linear layers separated by a ReLU activation.

(4) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \mathrm{FFN}(\mathbf{H})=\mathrm{ReLU}(\mathbf{HW}_{1}^{F}+\mathbf{b}_{1}^{F})\mathbf{W}_{2}^{F}+\mathbf{b}_{2}^{F}, \end{aligned}\end{align*}\end{document}

where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{W}_{1}^{F}\in \mathbb{R}^{dim\times s},\mathbf{W}_{2}^{F}\in \mathbb{R}^{s\times dim},\mathbf{b}_{1}^{F}\in \mathbb{R}^{s}$\end{document}, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{b}_{2}^{F}\in \mathbb{R}^{dim}$\end{document} are the trainable parameters. According to [18], the inner-layer has dimensionality \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $s=2048$\end{document}.

Given the diagnose and procedure representation in \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $t$\end{document}th visit, the outputs of corresponding encoders can be formulated as follows:

(5) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \mathbf{D}_{t}^{\prime}&=\mathrm{Enc}_{\mathbf{d}}(\mathbf{D}_{t})\\ \mathbf{P}_{t}^{\prime}&=\mathrm{Enc}_{\mathbf{p}}(\mathbf{P}_{t}) \end{aligned}\end{align*}\end{document}

Additionally, the biochemical activity of medications is typically linked to specific molecular substructures, as reported in [19]. Therefore, we believe that analyzing the relationship between the disease and drug substructures can be beneficial for medication recommendation. To obtain drugs’ substructures from their molecules, BRICS [20] method is adopted, which is accessible through the RDKit [21] package.

Since graph isomorphism networks (GIN) [22] have been widely used to learn molecule representation, we introduce a three-layer GIN to encode molecule substructures. Given a molecular substructure graph \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{G}=\{\mathcal{V},\mathcal{E}\}$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{V}$\end{document} is a set of atoms (i.e. nodes) and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{E}$\end{document} is a set of chemical bonds (i.e. edges). For atom \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $v$\end{document}, GIN encoder represents it by aggregating the features of its neighbors, the layer-wise propagation rule is described as follows:

(6) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} b_{v}^{(k)}=\mathrm{MLP}\Bigg(\left(1+\epsilon^{(k)}\right)\cdot b_{v}^{(k-1)}+\sum_{u\in\mathcal{N}(\nu)}b_{u}^{(k-1)}\Bigg),k=1,2,3, \end{aligned}\end{align*}\end{document}

where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\operatorname{MLP}(\cdot )$\end{document} is a multilayer perceptron, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\epsilon ^{(k)}$\end{document} is a learnable parameter, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $b_{v}^{(k)}$\end{document} is the representation of atom \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $v$\end{document} at the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $k$\end{document}th layer, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{N}(\nu )$\end{document} is a set of neighbors of atom \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $v$\end{document}. To obtain a global representation of drug substructure, we adopt global mean-pooling on all-atom representations. Finally, we collect the representation of all drug substructures into a table \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{E}_{drug}$\end{document}.

Moreover, to enhance the prediction performance, we developed a novel CA-MHSA block based on cross-attention and multi-head self-attention mechanisms to obtain disease information with specific awareness. Precisely, CA-MHSA block is defined as follows:

(7) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \text{CA-MHSA}(\mathbf{Q},\mathbf{D},\mathbf{P}) = \mathrm{MH}(\mathbf{CA},\mathbf{CA},\mathbf{CA}) \\ \text{where CA} = [\mathrm{Attention}(\mathbf{Q},\mathbf{D},\mathbf{D}), \mathrm{Attention}(\mathbf{Q},\mathbf{P},\mathbf{P})] \end{aligned},\end{align*}\end{document}

where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{Q},\mathbf{D},\ and\ \mathbf{P}$\end{document} are the inputs of CA-MHSA block, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $[\cdot ]$\end{document} is the concatenate operation. When treating the drug substructures information \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{E}_{drug}$\end{document} as a query, we aim at capturing the drug substructure-aware disease information in the current visit.

(8) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \mathbf{E}_{t}^{\prime} = \text{CA-MHSA}(\mathbf{E}_{drug},\mathbf{D}_{t}^{\prime},\mathbf{P}_{t}^{\prime}) \end{aligned}\end{align*}\end{document}

Then, we concatenate \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{E}_{t}^{\prime }\in \mathbb{R}^{2dim},\mathbf{D}_{t}^{\prime }\in \mathbb{R}^{dim}, \text{ and} \mathbf{P}_{t}^{\prime }\in \mathbb{R}^{dim}$\end{document} into a more compact disease representation in \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $t$\end{document}th visit. Finally, a feed-forward neural network \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathrm{FF_{1}}(\cdot ):\mathbb{R}^{4dim}\mapsto \mathbb{R}^{dim}$\end{document} is applied to generate a preliminary drug recommendation results, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $dim = |\mathcal{M}|$\end{document}.

(9) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \mathbf{{m}}_{c}^{(t)} = \mathrm{FF_{1}}([\mathbf{E}_{t}^{\prime}, \mathbf{D}_{t}^{\prime}, \mathbf{P}_{t}^{\prime}]) \end{aligned}\end{align*}\end{document}

 

0.6 Historical visits learning module

For patients with a history of medical visits, DrugDoctor provides additional drug recommendations based on the following two aspects.

Historical prescription information. In clinical practice, there is a strong correlation in the drug recommendations for the same patients. For instance, patients with chronic diseases often continue using the same medications over their lifetime. It is observed that a significant portion of the prescribed medicines in most visits are repetitive recommendations [16]. Hence, we use the RNN model to learn historical medication records and provide useful recommendations for current visit.

(10) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \mathbf{m}_{h}^{(t)}=\mathrm{RNN}\left(\mathbf{M}_{t-1},\ldots,\mathbf{M}_{0}\right) \end{aligned}\end{align*}\end{document}

For a specific patient, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{m}_{h}^{(t)}$\end{document} is the predicted result based on all historical medication records of this patient.

The effect of medication on condition. In general, a patient’s current state of health is often influenced by the effects of previously prescribed medications on prior conditions. Accordingly, we argue that examining the influence of prior medications on the previous condition is helpful for the current drug predictions. Similarly, we use our proposed CA-MHSA block to fill this task.

(11) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \mathbf{E}_{t-1}^{\prime} = \text{CA-MHSA}(\mathbf{M}_{t-1},\mathbf{D}_{t-1}^{\prime},\mathbf{P}_{t-1}^{\prime}) \end{aligned}\end{align*}\end{document}

To be specific, the prior medication information \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{M}_{t-1}$\end{document} is considered as a query to explore its effect on previous diagnose information \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{D}_{t-1}^{\prime }$\end{document} and procedure information \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{P}_{t-1}^{\prime }$\end{document}, which are encoded by corresponding Transformer-based encoders. And \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{E}_{t-1}^{\prime }$\end{document} represents the effectiveness-aware medications information. Subsequently, we use a \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathrm{FF_{2}}(\cdot ):\mathbb{R}^{3dim}\mapsto \mathbb{R}^{dim}$\end{document} to predict the current drug combination based on the previous medications and its effectiveness.

(12) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \mathbf{{m}}_{p}^{(t)} = \mathrm{FF_{2}}([\mathbf{E}_{t-1}^{\prime}, \mathbf{M}_{t-1}]), \end{aligned}\end{align*}\end{document}

where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{E}_{t-1}^{\prime }\in \mathbb{R}^{2dim}\ and\ \mathbf{M}_{t-1}\in \mathbb{R}^{dim}$\end{document}.

 

0.7 Recommendation prediction module

After obtaining recommendations from various sources, we naturally merged them together to obtain a more comprehensive prescription recommendation.

(13) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} {\hat{\mathbf o}}^{(t)} = \sigma(\mathbf{{m}}_{c}^{(t)}+\mathbf{{m}}_{h}^{(t)}+\mathbf{{m}}_{p}^{(t)}), \end{aligned}\end{align*}\end{document}

where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\sigma (\cdot )$\end{document} is sigmoid function. Every element of \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${\hat{\mathbf o}}^{(t)}$\end{document} denotes an appearance probability of the corresponding drug in \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $t$\end{document}th prescription. Then, by setting a threshold value \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\delta $\end{document}, we can obtain the recommended drug combination by selecting the entries with values greater than \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\delta $\end{document}, represented as a multi-hot vector \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${\hat{\mathbf m}}^{(t)}$\end{document}.

 

0.8 Training and inference

Multiple loss. The recommendation task can be treated as a multi-label classification task. As a result, we select the binary cross-entropy loss as the loss function for the multi-label task.

(14) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \mathcal{L}_{bce}=-\sum_{i=1}^{|\mathcal{M}|}\mathbf{m}_{i}^{(t)}log(\hat{\mathbf{o}}_{i}^{(t)})+(1-\mathbf{m}_{i}^{(t)})log(1-\hat{\mathbf{o}}_{i}^{(t)}), \end{aligned}\end{align*}\end{document}

where subscript represents a drug. Additionally, to control the DDI rate of predicted drug combinations, in line with [14], we defined the DDI loss as

(15) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \mathcal{L}_{ddi}=\sum_{i=1}^{|\mathcal{M}|}\sum_{j=1}^{|\mathcal{M}|}\mathbf{D}_{ij}\cdot\hat{\mathbf{o}}_{i}^{(t)}\cdot\hat{\mathbf{o}}_{j}^{(t)}, \end{aligned}\end{align*}\end{document}

In the end, the overall objective function is defined as the weighted combination of \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{L}_{bce}$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{L}_{ddi}$\end{document}, i.e.

(16) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \mathcal{L}=\mathcal{L}_{bce}+\alpha\mathcal{L}_{ddi}, \end{aligned}\end{align*}\end{document}

where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\alpha $\end{document} is a trade-off parameter to balance the prediction loss and DDI loss.

Training strategy. To our knowledge, the training approaches of previous similar medication recommendation models take the whole information (including the entire medical history) of a individual patient as a training unit. Although these approaches could be effective for individuals with extensive medical histories, their performance may be less robust for new patients with limited medical records, making it challenging to extend known prescription outcomes from one patient to another in the cold-start scenario.

The limited generalization capability can be attributed to the fact that similar medical conditions might only present themselves during specific visits instead of persistently across a patient’s overall health history. Each visit serves as a unique snapshot of a patient’s health condition and corresponding treatment needs, and the efficiency of prescribed medications often varies across different visits. Therefore, relying solely on the overall health state of a patient may fail to accurately capture the specific requirements for medications during individual visits.

To overcome this challenge, it is crucial to develop models and approaches that can effectively capture specific features of each visit, taking into consideration the specific medical conditions and treatment requirements at a specific visit. In real-life situations, the order of visits of different patients is random and overlapping. We believe that training the model visit-by-visit is more in line with the practices of doctors.

Based on these insights, we have implemented a fundamentally new training strategy for our model. Given a set of patients, we generate a random sequence of all visits of the patients while preserving the chronological order of each patient’s visits. In essence, the targeted sequence of visits is globally unordered, but the relative order of visits from an identical patient remains unchanged.

DrugDoctor is trained end-to-end with a manner of visit-by-visit, and all the learnable parameters would be optimized. During the inference phase, the model operates following the same pipeline as training. To obtain the recommended drug combination, the threshold value \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\delta $\end{document} is set to \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $0.4$\end{document} on the output drug representation \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${\hat{\mathbf o}}^{(t)}$\end{document} in Eqn. (13). By focusing on the visit-level information, it becomes possible to make more accurate and personalized medication recommendations, even for new patients with limited historical data.

 

0.9 Dataset and metrics

To validate the effectiveness of DrugDoctor, we collected 15 032 hospital admissions records of 6350 patients from MIMIC-III [23] and 23 525 hospital admissions records of 9862 patients from MIMIC-IV [24]. In line with [14], we processed the patients’ EHR data and presented the corresponding statistics in Table 1. Each dataset was typically divided into training, validation, and testing sets using a \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $ 4:1:1 $\end{document} ratio. To achieve visit-level training, each patient set was transformed into targeted visit sequences, which served as the inputs for the model.

Table 1 Dataset statistics

	MIMIC-III	MIMIC-IV	
# patients	6350	9862	
# visits	15 032	23 525	
# diagnoses	1958	1999	
# procedures	1430	1800	
# medicines	112	114	
Avg/max # of visits	2.37/29	2.39/66	
Avg/max # of diagnoses	10.51/128	8.05/170	
Avg/max # of procedures	3.84/50	2.29/41	
Avg/max # of medicines	11.65/64	7.67/60	
Total # of DDI pairs	448	448	
Total # of substructures	491	491	

Four common metrics are employed to evaluate the performance: DDI rate, Jaccard Similarity Score (Jaccard), F1-score, and Precision-Recall Area Under Curve (PRAUC). The DDI rate measures the safety of predicted drug combinations and another three metrics are used for evaluating the recommendation efficacy. The detailed definitions of each metric are presented as follows:

(17) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \begin{aligned} \mathrm{DDI}=\frac{1}{N}\sum_{t=1}^{N}\frac{\sum_{i=1}^{|\hat{\mathcal{M}}^{(t)}|}\sum_{j=i+1}^{|\hat{\mathcal{M}}^{(t)}|}\mathbf{1}\{\mathbf{D}[\hat{\mathcal{M}}_{i}^{(t)},\hat{\mathcal{M}}_{j}^{(t)}]=1\}}{\sum_{i=1}^{|\hat{\mathcal{M}}^{(t)}|}\sum_{j=i+1}^{|\hat{\mathcal{M}}^{(t)}|}1}, \end{aligned} \end{aligned}\end{align*}\end{document}

where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $N$\end{document} is the total number of visits of the patient and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{D}$\end{document} is the known DDI relation matrix. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\hat{\mathcal{M}}_{i}^{(t)}$\end{document} denotes the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $i$\end{document}th recommended drug in \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $t$\end{document}th visit. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathbf{1}\{\cdot \}$\end{document} is 1 when \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\{\cdot \}$\end{document} is true, otherwise is 0. The Jaccard for the patient is calculated as follows:

(18) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \begin{aligned} \text{Jaccard}=\frac1{N}\sum_{t=1}^{N}\frac{|\mathcal{M}^{(t)}\cap\hat{\mathcal{M}}^{(t)}|}{|\mathcal{M}^{(t)}\cup\hat{\mathcal{M}}^{(t)}|}, \end{aligned} \end{aligned}\end{align*}\end{document}

where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{M}^{(t)}$\end{document} is the ground-truth medications set in \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $t$\end{document}th visit and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\hat{\mathcal{M}}^{(t)}$\end{document} is the predicted result. The F1 of the patient is calculated as follows:

(19) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*} & \begin{aligned} \begin{aligned} \text{Precision}_{\text{t}}=\frac{|\mathcal{M}^{(t)}\cap\hat{\mathcal{M}}^{(t)}|}{|\hat{\mathcal{M}}^{(t)}|} \end{aligned} \end{aligned} \end{align*}\end{document}

(20) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*} & \begin{aligned} \begin{aligned} \text{Recall}_{\text{t}} =\frac{|\mathcal{M}^{(t)}\cap\hat{\mathcal{M}}^{(t)}|}{|\mathcal{M}^{(t)}|} \end{aligned} \end{aligned} \end{align*}\end{document}

(21) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*} & \begin{aligned} \begin{aligned} &\mathrm{F1}=\frac1N\sum_{t=1}^{N}2*\frac{\mathrm{Precision_{t}*Recall_{t}}}{\mathrm{Precision_{t}+Recall_{t}}} \end{aligned} \end{aligned} \end{align*}\end{document}

The \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathrm{PRAUC}$\end{document} can be calculated as

(22) \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} \begin{align*}& \begin{aligned} \begin{aligned} \begin{aligned} \mathrm{PRAUC}&=\frac1N\sum_{t=1}^{N}\sum_{k=1}^{|\mathcal{M}|}\mathrm{Precision}(k)_{t}\Delta\operatorname{Recall}(k)_{t} \\ \Delta\operatorname{Recall}(k)_{t}&=\operatorname{Recall}(k)_{t}-\operatorname{Recall}(k-1)_{t}\end{aligned}, \end{aligned} \end{aligned}\end{align*}\end{document}

where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathrm{Precision}(k)_{t}$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\Delta \operatorname{Recall}(k)_{t}$\end{document} are the precision and the change of recall at cut-off \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $k$\end{document} in ordered retrieval list, respectively.

 

0.10 Experimental settings

We compare the proposed DrugDoctor with the following 10 baseline methods:

LR is a standard logistic regression.

ECC [25] employs multiple SVM classifiers to make predictions.

LEAP [12] is an LSTM-based generation model. It regards recommendations as a sequential decision-making process based on diagnosis information.

DMNC [26] utilizes a memory-augmented network with two controllers and a write-protected mechanism to conduct prediction.

GAMENet [13] integrates the DDI graph through a graph-augmented memory module and utilizes longitudinal patient records for prediction.

MICRON [27] conducts medication prediction by capturing changes in drugs between different visits using a recurrent residual network.

SafeDrug [14] introduces molecule structure information to enhance medication recommendation.

COGNet [16] proposes a copy-or-predict mechanism to generate the medication set.

MoleRec [15] investigates the relationships between the health condition of patients and molecular sub-structures to improve the prediction.

SHAPE [17] is a recent approach that proposes a sample adaptive hierarchical medication prediction network to fill the task.

Our model was implemented using PyTorch 1.9.1 with Python 3.8.18 and trained on an NVIDIA GeForce RTX 4090 GPU. The random seed was set to 1023 for reproducibility. It was trained using the Adam optimizer with a learning rate of \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $5 \times 10^{-4}$\end{document} and a batch size of 16. The hyperparameters of the model were selected objectively based on their performance on the validation set. We set the threshold \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\delta = 0.4$\end{document} and the trade-off parameter \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\alpha = 0.5$\end{document}. The RNN component was implemented using a Gated Recurrent Unit. The testing process was performed according to the previous work COGNet [16]. We randomly sampled \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $80\%$\end{document} of the test data for each evaluation round, repeating this process 10 times. The mean and standard deviation of these 10 rounds were calculated and reported as the final outcome. All the baselines in our study were implemented using the optimized parameters as described in the respective references.

Results

Performance comparison

Table 2 presents a comprehensive summary of the prediction performance of all methods on the widely used MIMIC-III dataset. All in all, our proposed DrugDoctor outperforms all baselines with higher Jaccard, F1, and PRAUC scores while maintaining a relatively lower DDI rate. Among the baselines, LR, ECC, and LEAP exhibit poor prediction performance since they only consider patient information within the current visit. On the other hand, the longitudinal-based methods, which consider the patient’s medical history, achieve relatively better performance. MICRON achieves improved performance and a low DDI rate by predicting fewer drugs. SafeDrug and MoleRec both combine molecular representations of drugs and employ specific DDI control strategies to adaptively balance the accuracy and safety of predicted medications.

Table 2 Performance comparison on the MIMIC-III dataset; the best results are highlighted in bold

Model	Jaccard \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\uparrow $\end{document}	F1 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\uparrow $\end{document}	PRAUC \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\uparrow $\end{document}	DDI \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\downarrow $\end{document}	Avg.# of drugs	
LR	0.4865 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0021	0.6434 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0019	0.7509 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0018	0.0829 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0009	16.1773 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0942	
ECC	0.4996 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0049	0.6569 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0044	0.6844 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0038	0.0846 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0018	18.0722 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.1914	
LEAP(2017)	0.4521 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0024	0.6138 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0026	0.6549 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0033	0.0731 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0008	18.7138 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0666	
DMNC(2018)	0.4864 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0025	0.6529 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0030	0.7580 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0039	0.0842 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0011	20.0000 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0000	
GAMENet(2019)	0.5067 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0025	0.6626 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0025	0.7631 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0030	0.0864 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0006	27.2145 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.1141	
MICRON(2021)	0.5100 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0033	0.6654 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0031	0.7687 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0026	0.0641 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0007	17.9267 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.2172	
SafeDrug(2021)	0.5213 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0030	0.6768 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0027	0.7647 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0025	0.0589 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0005	19.9178 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.1604	
COGNet(2022)	0.5252 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0011	0.6791 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0011	0.7652 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0012	0.0876 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0005	28.9352 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.1161	
MoleRec(2023)	0.5305 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0033	0.6843 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0029	0.7736 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0027	0.0724 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0008	21.0893 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.1788	
SHAPE(2023)	0.5348 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0003	0.6885 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0003	0.7821 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0003	0.0850 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0000	20.9008 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0777	
DrugDoctor	0.5459 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0014	0.6975 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0014	0.7933 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0011	0.0603 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0003	20.7996 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0647	

In particular, COGNet and SHAPE make efforts to learn visit-level knowledge and achieve good results. However, it is worth noting that the implementations of these two models still essentially learn at the patient level, which means their performance may vary depending on the number of patient visits. To demonstrate the effectiveness of visit-level training, we conducted additional comparative experiments of DrugDoctor with COGNet and SHAPE on the MIMIC-IV dataset. The results presented in Table 3 indicate that DrugDoctor possesses enhanced generalization capability compared with COGNet and SHAPE, both of which are representative methods adopting patient-level training.

Table 3 Performance comparison on the MIMIC-IV dataset; the best results are highlighted in bold

Model	Jaccard \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\uparrow $\end{document}	F1 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\uparrow $\end{document}	PRAUC \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\uparrow $\end{document}	DDI \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\downarrow $\end{document}	Avg.# of drugs	
COGNet(2022)	0.5084 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0019	0.6561 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0017	0.7440 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0014	0.0927 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0004	21.5079 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0932	
SHAPE(2023)	0.5059 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0003	0.6571 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0003	0.7428 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0002	0.0917 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0001	15.4165 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0291	
DrugDoctor	0.5103 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0016	0.6600 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0014	0.7508 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0015	0.0705 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0007	14.1290 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0819	

Additionally, to further investigate the robustness of COGNet, SHAPE, and DrugDoctor, we conducted experiments on patients with varying numbers of hospital visits. More specifically, we selected patients with specific numbers of hospital visits, and conducted experiments on the selected patients to assess the models’ performances under different scenarios. Since the majority of patients in the MIMIC-III dataset have fewer than five visits (see Fig. 3 (A)), we focused on the first five visits of patients in the dataset, and tested the models’ performances on the patients with exact \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $n$\end{document} visits for \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $n = 1... 5$\end{document} (Fig. 4). For the the MIMIC-IV dataset, most patients have fewer than seven visits (see Fig. 3 (B)). Therefore we tested the models on the patients in the dataset with exact \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $n$\end{document} visits for \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $n = 1... 7$\end{document}, and the experimental results are shown in Fig. 5. Both Fig. 4 and Fig. 5 illustrate that DrugDoctor exhibits remarkable robustness when the number of visits is varying. There are two important observations: firstly, DrugDoctor outperforms COGNet and SHAPE significantly, particularly when dealing with new patients. This indicates that DrugDoctor effectively addresses the cold-start problem. Secondly, all models achieve their highest performance in Fig. 4 when the number of visits is two, which may be attributed to the fact that the proportion of the patients with two visits in the MIMIC-III is much higher than others.

Figure 3 (A) The histogram of hospital visits of a patient in the MIMIC-III dataset; (B) the histogram of hospital visits of a patient in the MIMIC-IV dataset.

Figure 4 The performances of three models on the patients with specific visits in the MIMIC-III dataset.

Figure 5 The performance of three models on the patients with specific visits in the MIMIC-IV dataset.

In summary, these findings not only validate the effectiveness of our model, but also highlight its potential in various practical scenarios.

 

0.11 Ablation study

To verify the effectiveness of each component of DrugDoctor, we design the following ablation models:

DrugDoctor \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $w/o\ Block1$\end{document}: by removing CA-MHSA Block1, the diagnosis information and procedure information are directly combined without the guidance of drug substructure information.

DrugDoctor \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $w/o\ Block2$\end{document}: by removing CA-MHSA Block2, the medication records from previous visits are used without considering the impact of medications on the patient’s condition.

DrugDoctor \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $w/o\ DDI$\end{document}: by removing \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{L}_{ddi}$\end{document} in Eq. 16 from the loss function, the model is trained only by the multi-label classification loss.

DrugDoctor \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $w/o\ RNN$\end{document}: by removing the RNN module, the model ignores the medication records of earlier visits.

Table 4 shows the performance of the different variants of DrugDoctor. As expected, the results of DrugDoctor \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $w/o\ Block1$\end{document} indicate that the relationship between disease and the function of drug substructures is beneficial. And the CA-MHSA \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $Block1$\end{document} could effectively explore the drug substructure-aware disease information in visit-level representation. Similarly, the results of DrugDoctor \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $w/o\ Block2$\end{document} suggest that investigating the influence of prior medications on the previous condition is helpful for the current drug prediction. DrugDoctor \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $w/o\ RNN$\end{document} yields poor results among all ablation models, highlighting the necessity of incorporating historical medication records. Additionally, the results of DrugDoctor \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $w/o\ DDI$\end{document} demonstrate that the combination loss function could effectively balance the accuracy and safety of predicted medication combinations, which is consistent with the fact that the DDI rate typically increases with increasing accuracy. Generally, DrugDoctor outperforms all its variants, indicating the essential role of each component in the model.

Table 4 Ablation study of DrugDoctor on the MIMIC-III dataset

Model	Jaccard \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\uparrow $\end{document}	F1 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\uparrow $\end{document}	PRAUC \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\uparrow $\end{document}	DDI \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\downarrow $\end{document}	Avg.# of drugs	
DrugDoctor \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $w/o~Block1$\end{document}	0.5387 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0014	0.6912 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0011	0.7880 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0012	0.0554 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0003	20.8298 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0834	
DrugDoctor \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $w/o~Block2$\end{document}	0.5406 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0013	0.6928 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0011	0.7896 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0009	0.0575 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0002	20.6812 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0516	
DrugDoctor \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $w/o~DDI$\end{document}	0.5452 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0011	0.6970 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0010	0.7923 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0012	0.0764 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0004	21.6770 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.1010	
DrugDoctor \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $w/o~RNN$\end{document}	0.5342 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0015	0.6872 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0013	0.7819 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0013	0.0564 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0003	20.5375 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0862	
DrugDoctor	0.5459 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0014	0.6975 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0014	0.7933 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0011	0.0603 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0003	20.7996 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\pm $\end{document} 0.0647	

 

0.12 Case study

To intuitively illustrate the advantages of DrugDoctor over COGNet and SHAPE, we randomly sampled several example cases and analyze their predicted results. Due to space limitations, diagnostic and procedural data are abbreviated using International Classification of Diseases (ICD) codes, while medications are encoded via the Anatomical Therapeutic Chemical (ATC) classification system.

Table 5 is about patient A, who was randomly sampled from the patients with two visits in the MIMIC-III test set. In Table 5, “hit” and “error” refer to numbers of medications that are correctly and wrongly recommended, respectively, and “missed” denotes the number of medications present in the ground truth prescription that have not been recommended. As indicated in Table 5, all three models achieved good performance at the second visit of the patient. However, the recommended results for the initial visit clearly demonstrate the distinct advantage of DrugDoctor. Our model obtained more accurate recommendation compared with the other models, with 23 “hit”s and the lowest number of “error”s and “missed”s. To validate the capabilities of DrugDoctor in more complex clinical scenarios, we randomly sampled a patient (called patient B) from the MIMIC-IV test set with four hospital visits. The recommended results for patient B by the models are presented in Fig. 6. DrugDoctor achieved the best performance in the first, second, and fourth visits.

Table 5 Recommended medications for patient A with two visits

First visit	Code				
Diagnosis: Procedure:	07054,1550,25000,29281,4019,45621,5121,53550,5715,5762,9974,E8780,E9352 0093,3404,3893,4011,4513,5059,5185,5187,9741,9915				
Ground truth:	A02B,A04A,A06A,A07A,A07E,A10A,A12B,A12C,B01A,B05C,C01C,C02C, C02D,C03C,D01A,D07A,D11A,J01C,J01E,J05A,N01A,N02A,N05A,N06A(24 codes)				
Model	Predicted codes	hit	missed	error	
COGNet	A01A,A02A,A02B,A04A,A06A,A07A,A07E,A12A,A12B,A12C,B01A,B05C, C01B,C02D,C03C,C07A,D01A,D04A,D07A,D11A,J01C,J01E,J05A,L04A, N01A,N02A,N02B,N05A,N05C(29 codes)	20	4	9	
SHAPE	A01A,A02A,A02B,A04A,A05A,A06A,A07A,A07E,A12A,A12B,A12C,B01A, B05C,C01B,C02D,C03C,C07A,D01A,D07A,D11A,J01C,J01D,J01E,J05A, L04A,N01A,N02A,N02B,N05A,N06A,R03A,S01E(32 codes)	21	3	11	
DrugDoctor	A01A,A02B,A04A,A06A,A07A,A07E,A10A,A12A,A12B,A12C,B01A,B05C, C01B,C01C,C02D,C03C,C07A,C08C,D01A,D04A,D07A,D11A,H04A,J01C, J01E,J05A,N01A,N02A,N02B,N05A,N05C,N06A(32 codes)	23	1	9	
Second visit	Code				
Diagnosis: Procedure:	03842,25000,4019,78552,99592,V1007,V427 0331,3893				
Ground truth:	A01A,A02B,A06A,A07A,A07E,A12A,A12B,A12C,B01A,B05C,C01C,D01A, D11A,J01D,J01E,J05A,N02A,N02B,N05B,N06A,R05C (21 codes)				
Model	Predicted codes	hit	missed	error	
COGNet	A01A,A02B,A04A,A06A,A07A,A07E,A12B,A12C,B01A,B05C,C01C,C02C,D01A, D07A,D11A,J01C,J01D,J01E,J01M,J05A,N02A,N02B,N05A,N06A (24 codes)	18	3	6	
SHAPE	A01A,A02B,A06A,A07A,A07E,A12A,A12B,A12C,B01A,B05C,C01C,C07A, D01A,D07A,D11A,J01C,J01D,J01E,J05A,L04A,N02A,N02B,N06A (23codes)	19	2	4	
DrugDoctor	A01A,A02B,A06A,A07A,A07E,A10A,A12A,A12B,A12C,B01A,B05C,C01C,C03C, C07A,D11A,J01C,J01D,J01E,J01M,J05A,N02A,N02B,N05B,N06A,R05C (25 codes)	20	1	5	

Figure 6 Recommended medications for patient B randomly sampled from the MIMIC-IV dataset, where “hit” and “error” refer to the numbers of medications that are accurately and wrongly recommended, respectively; “missed” denotes the number of medications present in the ground truth prescription that have not been recommended.

For patient A, who had only two hospital visits, the recommendation results highlight that DrugDoctor excels in dealing with new patients during their initial visit, successfully generalizing the learned prescription knowledge to these new cases. In the scenario of patient B, who had four visits from a different dataset, DrugDoctor maintained better or competitive performance compared with the other models. Overall, the results of the case studies on these two patients from different datasets further demonstrate the superiority and generalization capabilities of DrugDoctor compared with the representative benchmark methods.

Discussion and conclusion

Recent advancements in healthcare technologies and the growing availability of patient data have facilitated the development of intelligent medication recommendation systems. This research paper proposes DrugDoctor, a novel drug recommendation model that emulates the decision-making process of human doctors. Unlike previous approaches, we introduce the CA-MHSA block, which explores both drug substructure-aware disease information and effectiveness-aware medication information. Additionally, we achieved fine-grained dataset segmentation, enabling model training at the visit level for the first time. Extensive experiments across various datasets confirmed the superior performance of DrugDoctor compared with other methods and its robustness in handling patients with different numbers of visits.

Importantly, DrugDoctor effectively addresses the prevalent cold-start problem encountered in medication combination recommendations. The effectiveness of DrugDoctor can be attributed to two main reasons. Firstly, both drug substructure-aware disease information and effectiveness-aware medication information extracted by CA-MHSA blocks are beneficial for improving prediction. Secondly, the novel visit-level training strategy enhances the data mining performance of EHR data, as evidenced by the comprehensive comparison with COGNet and SHAPE, which are two representative patient-level training methods.

Despite these advancements, implementing intelligent medication recommendation systems still presents several challenges. Ensuring data privacy and security is paramount, given the sensitive nature of patient information. Furthermore, integrating medication recommendation systems with existing EHR-based platforms requires ensuring data quality and consistency, as EHR data from various sources may differ in format and reliability. Advanced computational infrastructure is also necessary to handle and analyze large volumes of heterogeneous data in real-time. Lastly, enhancing the system’s interpretability and transparency is crucial for gaining healthcare providers’ trust and facilitating effective use in clinical settings.

In conclusion, the development of intelligent medication recommendation systems represents a significant step toward providing personalized and accurate healthcare. However, there are still important areas for further research. Current efforts often focus solely on minimizing DDIs, but it is also essential to recognize that some DDIs can be beneficial, and not all interactions are harmful. Incorporating more comprehensive medication knowledge can help develop rational DDI control strategies that optimize both efficacy and safety. Additionally, recent researches [28, 29] suggested that leveraging structural information from heterogeneous healthcare networks could enhance prediction accuracy. Thus, using heterogeneous graph neural networks to process EHR data might improve recommendation outcomes by capturing rich structured information with fewer data consistency constraints.

Key Points

DrugDoctor is the first drug recommendation model to achieve visit-level representation learning and training, which is more in line with the practices of doctors.

A plug-and-play CA-MHSA block is proposed to capture the drug substructure-aware disease information and the effectiveness-aware medications information, significantly improving the prediction performance.

DrugDoctor exhibits a distinct advantage when dealing with the first-time visits of new patients in the cold-start scenario.

The experimental results on the benchmark dataset validate the effectiveness and robustness of our proposed method, demonstrating the superiority of DrugDoctor over the state-of-the-art baselines.

Funding

This work is supported by grants from the National Natural Science Foundation of China (Grant Nos. 62172028, 61772197).

Data availability

The datasets are available online at https://physionet.org/content/mimiciii/1.4/ and https://physionet.org/content/mimiciv/3.0/. The code and results are available at https://github.com/kybinn/DrugDoctor.
==== Refs
References

1. Dagliati A , MaloviniA, TibolloV. et al . Health informatics and EHR to support clinical research in the COVID-19 pandemic: An overview. Brief Bioinform 2021; 22 :812–22. 10.1093/bib/bbaa418.33454728
2. Macias CG , RemyKE, BardaAJ. Utilizing big data from electronic health records in pediatric clinical care. Pediatr Res 2023; 93 :382–9. 10.1038/s41390-022-02343-x.36434202
3. Garriga R , MasJ, AbrahaS. et al . Machine learning model to predict mental health crises from electronic health records. Nat Med 2022; 28 :1240–8. 10.1038/s41591-022-01811-5.35577964
4. Bhoi S , LeeML, HsuW. et al . Personalizing medication recommendation with a graph-based approach. ACM Trans Inf Syst 2021; 40 :1–23. 10.1145/3488668.
5. Wang Y , ChenW, PiD. et al . Self-supervised adversarial distribution regularization for medication recommendation. In: Zhi-Hua Zhou, (ed.) proceedings of the thirtieth international joint conference on artificial intelligence, IJCAI-21. California, USA: International Joint Conferences on Artificial Intelligence, 3134–40.
6. He Y , WangC, LiN. et al . Attention and memory-augmented networks for dual-view sequential learning. In: Tang J, Prakash BA, (eds.) Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. New York, NY, USA: Association for Computing Machinery, 2020, 125–34.
7. Tan Y , KongC, YuL. et al . 4sdrug: Symptom-based set-to-set small and safe drug recommendation. In: Zhang A, Rangwala H, (eds.) Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining. New York, NY, USA: Association for Computing Machinery, 2022, p. 3970–80.
8. Li R , WangJ, LinH. et al . A patient information mining network for drug recommendation. Methods 2023; 216 :3–10. 10.1016/j.ymeth.2023.06.005.37302520
9. Jialun W , HeK, MaoR. et al . Megacare: Knowledge-guided multi-view hypergraph predictive framework for healthcare. Inf Fusion 2023; 100 :101939.
10. Gunlicks-Stoessel M , MufsonL, WesterveltA. et al . A pilot smart for developing an adaptive treatment strategy for adolescent depression. J Clin Child Adolesc Psychol 2016; 45 :480–94. 10.1080/15374416.2015.1015133.25785788
11. Chen Z , MarpleK, SalazarE. et al . A physician advisory system for chronic heart failure management based on knowledge patterns. Theory Pract Log Program 2016; 16 :604–18. 10.1017/S1471068416000429.
12. Zhang Y , ChenR, TangJ., et al. LEAP: Learning to prescribe effective and safe treatment combinations for multimorbidity. In: Matwin S, Yu S, Farooq F, (eds.) Proceedings of the 23rd ACM SIGKDD international conference on knowledge Discovery and data Mining. New York, NY, USA: Association for Computing Machinery, 2017, 1315–24.
13. Shang J , XiaoC, MaT. et al . GAMENet: Graph augmented memory networks for recommending medication combination. In proceedings of the AAAI Conference on Artificial Intelligence 2019; 33 :1126–33. 10.1609/aaai.v33i01.33011126.
14. Yang C , XiaoC, MaF. et al . SafeDrug: Dual molecular graph encoders for recommending effective and safe drug combinations. In: Zhou Z-H, (ed.) Proceedings of the thirtieth international joint conference on artificial intelligence, IJCAI-21. California, USA: International Joint Conferences on Artificial Intelligence, p. 3735–41.
15. Yang N , ZengK, WuQ. et al . MoleRec: Combinatorial drug recommendation with substructure-aware molecular representation learning. In: Ding Y, Tang J, (eds.) Proceedings of the ACM Web Conference 2023, WWW ‘23. New York, NY, USA: Association for Computing Machinery, 2023, p. 4075–85.
16. Rui W , QiuZ, JiangJ. et al . Conditional generation net for medication recommendation. In Proceedings of the ACM Web Conference 2022; 2022 :935–45.
17. Liu S , WangX, JingchengD. et al . SHAPE: A sample-adaptive hierarchical prediction network for medication recommendation. IEEE J Biomed Health Inform 2023; 27 :6018–28. 10.1109/JBHI.2023.3320139.37768789
18. Vaswani A , ShazeerN, ParmarN. et al . Attention is all you needIn: Advances in Neural Information Processing Systems, Vol. 30 . NY, United States: Curran Associates, Inc., 2017.
19. Klekota J , RothFP. Chemical substructures that enrich for biological activity. Bioinformatics 2008; 24 :2518–25. 10.1093/bioinformatics/btn479.18784118
20. Degen J , Wegscheid-GerlachC, ZalianiA. et al . On the art of compiling and using’drug-like’chemical fragment spaces. ChemMedChem: Chemistry enabling. Drug Discovery 2008; 3 :1503–7. 10.1002/cmdc.200800178.
21. Landrum G . RDKit documentation. Release 2013;1 :4.
22. Xu K , HuW, LeskovecJ. et al . How powerful are graph neural networks? In Proceedings of the Seventh International Conference on Learning Representations, ICLR, 2019. https://openreview.net/forum?id=ryGs6iA5Km.
23. Johnson AEW , PollardTJ, ShenL. et al . MIMIC-III, a freely accessible critical care database. Sci data 2016; 3 :1–9. 10.1038/sdata.2016.35.
24. Johnson AEW , Lucas BulgarelliL, ShenAG. et al . MIMIC-IV, a freely accessible electronic health record dataset. Scientific data 2023;10 :1. 10.1038/s41597-022-01899-x.
25. Read J , PfahringerB, HolmesG. et al . Classifier chains for multi-label classification. Machine Learning 2011;85 :333–59.
26. Le H , TranT, VenkateshS. Dual memory neural computer for asynchronous two-view sequential learning. In: Guo Y, Farooq F (eds.) Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. New York, NY, USA: Association for Computing Machinery, 2018, p. 1637–45.
27. Yang C , XiaoC, GlassL. et al . Change matters: Medication change prediction with recurrent residual networks. In: edited by Zhou Z-H, (ed.) Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, IJCAI-21. California, USA: International Joint Conferences on Artificial Intelligence, p. 3728–34.
28. Wang G , LouX, GuoF. et al . EHR-HGCN: An enhanced hybrid approach for text classification using heterogeneous graph convolutional networks in electronic health records. IEEE J Biomed Health Inform 2023; 28 :1668–79. 10.1109/JBHI.2023.3346210.
29. Ali Z , HuangY, UllahI. et al . Deep learning for medication recommendation: A systematic survey. Data. Dermatol Int 2023; 5 :303–54.
