Missing a diabetic costs more than a false alarm, so the model was tuned for recall rather than for accuracy.
01
Ensembling x threshold choice
Tuning for the cases that matter
On a screening problem, a false alarm costs a second test. A miss costs a diagnosis.
I tuned for recall on the positive class, not overall accuracy. The final decision threshold was tuned for F1 instead of left at the 0.5 default.
Five models vote. A logistic regression meta-model learns how to weigh them.
- A neural network with its architecture searched by Optuna
- A CNN reading the features reshaped into a 4x2 grid
- Random Forest, Gradient Boosting and LightGBM
- TPOT evolving pipelines through genetic search
Feature engineering followed clinical reasoning: glucose against BMI, glucose against insulin for resistance, age against BMI, and a binary flag at the BMI 30 threshold. Medically impossible zeros were replaced with medians before any of it ran.
Result
A test that misses sick people is not accurate, it is dangerous.
- 85%
- recall on actual diabetics
- 0.89
- ROC-AUC
- 80%
- accuracy, past the dataset's 77% ceiling