Added EDA plots, video, and final README
Browse files- devoir data/.DS_Store +0 -0
- devoir data/Age.png +3 -0
- devoir data/BMI (1).png +3 -0
- devoir data/Mon film.mov +3 -0
- devoir data/README.md +153 -0
- devoir data/Untitled3 (5).ipynb +0 -0
- devoir data/classibalance (1).png +3 -0
- devoir data/eucation (1).png +3 -0
- devoir data/income (1).png +3 -0
- devoir data/smokingandphysical (1).png +3 -0
devoir data/.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
devoir data/Age.png
ADDED
|
Git LFS Details
|
devoir data/BMI (1).png
ADDED
|
Git LFS Details
|
devoir data/Mon film.mov
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:adb2d6957530b146c48a24f90de58bb56089b09d4d033788b4ca7b838700437c
|
| 3 |
+
size 165123907
|
devoir data/README.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CDC Diabetes Health Indicators Analysis
|
| 2 |
+
|
| 3 |
+
## Project Overview
|
| 4 |
+
This project aims to explore the CDC Diabetes Health Indicators Dataset to identify key health, lifestyle, and socio-economic factors associated with diabetes prevalence.
|
| 5 |
+
We perform **exploratory data analysis (EDA)**, **data cleaning**, and **Logistic Regression modeling** on balanced data.
|
| 6 |
+
The goal is to extract actionable insights, understand class imbalances, and identify the most influential predictors of diabetes.devoir
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
## Dataset
|
| 10 |
+
|
| 11 |
+
- **Name**: CDC Diabetes Health Indicators Dataset
|
| 12 |
+
- **Source**: Downloaded from Kaggle using `kagglehub`
|
| 13 |
+
- **Content**: Over 250,000 observations of health and lifestyle factors
|
| 14 |
+
- **Format**: CSV, with multiple columns corresponding to health indicators, lifestyle choices, and socio-economic factors
|
| 15 |
+
|
| 16 |
+
**Initial Verification**: The dataset contains `df.shape[0]` rows and `df.shape[1]` columns.
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
## 2.2 Data Cleaning
|
| 20 |
+
|
| 21 |
+
- **Duplicate Handling**: Checked for exact duplicate rows across all features and removed them to ensure each observation is unique.
|
| 22 |
+
- **Missing Values Check**: Verified that there are no missing values in the dataset.
|
| 23 |
+
- **Result**: The dataset is clean, complete, and ready for analysis.
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
## 2.3 Target Variable Analysis: Class Imbalance
|
| 27 |
+
|
| 28 |
+
- **Objective**: Assess the distribution of the target variable `Diabetes_binary` to detect potential class imbalance.
|
| 29 |
+
- **Quantification**: Calculated counts and percentages of each class.
|
| 30 |
+
- **Visualization**: Bar plot illustrating the number of non-diabetic vs diabetic/pre-diabetic individuals.
|
| 31 |
+
|
| 32 |
+
**Observation**: The dataset exhibits a class imbalance, which is common in health datasets and must be considered for model training.
|
| 33 |
+
|
| 34 |
+
**Class Imbalance Visualization**:
|
| 35 |
+

|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
## 4.1 Socio-Economic Factor: Income vs. Diabetes
|
| 39 |
+
|
| 40 |
+
- **Objective**: Explore the relationship between income levels (1 = lowest, 8 = highest) and diabetes prevalence.
|
| 41 |
+
- **Calculation**: Average diabetes rate per income category.
|
| 42 |
+
- **Visualization**: Bar plot showing diabetes prevalence across income levels.
|
| 43 |
+
|
| 44 |
+
**Observation**:
|
| 45 |
+
- Diabetes prevalence decreases steadily with increasing income.
|
| 46 |
+
- Low-income categories (1 and 2) show ~25% diabetes prevalence, while the highest income category (8) shows ~10%.
|
| 47 |
+
- Confirms the hypothesis that socio-economic status strongly affects diabetes risk.
|
| 48 |
+
|
| 49 |
+
**Income vs Diabetes Visualization**:
|
| 50 |
+

|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
## 4.2 Socio-Economic Factor: Education vs. Diabetes
|
| 54 |
+
|
| 55 |
+
- **Objective**: Assess how education level (1 = lowest, 6 = highest) correlates with diabetes prevalence.
|
| 56 |
+
- **Calculation**: Average diabetes rate per education level.
|
| 57 |
+
- **Visualization**: Bar plot comparing prevalence across educational attainment.
|
| 58 |
+
|
| 59 |
+
**Observation**:
|
| 60 |
+
- Lowest education levels (1 and 2) have the highest diabetes prevalence (~30%).
|
| 61 |
+
- Highest education levels (5 and 6) show significantly lower prevalence.
|
| 62 |
+
- Reinforces the finding from the income analysis: socio-economic factors are strong, interconnected predictors.
|
| 63 |
+
|
| 64 |
+
**Education vs Diabetes Visualization**:
|
| 65 |
+

