Predicting Antibiotic Resistance in Hospitalized Patients by Applying Machine Learning to Electronic Medical Records

Ohad Lewin-Epstein, Shoham Baruch, Lilach Hadany, Gideon Y. Stein, Uri Obolski*

*Corresponding author for this work

Research output: Contribution to journalArticlepeer-review


Background: Computerized decision support systems are becoming increasingly prevalent with advances in data collection and machine learning (ML) algorithms. However, they are scarcely used for empiric antibiotic therapy. Here, we predict the antibiotic resistance profiles of bacterial infections of hospitalized patients using ML algorithms applied to patients' electronic medical records (EMRs). Methods: The data included antibiotic resistance results of bacterial cultures from hospitalized patients, alongside their EMRs. Five antibiotics were examined: ceftazidime (n = 2942), gentamicin (n = 4360), imipenem (n = 2235), ofloxacin (n = 3117), and sulfamethoxazole-trimethoprim (n = 3544). We applied lasso logistic regression, neural networks, gradient boosted trees, and an ensemble that combined all 3 algorithms, to predict antibiotic resistance. Variable influence was gauged by permutation tests and Shapely Additive Explanations analysis. Results: The ensemble outperformed the separate models and produced accurate predictions on test set data. When no knowledge regarding the infecting bacterial species was assumed, the ensemble yielded area under the receiver-operating characteristic (auROC) scores of 0.73-0.79 for different antibiotics. Including information regarding the bacterial species improved the auROCs to 0.8-0.88. Variables' effects on predictions were assessed and found to be consistent with previously identified risk factors for antibiotic resistance. Conclusions: We demonstrate the potential of ML to predict antibiotic resistance of bacterial infections of hospitalized patients. Moreover, we show that rapidly gained information regarding the infecting bacterial species can improve predictions substantially. Clinicians should consider the implementation of such systems to aid correct empiric therapy and to potentially reduce antibiotic misuse.

Original languageEnglish
Pages (from-to)E848-E855
JournalClinical Infectious Diseases
Issue number11
StatePublished - 1 Jun 2021


  • antibiotic resistance
  • database research
  • decision support systems
  • machine learning
  • prediction


Dive into the research topics of 'Predicting Antibiotic Resistance in Hospitalized Patients by Applying Machine Learning to Electronic Medical Records'. Together they form a unique fingerprint.

Cite this