Abstract
Electronic health records (EHR) are increasingly being used for constructing disease risk prediction models. Feature engineering in EHR data however is challenging due to their highly dimensional and heterogeneous nature. Low-dimensional representations of EHR data can potentially mitigate these challenges. In this paper, we use global vectors (GloVe) to learn word embeddings for diagnoses and procedures recorded using 13 million ontology terms across 2.7 million hospitalisations in national UK EHR. We demonstrate the utility of these embeddings by evaluating their performance in identifying patients which are at higher risk of being hospitalised for congestive heart failure. Our findings indicate that embeddings can enable the creation of robust EHR-derived disease risk prediction models and address some the limitations associated with manual clinical feature engineering.
Introduction
Predicting disease risk is a cornerstone of modern medicine, yet building these models is traditionally a "hand-crafted" process. Clinicians and data scientists typically manually select and engineer a small number of features—such as age, smoking status, or specific lab results—from a patient's record. However, Electronic Health Records (EHR) are incredibly complex, containing thousands of different codes for diagnoses and procedures recorded inconsistently across institutions. Because the data is high-dimensional and sparse, traditional statistical models struggle to utilize a patient’s entire history. This research addresses the gap between raw, heterogeneous EHR data and the need for scalable predictive models by applying natural language processing (NLP) techniques to automate feature representation.
Methods
The researchers treated a patient's medical history as a "document" and individual clinical codes as "words," applying the GloVe (Global Vectors for Word Representation) algorithm to learn low-dimensional "concept embeddings."
Corpus and Embedding Generation
GloVe, an unsupervised learning algorithm, was trained on the co-occurrence of medical codes across 2.7 million hospitalizations from the UK Biobank. The study utilized data from 502,629 individuals, including hospital care and mortality registers. Diagnoses were coded using ICD-9 and ICD-10, while procedures used OPCS-4. Four different corpora were tested, ranging from primary diagnoses (PRIMDX) to a combination of primary/secondary diagnoses and surgical procedures (PRIMDX-SECDX-PROC).
Patient Representation and Classification
To convert a sequence of medical codes into a fixed-length input for machine learning, the researchers generated "patient-level embeddings." As illustrated in Figure 1, this involved aggregating individual concept vectors from a patient's history (taking the mean, maximum, and minimum) to form a single representation. A Linear Support Vector Machine (SVM) was then used to perform binary classification for heart failure (HF) risk. To ensure the model learned predictive rather than diagnostic signals, a "prediction window" or buffer was implemented before the index date.
Results
The study evaluated the embeddings by matching 4,581 heart failure cases with 13,740 controls.
Predictive Performance
The results demonstrate that automated embeddings can handle high-dimensional health data effectively. As shown in Table 2, the best embedding-based model (using the full PRIMDX-SECDX-PROC corpus) achieved an AUROC of 0.6965, outperforming the traditional one-hot encoding approach (0.6815).
Emergent Biological Knowledge
A key insight was that clinical codes follow a "grammar" similar to human language. Codes that frequently appear together in clinical practice (e.g., Heart Failure and Atrial Fibrillation) naturally clustered together in the vector space. Visualization techniques revealed that the model "learned" medical relationships without prior biological knowledge, identifying related conditions like Ischemic Heart Disease and COPD as close neighbors to the Heart Failure vector.
Discussion
This study successfully demonstrates that clinical concept embeddings can capture underlying biological signals in national-scale EHR data. By compressing thousands of clinical codes into 250-dimensional vectors, the researchers achieved performance comparable to or better than manual feature engineering.
While the gains over one-hot encoding were marginal, the approach offers significant advantages in scalability and robustness across different healthcare systems (e.g., UK vs. US). However, limitations remain regarding the "black box" nature of embeddings, which can be less interpretable for clinicians than traditional checklists. Future work should explore more complex architectures like Recurrent Neural Networks (RNNs) to better capture the temporal order of clinical events and integrate continuous data such as laboratory values.
This paper summary is based on research presented at NIPS 2018.
Summary updated