Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Diabetes Prediction: Machine Learning Classification

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 & Problem

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.)

๐Ÿ› ๏ธ Methodology

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

  1. Logistic Regression: Baseline interpretable model
  2. Decision Tree Classifier: Balanced performance with full interpretability
  3. Random Forest Classifier: Highest accuracy ensemble approach

Evaluation: 5-fold cross-validation with accuracy, sensitivity, and specificity metrics

๐Ÿ“ˆ Key Results

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

๐Ÿ” Top Predictors (by importance)

  1. HbA1c (42.5%) โ€” Long-term blood glucose control
  2. Glucose Postprandial (19.7%) โ€” Post-meal glucose spikes
  3. Glucose Fasting (10%) โ€” Direct diabetes indicator
  4. Physical Activity (1.8%) โ€” Protective lifestyle factor
  5. BMI (1.6%) โ€” Body composition risk factor

๐Ÿ’ก Key Insights

  • 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

๐Ÿš€ Technical Skills Demonstrated

  • 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

๐Ÿ“ Project Structure

  • 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages