clarasellam's picture
Added EDA plots, video, and final README
8ba6726 verified

CDC Diabetes Health Indicators Analysis

Project Overview

This project aims to explore the CDC Diabetes Health Indicators Dataset to identify key health, lifestyle, and socio-economic factors associated with diabetes prevalence.
We perform exploratory data analysis (EDA), data cleaning, and Logistic Regression modeling on balanced data.
The goal is to extract actionable insights, understand class imbalances, and identify the most influential predictors of diabetes.devoir

Dataset

  • Name: CDC Diabetes Health Indicators Dataset
  • Source: Downloaded from Kaggle using kagglehub
  • Content: Over 250,000 observations of health and lifestyle factors
  • Format: CSV, with multiple columns corresponding to health indicators, lifestyle choices, and socio-economic factors

Initial Verification: The dataset contains df.shape[0] rows and df.shape[1] columns.

2.2 Data Cleaning

  • Duplicate Handling: Checked for exact duplicate rows across all features and removed them to ensure each observation is unique.
  • Missing Values Check: Verified that there are no missing values in the dataset.
  • Result: The dataset is clean, complete, and ready for analysis.

2.3 Target Variable Analysis: Class Imbalance

  • Objective: Assess the distribution of the target variable Diabetes_binary to detect potential class imbalance.
  • Quantification: Calculated counts and percentages of each class.
  • Visualization: Bar plot illustrating the number of non-diabetic vs diabetic/pre-diabetic individuals.

Observation: The dataset exhibits a class imbalance, which is common in health datasets and must be considered for model training.

Class Imbalance Visualization:
Class Imbalance

4.1 Socio-Economic Factor: Income vs. Diabetes

  • Objective: Explore the relationship between income levels (1 = lowest, 8 = highest) and diabetes prevalence.
  • Calculation: Average diabetes rate per income category.
  • Visualization: Bar plot showing diabetes prevalence across income levels.

Observation:

  • Diabetes prevalence decreases steadily with increasing income.
  • Low-income categories (1 and 2) show ~25% diabetes prevalence, while the highest income category (8) shows ~10%.
  • Confirms the hypothesis that socio-economic status strongly affects diabetes risk.

Income vs Diabetes Visualization:
Income vs Diabetes

4.2 Socio-Economic Factor: Education vs. Diabetes

  • Objective: Assess how education level (1 = lowest, 6 = highest) correlates with diabetes prevalence.
  • Calculation: Average diabetes rate per education level.
  • Visualization: Bar plot comparing prevalence across educational attainment.

Observation:

  • Lowest education levels (1 and 2) have the highest diabetes prevalence (~30%).
  • Highest education levels (5 and 6) show significantly lower prevalence.
  • Reinforces the finding from the income analysis: socio-economic factors are strong, interconnected predictors.

Education vs Diabetes Visualization:
Education vs Diabetes

4.3 Lifestyle Factors: Smoking and Physical Activity

  • Objective: Evaluate how key lifestyle factors affect diabetes prevalence.
  • Factors Analyzed: Smoking status and regular physical activity.
  • Visualization: Side-by-side bar plots comparing diabetes prevalence by smoking status and physical activity.

Observations:

  • Smokers have a higher diabetes rate than non-smokers.
  • Physically active individuals have a substantially lower diabetes rate.
  • Confirms that harmful habits increase risk while healthy behaviors are protective.

Visualization:
Smoking and Physical Activity

4.4 Physiological Factor: Body Mass Index (BMI)

  • Objective: Examine BMI distributions by diabetes status.
  • Visualization: Box plot comparing BMI between diabetic and non-diabetic individuals.
  • Reference: Horizontal line at BMI = 30 (obesity threshold).

Observations:

  • Diabetic individuals have a substantially higher median BMI than non-diabetics.
  • Most diabetic individuals lie above BMI 30, confirming BMI as a high-impact predictor.
  • The distributions are well separated, indicating BMI is highly discriminative.

Visualization:
BMI Distribution

4.5 Physiological Factor: Age

  • Objective: Compare age distributions between diabetic and non-diabetic individuals.
  • Visualization: Box plot of age by diabetes status.

Observations:

  • Diabetic individuals are older on average, with a wider upper quartile.
  • Non-diabetics are younger, with a tighter distribution.
  • Age is an important demographic predictor of diabetes.

Visualization:
Age Distribution

5.1 Logistic Regression: Balanced Training

  • Objective: Train a Logistic Regression model on balanced and scaled training data to address class imbalance.
  • Evaluation: Tested on the original (unbalanced) test set.
  • Metrics: Confusion matrix, classification report (precision, recall, F1-score), and ROC AUC score.

Key Insights:

  • Balancing the training data improves recall for the diabetic class, reducing false negatives.
  • F1-score shows improved balance between precision and recall for minority class.
  • ROC AUC confirms strong discriminative power of the model.
  • Suggests Logistic Regression is an effective baseline; further exploration with non-linear models could improve performance.

5.2 ROC Curve and AUC Analysis

  • Objective: Visualize model performance and evaluate discriminative power using the ROC curve.
  • Visualization: Orange line = model performance; Blue diagonal = random classifier baseline (AUC = 0.50).

Observation:

  • The model’s ROC curve lies well above the baseline, confirming strong discriminative ability.
  • Final AUC score quantitatively supports model effectiveness.
  • Confirms that balancing the training data yields a robust baseline model for diabetes prediction.

Visualization:
ROC Logistic Regression

Final Insights

  • Socio-economic factors (Income, Education) are strongly correlated with diabetes prevalence.
  • Lifestyle factors such as Smoking and Physical Activity significantly influence diabetes risk.
  • Physiological factors (BMI, Age) are dominant predictors.
  • Logistic Regression trained on balanced data provides a robust and interpretable baseline model.
  • Future work could include testing non-linear models, ensemble methods, or feature engineering to further improve predictive performance.

How to Use This Dataset and Notebook

  • The dataset can be used to explore health, lifestyle, and socio-economic predictors of diabetes.
  • The notebook provides step-by-step EDA and visualization examples.
  • Logistic Regression serves as a baseline classification model.
  • All plots are included and can be reused in reports or presentations.