The production model is trained on Kaggle with the CDC Diabetes Health Indicators dataset, a cleaned BRFSS 2015 dataset with 253,680 survey responses and 21 health indicator features.
The original repo used a tiny synthetic CSV, which is useful for smoke tests but not strong enough for a portfolio-grade ML project. The CDC/BRFSS dataset adds:
- enough rows for meaningful train/test evaluation
- lifestyle, access, demographic, and clinical indicator features
- a binary diabetes/prediabetes risk target
- a public Kaggle workflow that produces reproducible artifacts
Running kaggle/kaggle_train.py creates:
artifacts/risk_model.joblibartifacts/metrics.jsonartifacts/model_card.md
The API loads artifacts/risk_model.joblib automatically through MODEL_ARTIFACT_PATH.
If the artifact is missing, the app falls back to data/patients.csv for local demos
and tests.
Production training is meant to run on Kaggle, not on your laptop:
./scripts/kaggle_run.shThat script:
- syncs
kernel-metadata.jsonwith your Kaggle username - pushes
kaggle/kaggle_train.py - waits for the kernel to finish
- downloads
risk_model.joblib,metrics.json, andmodel_card.mdintoartifacts/
Manual commands:
kaggle kernels push -p kaggle
kaggle kernels status aditya2402/healthcare-ai-diabetes-risk-training
kaggle kernels output aditya2402/healthcare-ai-diabetes-risk-training -p artifactsscripts/train_diabetes_model.py mirrors the Kaggle script for CI or offline debugging
only. Use Kaggle for the portfolio artifact.
The training script:
- Compares logistic regression, histogram gradient boosting, LightGBM, and random forest
- Ranks models with 5-fold stratified CV (ROC AUC)
- Runs RandomizedSearchCV on the top 2 models
- Applies isotonic calibration to all candidates
- Picks the winner on the holdout test set (ROC AUC, then F1)
Metrics include CV scores, Brier score, and tuned classification threshold.