Introduction
Electronic Health Records (EHR) are a critical resource for healthcare analytics, yet they present significant modeling challenges. Traditionally, medical concepts such as diagnoses or prescriptions are represented as discrete, independent "one-hot" vectors. This approach fails to capture the latent clinical relationships between concepts—for instance, the similarity between pneumonia and bronchitis compared to unrelated conditions like obesity.
While "word2vec" style embeddings, such as the Skip-gram model shown in Figure 1, have been adapted to map these concepts into continuous vector spaces, they often struggle with the unique hierarchical structure of EHR data. Specifically, a patient's history consists of a sequence of visits, each containing an unordered set of multiple codes. Standard models often fail to simultaneously capture intra-visit co-occurrences and inter-visit sequential progressions.
Methods
To address these limitations, the authors propose Med2Vec, a multi-layer neural network architecture designed to learn both code-level and visit-level representations.
As illustrated in Figure 2, the model processes a binary vector of codes $x_t$ from a specific visit. This input passes through a hidden layer with a Rectified Linear Unit (ReLU) activation to create an intermediate representation $u_t$, which effectively serves as a code embedding. This is then concatenated with patient demographics $d_t$ (e.g., age, sex) and passed through another ReLU layer to produce the final visit-level representation $v_t$.
Med2Vec employs a unified learning objective. It uses a Skip-gram-like approach to ensure that codes within the same visit have similar embeddings (intra-visit information) while simultaneously training the visit-level representation to predict the medical codes of neighboring visits in the patient's history (inter-visit information). A key technical innovation is the use of ReLU and non-negativity constraints, which promotes sparsity and ensures that each dimension in the embedding space can be mapped back to identifiable clinical concepts, enhancing model interpretability.
Datasets
The model was evaluated using two large-scale EHR datasets:
- CHOA (Children’s Healthcare of Atlanta): A proprietary longitudinal dataset covering ~550,000 patients and 3.3 million visits, with nearly 30,000 unique medical codes (ICD-9, NDC, and CPT).
- CMS (Centers for Medicare & Medicaid Services): A public synthetic dataset containing ~831,000 patients and 5.4 million visits, used to demonstrate the model's scalability.
Key Results and Insights
Med2Vec demonstrated superior performance across multiple clinical prediction tasks:
- Future Code Prediction: The model achieved a Recall@30 of approximately 0.76, significantly outperforming standard Skip-gram (0.67) and GloVe (0.73).
- Risk Prediction: In predicting Clinical Risk Group (CRG) severity levels, Med2Vec reached an AUC of 0.915, surpassing stacked autoencoders and one-hot baselines.
- Interpretability: Qualitative analysis confirmed that the learned embeddings are medically meaningful. For example, specific dimensions in the embedding space were found to group clinically linked conditions, such as sickle-cell disease and organ transplants.
The results highlight that incorporating the sequential "clinical trajectory" of a patient provides a more comprehensive representation than simple code aggregation. Furthermore, the model's linear scalability makes it suitable for massive real-world hospital databases.
Conclusion
While Med2Vec offers significant improvements in EHR modeling, some challenges remain. The model currently treats visits as a simple sequence without explicitly accounting for the variable time intervals between them. Additionally, modeling medication codes proved more difficult than diagnosis codes due to the inherent noise in prescription data. Future research may explore the integration of Recurrent Neural Networks (RNNs) to better handle long-term dependencies while maintaining the interpretability established by the Med2Vec framework.
Summary updated