Type 2 Diabetes Prediction
Spring 2026
A comparison of four ML classifiers on 253K CDC BRFSS survey records, tuned for screening: minority-class recall rose from 76% to 86% at ROC-AUC ≈ 0.82.

- clean records from a 441K-row, 330-column survey
- 253Kclean records from a 441K-row, 330-column survey
- minority-class recall at a screening-appropriate threshold
- 76% → 86%minority-class recall at a screening-appropriate threshold
- ROC-AUC across all four model families
- ≈ 0.82ROC-AUC across all four model families
Problem
Type 2 diabetes often goes undiagnosed for years, and every missed case delays treatment. The question was whether answers people already give on a routine health survey (blood pressure, cholesterol, BMI, activity, age) can flag who should get a follow-up test. For screening, the costs are lopsided. A missed case is far worse than a false alarm, which only leads to a cheap test. With roughly 84% of respondents non-diabetic, a model can look accurate while missing most real cases, so accuracy was the wrong target from the start.
Solution
I framed it as a screening decision rather than a leaderboard exercise:
- A reproducible data pipeline turning the CDC's raw BRFSS survey (441K records, 330 columns) into 253K clean records with 21 literature-grounded features
- Four model families compared on equal footing: logistic regression, linear SVM, kernel SVM and a PyTorch neural network, each tuned with 5-fold cross-validation
- An operating point chosen for the use case. The neural network was tuned to weight catching true cases twice as heavily as avoiding false alarms.
Outcome
All four models ranked risk about equally well, so the meaningful decision wasn't which model but where to set the threshold, and that choice belongs to the clinical use case. A well-regularized logistic regression proved competitive with the neural network while being far easier to explain to a clinician. That's a practical argument for the simpler model in a real deployment.
Results
- Recall on diabetic cases rose from 76% to 86% at a screening-appropriate threshold
- ROC-AUC ≈ 0.82 across all four model families
- 253K clean records from a 441K-row, 330-column public survey, reproducible end to end from the raw download
Technical details
Data and preprocessing
The data is the CDC Behavioral Risk Factor Surveillance System (BRFSS), an annual telephone survey of US adults. The pipeline:
- Narrows the 330 columns to 21 literature-grounded features, including blood pressure, cholesterol, BMI, general health, physical activity and age
- Cleans survey-specific missing and "refused" codes, recodes binary features, and rescales BMI
- Produces 253K clean records, split 80/20 with stratification, plus a class-balanced training set for the SVMs
It runs as standalone scripts (preprocessing.py → modeling.py) with dependencies locked through uv.
Models
- Logistic regression, an interpretable baseline with L1 regularization paths
- Linear SVM
- Kernel SVM (RBF)
- PyTorch MLP, iterated three times: Adam, then AdamW, then AdamW with a tuned positive-class weight
Tuning for screening
For the MLP, I tuned the precision/recall trade-off directly with a pos_weight on the loss and early stopping on F2 score, which weights recall twice as heavily as precision.
