Skip to content

About

3-class diabetic-readmission classifier on the UCI 130-US-Hospitals dataset (101,766 encounters), with feature embeddings and a Flask inference frontend

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Diabetic Patient Readmission Classifier

Predicts whether a diabetic hospital patient will be readmitted within 30 days, after 30 days, or not at all, using the UCI Diabetes 130-US Hospitals dataset.

What it does

The project works across two notebooks. preprocessing.ipynb cleans and encodes the raw dataset — handling missing values, label-encoding categorical variables, and applying categorical embeddings for high-cardinality diagnosis codes. Neural_Network.ipynb runs feature-correlation analysis and trains a Decision Tree classifier as a baseline. A separate frontend.py serves a minimal Flask interface that accepts a CSV upload and runs inference using a saved model.joblib.

Dataset

UCI Diabetes 130-US Hospitals dataset: 101,766 encounter records (101,767 rows including header) spanning 15 years of inpatient care. The target column is readmitted with three classes: <30, >30, NO.

What the code shows

  • Data preprocessing: integer encoding of 34 features, age bucketing, 80/20 train/test split
  • Categorical embedding sizing for high-cardinality columns (e.g., diag_1: 717 categories → 50-dim embedding)
  • Baseline Decision Tree: accuracy 0.439, macro F1 0.348 (from cell output in Neural_Network.ipynb)
  • PyTorch training loop with entity embeddings, Adam optimiser, cross-entropy loss (preprocessing.ipynb cells 7–8)
  • Flask web frontend for uploading a patient CSV and retrieving predictions

Tech stack

How to run

pip install torch scikit-learn pandas flask joblib
python frontend.py

Open http://localhost:5000, upload a CSV matching the dataset schema, and get predictions.

Status

Academic project (2023). The PyTorch model skeleton in preprocessing.ipynb has stub Dataset/Model classes; the training loop is present but model weights were not committed. The Decision Tree baseline is fully runnable from model.joblib via the Flask frontend.

About

3-class diabetic-readmission classifier on the UCI 130-US-Hospitals dataset (101,766 encounters), with feature embeddings and a Flask inference frontend

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages