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.
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.
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.
- 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.ipynbcells 7–8) - Flask web frontend for uploading a patient CSV and retrieving predictions
- Python, PyTorch, scikit-learn, pandas, Flask
- Dataset: UCI Diabetes 130-US Hospitals
pip install torch scikit-learn pandas flask joblib
python frontend.pyOpen http://localhost:5000, upload a CSV matching the dataset schema, and get predictions.
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.