HypeMed: Enhancing Medication Recommendations with Hypergraph-Based Patient Relationships
Organizations: Gaoling School of Artificial Intelligence, Renmin University of China, China · Beijing Key Laboratory of Research on Large Models and Intelligent Governance · Engineering Research Center of Next-Generation Intelligent Search and Recommendation, MOE · Microsoft Research Asia, China
Abstract
Medication recommendations aim to generate safe and effective medication sets from health records. However, accurately recommending medications hinges on inferring a patient's latent clinical condition from sparse and noisy observations, which requires both (i) preserving the visit-level combinatorial semantics of co-occurring entities and (ii) leveraging informative historical references through effective, visit-conditioned retrieval. Most existing methods fall short in one of both aspects: graph-based modeling often fragments higher-order intra-visit patterns into pairwise relations, while inter-visit augmentation methods commonly exhibit an imbalance between learning a globally stable representation space and performing dynamic retrieval within it. To address these limitations, this paper proposes HypeMed, a two-stage hypergraph-based framework unifying intra-visit coherence modeling and inter-visit augmentation. HypeMed consists of two core modules: MedRep for representation pre-training, and SimMR for similarity-enhanced recommendation. In the first stage, MedRep encodes clinical visits as hyperedges via knowledge-aware contrastive pre-training, creating a globally consistent, retrieval-friendly embedding space. In the second stage, SimMR performs dynamic retrieval within this space, fusing retrieved references with the patient's longitudinal data to refine medication prediction. Evaluation on real-world benchmarks shows that HypeMed outperforms state-of-the-art baselines in both recommendation precision and DDI reduction, simultaneously enhancing the effectiveness and safety of clinical decision support.
Figures & tables
| Notation | Definition |
| EHR database containing all patients’ visit sequences | |
| The -th visit of patient (patient index is omitted when clear) | |
| Sets of all diagnosis, procedure, and medication codes | |
| Multi-hot vectors for diagnoses, procedures, and medications | |
| , , and | Visit representations derived from diagnoses, procedures, and medications |
| Hypergraph for domain |
| Item | MIMIC-III | MIMIC-IV | eICU |
| # of patients | 6,350 | 9,036 | 7,855 |
| # of visits | 15,032 | 20,616 | 16,869 |
| avg. # of visits | 2.37 | 2.28 | 2.15 |
| # of unique diag. codes | 1,958 | 1,892 | 692 |
| # of unique proc. codes | 1,430 | 4,939 | - |
| # of unique med. codes | 131 | 131 | 46 |
| Hyperparameter | Range |
| Learning rate | |
| Weight decay | |
| Dropout ratio | |
| Epochs | |
| Batch size | |
| Pretraining epochs |
| Model | Jaccard | F1 | PRAUC | DDI | # Med. |
| LR | \color[rgb]{0,0.4,0.6}{8.30_{\pm 0.07}} | ||||
| ECC | \color[rgb]{0,0.4,0.6}{8.57_{\pm 0.08}} | ||||
| LEAP | \color[rgb]{0,0.4,0.6}{7.82_{\pm 0.08}} | ||||
| RETAIN | \color[rgb]{1,0.25,0}{8.83_{\pm 0.10}} | ||||
| GAMENet | \color[rgb]{1,0.25,0}{8.88_{\pm 0.09}} | ||||
| SafeDrug | \color[rgb]{0,0.4,0.6}{5.87_{\pm 0.04}} |
| Model | Jaccard | F1 | PRAUC | DDI | # Med. |
| LR | \color[rgb]{0,0.4,0.6}{7.07_{\pm 0.09}} | ||||
| ECC | \color[rgb]{0,0.4,0.6}{7.11_{\pm 0.14}} | ||||
| LEAP | \color[rgb]{0,0.4,0.6}{6.57_{\pm 0.06}} | ||||
| RETAIN | \color[rgb]{1,0.25,0}{7.29_{\pm 0.14}} | ||||
| GAMENet | \color[rgb]{1,0.25,0}{7.85_{\pm 0.05}} | ||||
| SafeDrug | \color[rgb]{0,0.4,0.6}{6.11_{\pm 0.11}} |
| Model | Jaccard | F1 | PRAUC | # Med. |
| LR | ||||
| ECC | ||||
| LEAP | ||||
| RETAIN | ||||
| GAMENet | ||||
| SafeDrug |
| MIMIC-III | |||||
| Model | Jaccard | F1 | PRAUC | DDI | #Med. |
| HypeMed | |||||
| – SimMR– w/o Sim. | |||||
| – SimMR– w/o Hist. | |||||
| – MedRep–None | |||||
| – MedRep–Fixed | |||||
| Dataset | Epoch | Jaccard | F1 | PRAUC | DDI | #Med. |
| MIMIC-III | 0 | |||||
| 100 | ||||||
| 300 | ||||||
| 1000 | ||||||
| MIMIC-IV | 0 | |||||
| 100 |
| Dataset | Top- | Jaccard | F1 | PRAUC | DDI | #Med. |
| MIMIC-III | 0 | |||||
| 1 | ||||||
| 10 | ||||||
| 100 | ||||||
| 500 | ||||||
| 1000 |
| Dataset | #Views | Jaccard | F1 | PRAUC | DDI | #Med. | GPU Mem. |
| MIMIC-III | |||||||
| MIMIC-IV | |||||||
| Dataset | Model | Jaccard | F1 | PRAUC | DDI | #Med. |
| MIMIC-III | SafeDrug | |||||
| DAPSNet | ||||||
| COGNet | ||||||
| HypeMed | ||||||
| HypeMed -SimMR- w/o Hist. | ||||||
| HypeMed -SimMR- w/o Sim. |
| Diagnoses | Medications | |
| Visit-1 | V8741, V153, 79029, V1083, 5715, 1550, 07054 | N02B, A01A, A02B , A06A , B05C , J05A , A12C , A07A , J01E , N01A , C03C , J01C , N02A , B01A , N05C , D01A , J01D , L04A , D11A , A04A , A07E , D07A , D04A , C03D |
| Visit-2 | 99682, 78552, 0389, 99592, 5848, 570, 28419, 4561, 5589, 78060, 07070, 5715, V1083, E8780, 4568, V168, V1582 | N02B , A01A , A02B , A06A , B05C , A12A , A12C , C01C , A07A , J02A , J05A , V03A , J01E , J01C, N02A, A02A , J01M , B01A , N05C , J01D , B02B, C08C , D11A , A04A, A07E |