MedGraph: Structural and Temporal Representation Learning of Electronic Medical Records

Bhagya Hettige, Weiqing Wang, Yuan-Fang Li, Suong Le, Wray L. Buntine

TL;DR

MedGraph is a novel framework for learning Electronic Medical Record (EMR) representations that captures both the complex relationships between medical codes and the irregular timing of patient visits. By combining attributed bipartite graphs with temporal point processes and Gaussian embeddings, it significantly outperforms state-of-the-art models in predicting patient mortality and 30-day hospital readmission.

What Problem Does This Paper Address?

Electronic Medical Records (EMRs) are a goldmine for predictive healthcare, but they are notoriously difficult to model. Most existing methods treat a patient's history as a simple sequence of discrete events (like words in a sentence). This approach has three major flaws:

  1. Ignoring Time Gaps: In medicine, the time between visits matters. A follow-up visit one week after surgery carries different clinical weight than one three years later. Standard models often ignore these varying intervals.
  2. Static Vocabularies: Most models represent medical codes (diagnoses, procedures) as simple binary vectors. This fails to account for "side information," such as the text description of a code or a patient’s demographics (age, gender).
  3. Data Sparsity and Uncertainty: Medical data is often "sparse"—some diseases are rare, and some patients have very few visits. Traditional "point" embeddings (single vectors) don't represent the model's uncertainty about these rare events.

Methods

MedGraph introduces a multi-pronged approach to solve these issues:

  • Structural Learning (Bipartite Graph): Instead of flat vectors, the authors represent EMR data as an attributed bipartite graph. Visits and medical codes are nodes, and an edge exists if a code was recorded during a visit. This allows the model to incorporate "attributes" like patient demographics for visit nodes and text descriptions (via TF-IDF) for code nodes.
  • Temporal Learning (Point Process): To handle the irregular timing of visits, MedGraph uses a Temporal Point Process modeled by a Recurrent Neural Network (RNN). This treats visits as continuous-time events, allowing the model to learn how the influence of a past visit decays over time.
  • Gaussian Embeddings: Instead of representing a visit or code as a single point in space, MedGraph represents them as Gaussian distributions (mean and variance). This allows the model to capture uncertainty: a rare medical code will have a "larger" distribution (higher variance) than a common one.
  • Wasserstein Distance: To measure the similarity between these Gaussian distributions in the embedding space, the authors use the 2nd Wasserstein distance, which preserves the "triangle inequality" and helps the model learn transitive relationships between codes and visits.

Datasets

The researchers evaluated MedGraph on two real-world, cohort-specific proprietary EMR datasets:

  • Heart Failure (HF): 10,713 patients and over 200,000 visits.
  • Chronic Liver Disease (CL): 3,830 patients and over 122,000 visits.

Both datasets included ICD-10-CM diagnosis codes, in-house procedure codes, patient demographics (age, ethnicity, etc.), and hospital utilization info (length of stay, admission source).

Key Insights and Ideas

  • Time is a Feature, Not Just an Index: By using a point process, the model learns that the "intensity" of a patient's health risk changes based on the time elapsed since their last visit.
  • The "Aha" Moment of Uncertainty: The authors found a clear correlation between data volume and embedding variance. As a patient accumulates more visits, the variance of their visit embedding decreases—the model becomes more "confident" in its representation of that patient’s health state.
  • Structural Transitivity: Because the model uses a graph structure, it can learn that two visits are similar even if they don't share the exact same codes, provided they share codes that are themselves related through other visits.

Key Results

MedGraph was tested against several heavyweights, including Med2Vec, Dipole, and RETAIN.

  • 30-Day Readmission: MedGraph consistently achieved higher Area Under the Curve (AUC) scores than all baselines on both the HF and CL datasets.
  • Mortality Prediction: MedGraph outperformed the best baseline (Med2Vec) by a significant margin. For example, on the HF dataset, MedGraph achieved an AUC of 0.7205 and an Average Precision (AP) of 0.6853, compared to Med2Vec’s 0.7091 AUC and 0.4752 AP.
  • Code Classification: In a task to classify medical codes into clinical categories (CCS), MedGraph’s embeddings were far more descriptive than non-attributed models, proving that incorporating text descriptions of codes significantly boosts representation quality.

Limitations and Future Work

  • Data Access: The study relies on proprietary datasets from a single hospital system. While the results are robust, testing on public datasets like MIMIC-III would help broader validation.
  • Computational Cost: Learning Gaussian embeddings and point processes is more computationally intensive than standard vector-based RNNs.
  • Future Directions: The authors suggest that MedGraph could be extended to incorporate even richer data types, such as clinical notes (via NLP) or medical imaging, into the attributed graph structure.

Summary updated

BibTeX
@inproceedings{hettige2020medgraph,
  author = {Bhagya Hettige and Weiqing Wang and Yuan-Fang Li and Suong Le and Wray L. Buntine},
  title = {{MedGraph: Structural and Temporal Representation Learning of Electronic Medical Records}},
  booktitle = {ECAI},
  year = {2020},
  url = {https://openreview.net/forum?id=Z_No4KH2vj},
}
Figure