# Scalable and accurate deep learning for electronic health records

Deep learning on raw EHR records predicts several clinical events across hospitals

Alvin Rajkomar, Eyal Oren, Kai Chen, Andrew M. Dai, Nissan Hajaj, Peter J. Liu and 28 more · arXiv · 2018-1-24

- **Problem** Predictive models built on electronic health records usually rely on a few hand-picked variables, and each new outcome needs its own custom dataset. This discards most of each patient's record and does not scale across outcomes or sites.
- **Method** The authors convert each patient's full record into one time-ordered sequence of FHIR-based tokens. Three deep learning architectures trained on that sequence are then combined by ensembling.
- **Results** For inpatient mortality at 24 hours after admission at Hospital A, the model reached an AUROC of 0.95 (95% CI 0.94-0.96). The aEWS baseline reached 0.85 (0.81-0.89).

## Why EHR prediction scales poorly

Conventional workflows build a separate dataset for each outcome, with a chosen set of variables, and most of the effort goes into cleaning and merging that data rather than analysing it. The EHR can contain thousands of candidate predictors once free-text notes are counted, so traditional models usually keep only a small set of commonly collected variables.

Models built on such a small set can raise many false alarms, which contributes to alert fatigue, or miss clinically important events. Using the whole record would address these shortcomings, but conventional techniques cannot handle that volume of inputs.

Deep learning systems tolerate large volumes of messy data and many input variables, and they learn representations of the relevant factors and their interactions from the data itself. The authors' central idea is to skip explicit harmonization into curated predictors and let the model learn the mapping directly from the raw records.

## One time-ordered token sequence per patient

Each clinical event is mapped to a FHIR resource, which gives a common container for events while leaving each site's own codings in place. A medication order, for example, can carry its trade name, generic name and ingredients as separate attributes within one resource.

Each attribute is split into discrete values called tokens, and note text is split into one token per word. Numeric values are normalized, with the procedure given in the supplement.

The model input for a prediction is the full sequence of time-ordered tokens from the start of the record up to the moment the prediction is made. Because the same structure serves every task, no task-specific dataset is built, and the predictions differ only by the cut-off time. The token count grows over a stay: an average admission had 137,882 tokens at admission and 216,744 at discharge, and the discharge predictions drew on 46,864,534,945 tokens across both datasets.

## Three architectures and their ensemble

Patient records differ widely in length and density, so the authors built three architectures that use this data in different ways. They are a recurrent network based on long short-term memory, an attention-based time-aware neural network (TANN), and a neural network built on boosted time-based decision stumps. Their architecture details are given in the supplement.

The outputs of the three architectures are then combined by ensembling. The LSTM and TANN models were trained in TensorFlow, and the boosting model was implemented in C++.

The same attention-based idea also supports the case study, where TANNs were trained separately on each data type, such as flowsheets and notes. Attribution mechanisms are then used to show which data elements influenced an individual prediction.

## Cohorts, splits and baselines

Hospital A is the University of California, San Francisco, with data from 2012 to 2016, and Hospital B is the University of Chicago Medicine, with data from 2009 to 2016. Only the Chicago dataset contained free-text medical notes, so the two sites differ in more than size.

The study covers 216,221 hospitalizations involving 114,003 unique patients, and the cohort is limited to adults hospitalized for at least 24 h. Confidence intervals come from 1000 bootstrapped samples of the test set.

The mortality baseline, aEWS, is a logistic model with 28 factors, built from NEWS-inspired variables plus recent vital signs and 24 common laboratory tests. The readmission baseline, mHOSPITAL, and the length-of-stay baseline, mLiu, are also logistic models that reuse variables from the HOSPITAL score and from Liu's model respectively.

For mortality, predictions are made every 12 h from 24 h before admission to 24 h after admission. Readmission and diagnoses are predicted at admission, at 24 h and at discharge, and length of stay at admission and at 24 h. Discrimination is measured by AUROC, alert burden by the work-up-to-detection ratio at 80% sensitivity, and diagnosis accuracy by micro-F1 and weighted AUROC.

## Inpatient mortality results

At 24 h after admission, the AUROC was 0.95 (95% CI 0.94-0.96) at Hospital A and 0.93 (95% CI 0.92-0.94) at Hospital B. The aEWS baseline at the same time point reached 0.85 (0.81-0.89) at Hospital A and 0.86 (0.83-0.88) at Hospital B, and the authors describe the gap as significant.

As an alert measure at 24 h, the work-up-to-detection ratio was 7.4 against 14.3 for aEWS at Hospital A, and 8.0 against 15.4 at Hospital B. Because this ratio is computed at 80% sensitivity, it expresses how many flagged patients a team must evaluate per detected death, and the authors read the halving as fewer false alerts.

