A collaborative classification project developed with team members Luke Finkielstein, Olivia Ngai, and Phuong Thao Nguyen. The project predicts diabetes diagnosis using machine learning models trained on 97,297 health and lifestyle records. Compares logistic regression, decision tree, and random forest classifiers to identify the strongest predictors of diabetes risk.
Dataset: Health and Lifestyle Data for Diabetes Prediction (Kaggle)
Size: 97,297 individuals with 31 variables
Goal: Binary classificationโpredict diagnosed diabetes (1) vs. non-diabetic (0)
Features: Demographics, lifestyle behaviors, medical history, and clinical measurements (glucose, BMI, blood pressure, cholesterol, etc.)
Feature Engineering
- High-risk glucose flag (fasting glucose โฅ126 mg/dL)
- Obesity indicator (BMI โฅ30)
- LDL/HDL cholesterol ratio
- BMI ร Age interaction term
Models Developed
- Logistic Regression: Baseline interpretable model
- Decision Tree Classifier: Balanced performance with full interpretability
- Random Forest Classifier: Highest accuracy ensemble approach
Evaluation: 5-fold cross-validation with accuracy, sensitivity, and specificity metrics
| Model | Accuracy | Sensitivity | Specificity |
|---|---|---|---|
| Logistic Regression | 73.1% | 81.8% | 60.1% |
| Decision Tree | 86.2% | 89.4% | 81.1% |
| Random Forest | 92.1% | 86.8% | 99.9% |
Final Model Selected: Decision Tree Classifier
- Best balance of sensitivity and specificity
- Fully interpretable decision rules
- 89.4% sensitivity ensures diabetic cases aren't missed
- HbA1c (42.5%) โ Long-term blood glucose control
- Glucose Postprandial (19.7%) โ Post-meal glucose spikes
- Glucose Fasting (10%) โ Direct diabetes indicator
- Physical Activity (1.8%) โ Protective lifestyle factor
- BMI (1.6%) โ Body composition risk factor
- Glucose-related measures (HbA1c, fasting, postprandial) are dominant predictorsโaccounting for ~72% of model importance
- Physical activity has a protective effect, reducing diabetes risk
- The decision tree reveals clear thresholds: HbA1c >6.5% and glucose >125 mg/dL strongly signal diabetes
- Model achieves high sensitivity (89%), critical for identifying at-risk patients and preventing missed diagnoses
- Exploratory Data Analysis and visualization
- Feature engineering based on clinical knowledge
- Logistic regression model fitting and interpretation
- Decision tree construction with cost-complexity pruning and cross-validation
- Random forest ensemble methods and feature importance analysis
- Multiclass evaluation metrics (accuracy, sensitivity, specificity, ROC-AUC)
- Python: pandas, scikit-learn, statsmodels, matplotlib, seaborn
- EDA: Distribution analysis, correlation heatmaps, box plots, scatterplots
- Feature Engineering: Domain-informed variable creation and encoding
- Model Development: Three classification approaches with hyperparameter tuning
- Cross-Validation: 5-fold CV for stable, unbiased performance assessment
- Predictions: Example "new patient" predictions demonstrating model behavior