|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
## 4.3 Lifestyle Factors: Smoking and Physical Activity
|
| 69 |
+
|
| 70 |
+
- **Objective**: Evaluate how key lifestyle factors affect diabetes prevalence.
|
| 71 |
+
- **Factors Analyzed**: Smoking status and regular physical activity.
|
| 72 |
+
- **Visualization**: Side-by-side bar plots comparing diabetes prevalence by smoking status and physical activity.
|
| 73 |
+
|
| 74 |
+
**Observations**:
|
| 75 |
+
- Smokers have a higher diabetes rate than non-smokers.
|
| 76 |
+
- Physically active individuals have a substantially lower diabetes rate.
|
| 77 |
+
- Confirms that harmful habits increase risk while healthy behaviors are protective.
|
| 78 |
+
|
| 79 |
+
**Visualization**:
|
| 80 |
+

|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
## 4.4 Physiological Factor: Body Mass Index (BMI)
|
| 84 |
+
|
| 85 |
+
- **Objective**: Examine BMI distributions by diabetes status.
|
| 86 |
+
- **Visualization**: Box plot comparing BMI between diabetic and non-diabetic individuals.
|
| 87 |
+
- **Reference**: Horizontal line at BMI = 30 (obesity threshold).
|
| 88 |
+
|
| 89 |
+
**Observations**:
|
| 90 |
+
- Diabetic individuals have a substantially higher median BMI than non-diabetics.
|
| 91 |
+
- Most diabetic individuals lie above BMI 30, confirming BMI as a high-impact predictor.
|
| 92 |
+
- The distributions are well separated, indicating BMI is highly discriminative.
|
| 93 |
+
|
| 94 |
+
**Visualization**:
|
| 95 |
+

|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
## 4.5 Physiological Factor: Age
|
| 99 |
+
|
| 100 |
+
- **Objective**: Compare age distributions between diabetic and non-diabetic individuals.
|
| 101 |
+
- **Visualization**: Box plot of age by diabetes status.
|
| 102 |
+
|
| 103 |
+
**Observations**:
|
| 104 |
+
- Diabetic individuals are older on average, with a wider upper quartile.
|
| 105 |
+
- Non-diabetics are younger, with a tighter distribution.
|
| 106 |
+
- Age is an important demographic predictor of diabetes.
|
| 107 |
+
|
| 108 |
+
**Visualization**:
|
| 109 |
+

|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
## 5.1 Logistic Regression: Balanced Training
|
| 113 |
+
|
| 114 |
+
- **Objective**: Train a Logistic Regression model on **balanced and scaled training data** to address class imbalance.
|
| 115 |
+
- **Evaluation**: Tested on the original (unbalanced) test set.
|
| 116 |
+
- **Metrics**: Confusion matrix, classification report (precision, recall, F1-score), and ROC AUC score.
|
| 117 |
+
|
| 118 |
+
**Key Insights**:
|
| 119 |
+
- Balancing the training data improves recall for the diabetic class, reducing false negatives.
|
| 120 |
+
- F1-score shows improved balance between precision and recall for minority class.
|
| 121 |
+
- ROC AUC confirms strong discriminative power of the model.
|
| 122 |
+
- Suggests Logistic Regression is an effective baseline; further exploration with non-linear models could improve performance.
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
## 5.2 ROC Curve and AUC Analysis
|
| 126 |
+
|
| 127 |
+
- **Objective**: Visualize model performance and evaluate discriminative power using the ROC curve.
|
| 128 |
+
- **Visualization**: Orange line = model performance; Blue diagonal = random classifier baseline (AUC = 0.50).
|
| 129 |
+
|
| 130 |
+
**Observation**:
|
| 131 |
+
- The model’s ROC curve lies well above the baseline, confirming strong discriminative ability.
|
| 132 |
+
- Final AUC score quantitatively supports model effectiveness.
|
| 133 |
+
- Confirms that balancing the training data yields a robust baseline model for diabetes prediction.
|
| 134 |
+
|
| 135 |
+
**Visualization**:
|
| 136 |
+

|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
## Final Insights
|
| 140 |
+
|
| 141 |
+
- Socio-economic factors (Income, Education) are strongly correlated with diabetes prevalence.
|
| 142 |
+
- Lifestyle factors such as Smoking and Physical Activity significantly influence diabetes risk.
|
| 143 |
+
- Physiological factors (BMI, Age) are dominant predictors.
|
| 144 |
+
- Logistic Regression trained on balanced data provides a robust and interpretable baseline model.
|
| 145 |
+
- Future work could include testing non-linear models, ensemble methods, or feature engineering to further improve predictive performance.
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
## How to Use This Dataset and Notebook
|
| 149 |
+
|
| 150 |
+
- The dataset can be used to explore health, lifestyle, and socio-economic predictors of diabetes.
|
| 151 |
+
- The notebook provides step-by-step EDA and visualization examples.
|
| 152 |
+
- Logistic Regression serves as a baseline classification model.
|
| 153 |
+
- All plots are included and can be reused in reports or presentations.
|
devoir data/Untitled3 (5).ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
devoir data/classibalance (1).png
ADDED
|
Git LFS Details
|
devoir data/eucation (1).png
ADDED
|
Git LFS Details
|
devoir data/income (1).png
ADDED
|
Git LFS Details
|
devoir data/smokingandphysical (1).png
ADDED
|
Git LFS Details
|