Introduction
Electronic Health Records (EHRs) contain a wealth of longitudinal data that can be leveraged to improve clinical decision support and predictive modeling. In Natural Language Processing (NLP), word embedding techniques like word2vec have revolutionized how we represent semantic relationships. However, applying these techniques directly to EHR data—where medical codes are treated as "words" and patient histories as "sentences"—presents a significant challenge: the temporal dimension.
Unlike words in a book, which follow a strict sequential order, medical events are separated by varying gaps of time. A diagnosis recorded today is likely more related to a medication prescribed this week than to a procedure performed three years ago. Standard embedding models often ignore these temporal dependencies, treating all adjacent codes in a record as equally related. This paper introduces "time-sensitive" clinical concept embeddings that explicitly account for the temporal structure of EHR data.
Methodology and Data
The researchers developed a pipeline to process massive EHR datasets and train time-aware embeddings.
Temporal Embedding Frameworks
The authors extended three prominent embedding algorithms to incorporate temporal logic:
- Time-Sensitive Skip-gram (word2vec): The standard Skip-gram model predicts context words within a fixed window. The time-sensitive version uses a dynamic window based on temporal constraints (e.g., only considering codes within a specific time frame of the target event).
- Time-Sensitive PPMI-SVD: This method segments input sequences into discrete time windows before calculating the Positive Pointwise Mutual Information (PPMI) co-occurrence matrix.
- Time-Sensitive FastText: By leveraging sub-word information (n-grams), FastText is particularly suited for hierarchical medical coding systems like ICD-9, where code prefixes denote broad disease categories.
Experimental Setup
The models were trained on the Cerner Health Facts® database, encompassing records for approximately 50 million unique patients across 600 U.S. hospitals from 1995 to 2015. Three temporal configurations were evaluated:
- Baseline: Standard sliding window without temporal logic.
- T-visit: Neighbors are restricted to events within the same hospital visit.
- T-month: Neighbors are restricted to a 30-day sliding window.
Key Insights and Results
The study evaluated the embeddings through both intrinsic (clustering based on medical taxonomies) and extrinsic (predictive modeling) tasks.
The Importance of the Clinical Visit
For semantic similarity and clustering, embeddings learned within the T-visit window performed best. This suggests that the strongest semantic relationships between medical concepts are established during individual clinical encounters. FastText (FT-T-visit) consistently outperformed other methods in grouping similar concepts, likely due to its ability to exploit the hierarchical structure of medical codes.
Predictive Performance in Heart Failure
In a downstream task predicting heart failure onset (using a cohort of 42,729 patients), the time-sensitive word2vec model (SG-T-month) achieved an AUC of 85.42%. This outperformed the non-temporal baseline (84.11%) and models using randomly initialized embeddings. Interestingly, while the visit-based window was best for defining concepts, the 30-day window was superior for predictive modeling, suggesting it better captures the progression of disease.
Limitations of PPMI
PPMI-SVD generally underperformed compared to neural methods. The authors attribute this to the high sparsity and "long tail" of rare diseases in large EHR datasets, which matrix factorization methods struggle to handle effectively.
Conclusion
Incorporating temporal constraints into clinical concept embeddings significantly improves their quality and utility for downstream medical tasks. By recognizing that "timing is everything" in healthcare data, these models provide a more accurate representation of patient health trajectories. Future research will focus on integrating laboratory results and exploring more granular time-decay functions to further refine the temporal sensitivity of these embeddings.
Summary updated