DuETT: Dual Event Time Transformer for Electronic Health Records

Alex Labach, Aslesha Pokhrel, Xiao Shi Huang, Saba Zuberi, Seung Eun Yi, Maksims Volkovs, Tomi Poutanen, Rahul G. Krishnan

Abstract

Electronic health records (EHRs) recorded in hospital settings typically contain a wide range of numeric time series data that is characterized by high sparsity and irregular observations. Effective modelling for such data must exploit its time series nature, the semantic relationship between different types of observations, and information in the sparsity structure of the data. Self-supervised Transformers have shown outstanding performance in a variety of structured tasks in NLP and computer vision. But multivariate time series data contains structured relationships over two dimensions: time and recorded event type, and straightforward applications of Transformers to time series data do not leverage this distinct structure. The quadratic scaling of self-attention layers can also significantly limit the input sequence length without appropriate input engineering. We introduce the DuETT architecture, an extension of Transformers designed to attend over both time and event type dimensions, yielding robust representations from EHR data. DuETT uses an aggregated input where sparse time series are transformed into a regular sequence with fixed length; this lowers the computational complexity relative to previous EHR Transformer models and, more importantly, enables the use of larger and deeper neural networks. When trained with self-supervised prediction tasks, that provide rich and informative signals for model pre-training, our model outperforms state-of-the-art deep learning models on multiple downstream tasks from the MIMIC-IV and PhysioNet-2012 EHR datasets.

Introduction

Electronic Health Records (EHR) are a critical resource for clinical predictive modeling, yet they present significant challenges due to their irregularly sampled and sparse nature. Unlike the dense grids of images or linear sequences of text, EHR data consists of multivariate time series where observations (e.g., heart rate, lab tests) occur at varying frequencies. Standard Transformer architectures often fail in this domain because they either suffer from quadratic scaling when treating every event as a token or ignore the dual-dimensional structure of the data: the temporal axis ("when") and the event type axis ("what").

Methodology

Input Representation

To address the scaling and irregularity issues, DuETT employs a binning and aggregation strategy. A patient's stay is divided into fixed time bins. Within each bin, the model records the last observed value and the count of observations for each event type. This transforms the irregular data into a structured $N_{event} \times N_{time}$ grid, significantly reducing computational complexity and allowing for deeper networks.

The DuETT input representation, organizing sparse EHR data into a regular grid across event and time dimensions.

Dual Attention Architecture

The core of DuETT is its dual-attention mechanism. Each layer consists of two specialized Transformer sub-layers:

  1. Event Transformer: This sub-layer attends across different event types within the same time bin, capturing semantic relationships between physiological variables (e.g., the correlation between insulin dosage and glucose levels).
  2. Time Transformer: This sub-layer attends across different time bins for the same event type, modeling temporal trends and long-term dependencies.
The DuETT architecture alternating between Event-wise and Time-wise attention layers.

Additionally, the model utilizes Continuous Value Embedding (CVE) to encode the actual time elapsed, providing a more nuanced understanding of temporal scales than simple positional encodings.

Self-Supervised Pre-training

DuETT is pre-trained using a masked modeling approach. It learns to predict both the values of masked measurements and their presence. This "presence" signal is vital in clinical settings, as the decision to perform a test often reflects a clinician's underlying assessment of the patient's state.

Results and Discussion

The model was evaluated on the MIMIC-IV and PhysioNet-2012 datasets across tasks such as ICU mortality prediction and phenotyping. DuETT consistently outperformed state-of-the-art baselines, including LSTMs and other Transformer variants. Notably, it achieved an ROC-AUC of 0.912 for ICU mortality on MIMIC-IV, significantly surpassing a well-tuned XGBoost baseline (0.886).

Ablation studies highlighted that the "presence" signal and the dual-attention structure are key to its success. The model demonstrated high data efficiency, maintaining a performance lead even when trained on only 10% of labeled data. Qualitatively, DuETT showed a superior ability to reconstruct complex physiological trends compared to single-dimension Transformers.

Conclusion

DuETT introduces a robust framework for modeling sparse, irregular EHR data by explicitly attending to both time and event dimensions. By overcoming the limitations of standard Transformers in this domain, it sets a new state-of-the-art for clinical predictive tasks. Future work includes extending the model to longitudinal multi-stay histories and integrating multi-modal data such as clinical notes and medical imaging.

Summary updated

BibTeX
@inproceedings{labach2023duett,
  author = {Alex Labach and Aslesha Pokhrel and Xiao Shi Huang and Saba Zuberi and Seung Eun Yi and Maksims Volkovs and Tomi Poutanen and Rahul G. Krishnan},
  title = {{DuETT: Dual Event Time Transformer for Electronic Health Records}},
  booktitle = {MLHC},
  year = {2023},
  url = {https://openreview.net/forum?id=MDns2TRuvT},
}
Figure