The authors report that the model reached a similar accuracy 24 to 48 h earlier than the traditional models, with 48 h earlier at UCSF, which is Hospital A, and about 24 h earlier at UCM.

## Readmission and length of stay results

For unplanned 30-day readmission at discharge, the AUROCs were 0.77 (95% CI 0.75-0.78) at Hospital A and 0.76 (95% CI 0.75-0.77) at Hospital B. The modified HOSPITAL baseline at discharge reached 0.70 (0.68-0.72) and 0.68 (0.67-0.69), and the authors describe the difference as significant. Readmissions were counted only when they returned to the same institution, and billing diagnoses from the index stay were excluded from the predictors.

The modified Liu baseline at the same time reached 0.76 (0.75-0.77) and 0.74 (0.73-0.75), and the length-of-stay threshold of 7 days was roughly the 75th percentile of stays.

The readmission AUROC at admission was 0.73 and 0.72, and at 24 h it was 0.74 and 0.73, so the model gains over the stay. The authors compare these results with published models, but those studies differ in design, cohort and outcome definitions, so the comparison is not a controlled one.

## Predicting the full set of discharge diagnoses

The task predicts primary and secondary ICD-9 billing diagnoses drawn from 14,025 codes, and a patient can have between 1 and 228 diagnoses. Predictions were made at admission, at 24 h after admission and at discharge.

The weighted AUROC for classifying all diagnosis codes was 0.87 at admission for Hospital A and 0.86 for Hospital B, rising to 0.89 and 0.88 at 24 h, and to 0.90 at both hospitals at discharge.

A predicted code counted as correct only when its full length matched, so 250.4 and 250.42 are treated as different codes. At discharge the micro-F1 scores were 0.41 at Hospital A and 0.40 at Hospital B. The authors set this against a smaller MIMIC-III study that predicted fewer diagnoses and reported 0.28, which is a literature comparison rather than a controlled one.

The authors note that many ICD-9 codes are clinically close but numerically distinct, which adds random error to the prediction.

## Seeing which tokens a prediction used

For one patient who died 10 days after admission, the deep learning model gave a 19.9% risk of death at 24 h, while the aEWS model gave 9.3%. The record held 175,639 tokens, and attribution highlights the tokens the model attended to in the first 24 h of the most recent stay.

The highlighted tokens include notes describing malignant pleural effusions and empyema, antibiotics given, and nursing documentation of a high pressure ulcer risk on the Braden index, along with the concept 'pleurx'.

The authors present this as a proof-of-concept drawn from one patient and one architecture, not as a general validation of interpretability.

## Limitations

The study is retrospective, and the authors state that prospective trials are needed before accurate predictions can be shown to improve care.

The study focuses on overall predictive accuracy, so the incremental contribution of clinical notes was not isolated. The cohorts differ between the two hospitals, so the AUROC differences cannot be attributed to the presence or absence of notes.

The approach does not harmonize data between sites, so transfer of a model trained at one site to another was not tested, and the two sites give only a first step.

## Paper info

