Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hospital Readmission Prediction

Binary classification to identify diabetic patients at risk of readmission within 30 days of discharge, using clinical encounter data from 130 US hospitals.


Dataset

UCI — Diabetes 130-US Hospitals (1999–2008)

  • 101,766 patient encounters, 50 features
  • Target: readmitted within 30 days (<30) vs all other outcomes
  • Class imbalance: 11.4% positive class

Preprocessing

  • Dropped columns with >80% missing values: weight (97%), max_glu_serum (95%), A1Cresult (83%)
  • Dropped zero-variance columns: examide, citoglipton
  • Removed patients discharged to hospice or deceased (discharge codes 11, 13, 14, 19, 20, 21)
  • ICD-9 diagnosis codes mapped to 8 clinical categories (circulatory, respiratory, diabetes, etc.)
  • Age brackets encoded as ordinal integers; remaining categorical columns one-hot encoded
  • Missing values in race, diag_1/2/3 imputed with mode or placeholder

Final dataset: 99,343 rows, 93 columns


Modelling

Imbalance handling: RandomOverSampler applied inside each cross-validation fold via imblearn.Pipeline to prevent data leakage

Model selection: 5-fold stratified cross-validation on training data (80/20 split)

Model CV ROC-AUC CV Recall
Logistic Regression 0.646 ± 0.010 0.526 ± 0.010
Random Forest 0.640 ± 0.008 0.014 ± 0.002

Logistic Regression selected: higher ROC-AUC, substantially better recall across all folds.

Threshold tuning: default 0.5 threshold adjusted to 0.509 to achieve recall ≥ 0.50 while maximising precision.


Results

Model: Logistic Regression + RandomOverSampler | Threshold: 0.509

Class Precision Recall F1
Not readmitted 0.92 0.70 0.79
Readmitted <30d 0.18 0.51 0.26

ROC-AUC: 0.649 | Average Precision: 0.209

Of 2,263 high-risk patients in the test set, 1,144 were correctly flagged.


Limitations

ROC-AUC of ~0.65 is consistent with published results on this dataset (Strack et al., 2014). 30-day readmission is driven largely by factors absent from hospital records: social support, housing, post-discharge care quality, and medication adherence. This is a screening tool, not a diagnostic.


Structure

hospital_readmission/
├── data/
│   ├── diabetic_data.csv          # Raw data (download from UCI)
│   └── cleaned_data.csv
├── notebooks/
│   ├── 01_setup_and_first_look.ipynb
│   ├── 02_eda.ipynb
│   └── 03_modelling_v2.ipynb
└── outputs/

Setup

pip install pandas scikit-learn imbalanced-learn matplotlib seaborn jupyter

Download diabetic_data.csv from UCI (link above) and place in data/.


Reference

Strack et al. (2014). Impact of HbA1c Measurement on Hospital Readmission Rates. BioMed Research International.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages