← all work

Machine Learning for Diabetes Risk Prediction

96% accuracy, 0.993 AUC, and a web form to act on it.

  • XGBoost
  • Random Forest
  • FastAPI
diabetes-prediction / models/XGBClassifier.ipynb
xgb_model = XGBClassifier()
xgb_model.fit(X_train, y_train)
y_proba = xgb_model.predict_proba(X_test)[:, 1]
# test AUC: 0.993
why
a model sitting in a notebook doesn't help anyone. i wanted the prediction to be one form-submit away.
how it works
15,000 clinical records are cleaned down to 10,471, then random forest and XGBoost are compared; XGBoost won (0.993 vs 0.983 AUC) and ships behind a FastAPI endpoint.
what i learned
the feature-engineering pass moved the needle more than swapping algorithms did.
results
0.993 AUC and 96.1% accuracy on 2,095 held-out records.

the FastAPI endpoint returns a diabetes probability from the saved XGBoost model.