- **Authors**: Alvin Rajkomar, Eyal Oren, Kai Chen, Andrew M. Dai, Nissan Hajaj, Peter J. Liu, Xiaobing Liu, Mimi Sun, Patrik Sundberg, Hector Yee, Kun Zhang, Gavin E. Duggan, Gerardo Flores, Michaela Hardt, Jamie Irvine, Quoc Le, Kurt Litsch, Jake Marcus, Alexander Mossin, Justin Tansuwan, De Wang, James Wexler, Jimbo Wilson, Dana Ludwig, Samuel L. Volchenboum, Katherine Chou, Michael Pearson, Srinivasan Madabushi, Nigam H. Shah, Atul J. Butte, Michael Howell, Claire Cui, Greg Corrado, Jeff Dean
- **Venue**: arXiv · Preprint
- **First published**: 2018-1-24
- **Added**: 2026-11-12
- **Updated**: 2018-5-11
- **Version**: v3
- **arXiv**: 1801.07860
- **DOI**: 10.1038/s41746-018-0029-1
- **Category**: cs.CY · cs.LG
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1801.07860v3) · [PDF ↗](https://arxiv.org/pdf/1801.07860v3)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Alvin Rajkomar, Eyal Oren, Kai Chen, Andrew M. Dai, Nissan Hajaj, Peter J. Liu, Xiaobing Liu, Mimi Sun, Patrik Sundberg, Hector Yee, Kun Zhang, Gavin E. Duggan, Gerardo Flores, Michaela Hardt, Jamie Irvine, Quoc Le, Kurt Litsch, Jake Marcus, Alexander Mossin, Justin Tansuwan et al. (2018). Scalable and accurate deep learning for electronic health records. arXiv:1801.07860v3. https://doi.org/10.1038/s41746-018-0029-1

**BibTeX**

```
@article{rajkomar2018scalable,
  title = {{Scalable and accurate deep learning for electronic health records}},
  author = {Alvin Rajkomar and Eyal Oren and Kai Chen and Andrew M. Dai and Nissan Hajaj and Peter J. Liu and Xiaobing Liu and Mimi Sun and Patrik Sundberg and Hector Yee and Kun Zhang and Gavin E. Duggan and Gerardo Flores and Michaela Hardt and Jamie Irvine and Quoc Le and Kurt Litsch and Jake Marcus and Alexander Mossin and Justin Tansuwan and De Wang and James Wexler and Jimbo Wilson and Dana Ludwig and Samuel L. Volchenboum and Katherine Chou and Michael Pearson and Srinivasan Madabushi and Nigam H. Shah and Atul J. Butte and Michael Howell and Claire Cui and Greg Corrado and Jeff Dean},
  year = {2018},
  eprint = {1801.07860},
  archivePrefix = {arXiv},
  doi = {10.1038/s41746-018-0029-1},
  url = {https://arxiv.org/abs/1801.07860v3}
}
```

## Other paper commentary

- [A Comparative Analysis of XGBoost](https://refivu.com/en/papers/e2cd85b1-68fe-463c-be8d-ad73613040b8-a-comparative-analysis-of-xgboost.md)
- [Deep learning for time series classification: a review](https://refivu.com/en/papers/29b2a81b-5835-4366-b268-5617285bb0b9-deep-learning-for-time-series-classification-a-review.md)
- [Model Cards for Model Reporting](https://refivu.com/en/papers/9ad193b1-a348-4853-9835-2faeecfe0dc1-model-cards-for-model-reporting.md)
- [Generalizing from a Few Examples: A Survey on Few-Shot Learning](https://refivu.com/en/papers/8988e143-7a9e-4146-9f9b-40c8e0cb6bb2-generalizing-from-a-few-examples-a-survey-on.md)
- [CatBoost: unbiased boosting with categorical features](https://refivu.com/en/papers/2bddd7a0-b14d-422c-836d-b47da78a26fd-catboost-unbiased-boosting-with-categorical-features.md)
- [Datasheets for Datasets](https://refivu.com/en/papers/aac36b7e-c8f1-4fe7-a9fb-2e09532542d6-datasheets-for-datasets.md)
- [Colorful Image Colorization](https://refivu.com/en/papers/15523601-cc75-4645-8e4f-8d58aa39d74f-colorful-image-colorization.md)
- [Deep Neural Networks are Easily Fooled: High Confidence Predictions for Unrecognizable Images](https://refivu.com/en/papers/f4c978c2-8ce0-412c-af24-4039197ac185-deep-neural-networks-are-easily-fooled-high-confidence.md)
- [Continual Lifelong Learning with Neural Networks: A Review](https://refivu.com/en/papers/322eae66-d551-4a11-a5e4-5955f903b100-continual-lifelong-learning-with-neural-networks-a-review.md)
- [BDD100K: A Diverse Driving Dataset for Heterogeneous Multitask Learning](https://refivu.com/en/papers/d564e564-2508-4ec4-987a-011445b39696-bdd100k-a-diverse-driving-dataset-for-heterogeneous.md)
- [Improved Semantic Representations From Tree-Structured Long Short-Term Memory Networks](https://refivu.com/en/papers/1c58c569-ccc9-46f2-b934-b34b865af6d4-improved-semantic-representations-from-tree-structured-long.md)
- [The Effectiveness of Data Augmentation in Image Classification using Deep Learning](https://refivu.com/en/papers/dce0e6e2-408a-4750-8e27-0acf7a41b5e6-the-effectiveness-of-data-augmentation-in-image.md)

## Terms in this paper

- [LSTM](https://refivu.com/en/terms/ba10547646d9-lstm)
- [AUROC](https://refivu.com/en/terms/096f06e69425-auroc)
- [Micro-F1](https://refivu.com/en/terms/984be90cfb2a-micro-f1)
- [Token](https://refivu.com/en/terms/130ef85207eb-token)
- [Ensembling](https://refivu.com/en/terms/e69eb594db3c-ensembling)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/80cf3810-6b7d-4305-b76c-de501726decd-scalable-and-accurate-deep-learning-for-electronic-health)
