What it is
A team project to predict diabetes and pre-diabetes in women over 21. A user enters eight health measurements into a web form and a trained model returns a prediction.
The data has 768 patients with pregnancies, glucose, blood pressure, skin thickness, insulin, BMI, diabetes pedigree function and age. We replaced outliers with each column’s median, split the data into training and test sets, and compared seven models.
Results
Test set of 231 patients:
| Model | Accuracy | Precision |
|---|---|---|
| Random forest | 81.8% | 91.1% |
| k-nearest neighbors | 78.8% | 93.2% |
| Logistic regression | 78.4% | 90.4% |
| Gaussian naive Bayes | 78.4% | 87.7% |
| Support vector machine | 77.1% | 94.5% |
| Decision tree | 67.5% | 78.8% |
| Neural network | 60.6% | 95.2% |
The random forest was pickled and served through Flask, with a deploy config for Heroku. We also used LazyPredict to check a wider set of models quickly.