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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
task_categories:
|
| 4 |
+
- tabular-classification
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- diabetes
|
| 9 |
+
- health
|
| 10 |
+
- medical
|
| 11 |
+
- tablur
|
| 12 |
+
- EDA
|
| 13 |
+
- classification
|
| 14 |
+
pretty_name: Diabetes Health EDA Dataset
|
| 15 |
+
size_categories:
|
| 16 |
+
- 100K<n<1M
|
| 17 |
+
---
|
| 18 |
+
# Diabetes Dataset — Exploratory Data Analysis (EDA)
|
| 19 |
+
|
| 20 |
+
This repository contains a diabetes-related tabular dataset and a full Exploratory Data Analysis (EDA).
|
| 21 |
+
The main objective of this project was to learn how to perform a proper, structured EDA, understand best practices, and extract meaningful insights and conclusions from real-world health data.
|
| 22 |
+
|
| 23 |
+
The analysis includes correlations, distributions, group comparisons, class balance exploration, and statistical interpretations that help illustrate how different features relate to diabetes risk.
|
| 24 |
+
|
| 25 |
+
## Project Goals
|
| 26 |
+
|
| 27 |
+
The purpose of this project is to conduct a complete and structured Exploratory Data Analysis (EDA) on a large synthetic diabetes dataset. The objectives include:
|
| 28 |
+
|
| 29 |
+
- Understanding the dataset’s structure, distributions, and data quality
|
| 30 |
+
- Identifying key patterns and relationships between clinical, lifestyle, and demographic variables
|
| 31 |
+
- Using clear visualizations to present insights, trends, and comparisons
|
| 32 |
+
- Evaluating feature importance and understanding which factors are most strongly associated with diabetes
|
| 33 |
+
- Learning how to extract meaningful insights from data and communicate them effectively through visual and statistical analysis
|
| 34 |
+
|
| 35 |
+
### Dataset Description
|
| 36 |
+
|
| 37 |
+
This dataset contains **100,000 synthetic patient records** related to diabetes risk.
|
| 38 |
+
It includes demographic, lifestyle, and clinical variables commonly used in medical risk assessment.
|
| 39 |
+
|
| 40 |
+
The main features are:
|
| 41 |
+
|
| 42 |
+
- **age**
|
| 43 |
+
- **bmi**
|
| 44 |
+
- **physical_activity_minutes_per_week**
|
| 45 |
+
- **diet_score**
|
| 46 |
+
- **family_history_diabetes**
|
| 47 |
+
- **glucose_fasting**
|
| 48 |
+
- **hba1c**
|
| 49 |
+
- **diabetes_risk_score**
|
| 50 |
+
- **diagnosed_diabetes** (target variable)
|
| 51 |
+
|
| 52 |
+
The dataset is structured, clean, and contains no missing values, making it suitable for exploratory data analysis and modeling.
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
## EDA Workflow Overview
|
| 57 |
+
|
| 58 |
+
The analysis was conducted through a structured and professional Exploratory Data Analysis (EDA) process.
|
| 59 |
+
Below is a summary of the key steps performed:
|
| 60 |
+
|
| 61 |
+
### **1. Initial Data Inspection**
|
| 62 |
+
- Loaded the dataset and reviewed its structure (`.info()`, `.head()`).
|
| 63 |
+
- Verified column types and checked dataset dimensions.
|
| 64 |
+
- Performed a full missing-values check — the dataset contained **no null values**.
|
| 65 |
+
- Checked for duplicate rows (none were found).
|
| 66 |
+
|
| 67 |
+
### **2. Data Cleaning & Preprocessing**
|
| 68 |
+
Although the dataset was already fully complete — with **no missing values**, **no duplicates**, and all columns in valid formats — additional cleaning checks were performed to demonstrate proper analytical practice:
|
| 69 |
+
|
| 70 |
+
- **Missing values check:**
|
| 71 |
+
Confirmed that the dataset contains *zero nulls* across all columns.
|
| 72 |
+
|
| 73 |
+
- **Outlier exploration:**
|
| 74 |
+
Identified a small number of extreme fasting-glucose values.
|
| 75 |
+
These outliers were **not removed for the overall EDA**, because they represent only ~0.02% of the dataset and do not meaningfully affect distributions or correlations.
|
| 76 |
+
|
| 77 |
+
- **Educational outlier removal (for a specific question only):**
|
| 78 |
+
To demonstrate correct preprocessing techniques, we removed **21 extreme glucose outliers** during one specific analysis step.
|
| 79 |
+
This removal was performed **strictly for educational purposes**, not as part of the general EDA.
|
| 80 |
+
|
| 81 |
+
- Validated distributions, checked ranges, and ensured logical consistency across features.
|
| 82 |
+
|
| 83 |
+
---### **3. Univariate Analysis**
|
| 84 |
+
- Explored each feature independently to understand its distribution.
|
| 85 |
+
- Plotted histograms and boxplots for age, BMI, activity levels, glucose, HbA1c, and diet score.
|
| 86 |
+
- Identified normal vs. skewed variables and examined clinical cutoffs.
|
| 87 |
+
|
| 88 |
+
### **4. Bivariate Analysis**
|
| 89 |
+
Investigated relationships between each variable and diabetes diagnosis:
|
| 90 |
+
|
| 91 |
+
- Grouped means and prevalence differences (`groupby`).
|
| 92 |
+
- Barplots for categorical variables (smoking, alcohol, gender, ethnicity).
|
| 93 |
+
- Scatterplots & trendlines for continuous variables (glucose, BMI, age).
|
| 94 |
+
- A correlation matrix (Pearson) for numeric features.
|
| 95 |
+
|
| 96 |
+
### **5. Multivariate Analysis**
|
| 97 |
+
To understand the combined contribution of multiple risk factors:
|
| 98 |
+
|
| 99 |
+
- Built a **simple logistic regression** (glucose + HbA1c).
|
| 100 |
+
- Built a **full logistic model** with all major predictors.
|
| 101 |
+
- Calculated **odds ratios** and visualized them.
|
| 102 |
+
- Tested for multicollinearity using **Variance Inflation Factors (VIF)**.
|
| 103 |
+
|
| 104 |
+
These steps provided deeper insight into which features independently drive diabetes risk.
|
| 105 |
+
|
| 106 |
+
### **6. Advanced Checks**
|
| 107 |
+
- Calculated **Spearman correlation** for non-linear and monotonic relationships.
|
| 108 |
+
- Compared with Pearson to confirm direction and strength of associations.
|
| 109 |
+
|
| 110 |
+
### **7. Summary & Interpretation**
|
| 111 |
+
All results were consolidated into a clear set of conclusions regarding the strongest predictors of diabetes, the role of lifestyle factors, and the relative contribution of clinical markers.
|
| 112 |
+
|
| 113 |
+
This workflow ensures a complete, reproducible, and professional EDA aligned with real-world data-analysis standards.
|
| 114 |
+
|
| 115 |
+
---
|
| 116 |
+
|
| 117 |
+
# 📌 Key Questions & Insights
|
| 118 |
+
|
| 119 |
+
This section summarizes the main analytical questions explored in the EDA,
|
| 120 |
+
along with the corresponding visualizations and conclusions.
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
## **1️⃣ How do clinical markers (Glucose & HbA1c) differ between diagnosed and non-diagnosed individuals?**
|
| 124 |
+
|
| 125 |
+
### 🔍 Insight
|
| 126 |
+
- Diagnosed individuals show **substantially higher fasting glucose** and **higher HbA1c**.
|
| 127 |
+
- These variables are the **strongest clinical indicators** of diabetes in the dataset.
|
| 128 |
+
- Clear separation between groups was observed in distributions and boxplots.
|
| 129 |
+
|
| 130 |
+
📈 *(Insert glucose/HbA1c visualization here)*
|
| 131 |
+
|
| 132 |
+
## **2️⃣ Is BMI higher among individuals diagnosed with diabetes?**
|
| 133 |
+
|
| 134 |
+
### 🔍 Insight
|
| 135 |
+
- The diabetes group has a **slightly higher mean BMI**, but the difference is **modest**.
|
| 136 |
+
- BMI is a risk factor, but within this dataset it is **not as strongly discriminative** as glucose or HbA1c.
|
| 137 |
+
|
| 138 |
+
📈 *(Insert BMI comparison plot)*
|
| 139 |
+
|
| 140 |
+
## **3️⃣ Does age influence diabetes diagnosis?**
|
| 141 |
+
|
| 142 |
+
### 🔍 Insight
|
| 143 |
+
- The diagnosed population is **older on average**.
|
| 144 |
+
- Age shows a **positive monotonic relationship** with diabetes prevalence.
|
| 145 |
+
- The effect is noticeable but not extreme.
|
| 146 |
+
|
| 147 |
+
📈 *(Insert age distribution comparison)*
|
| 148 |
+
|
| 149 |
+
## **4️⃣ Is lower physical activity associated with diabetes?**
|
| 150 |
+
|
| 151 |
+
### 🔍 Insight
|
| 152 |
+
- The diabetes group shows **lower average weekly activity**.
|
| 153 |
+
- The effect exists but is **weaker than expected**.
|
| 154 |
+
- Overall, physical activity is a mild risk correlate in this dataset.
|
| 155 |
+
|
| 156 |
+
📈 *(Insert activity boxplot)*
|
| 157 |
+
|
| 158 |
+
## **5️⃣ Does diet quality differ between groups?**
|
| 159 |
+
|
| 160 |
+
### 🔍 Insight
|
| 161 |
+
- The diet_score difference is **very small**.
|
| 162 |
+
- Diet appears **not to be a strong predictor** in this dataset.
|
| 163 |
+
- This may reflect measurement style or dataset limitations.
|
| 164 |
+
|
| 165 |
+
📈 *(Insert diet_score plot)*
|
| 166 |
+
|
| 167 |
+
## **6️⃣ Are there demographic differences (gender, ethnicity, smoking, alcohol)?**
|
| 168 |
+
|
| 169 |
+
### 🔍 Insight
|
| 170 |
+
- Some categories showed small differences, but **none were clinically large**.
|
| 171 |
+
- These variables provide **context** but are not strong predictors on their own.
|
| 172 |
+
|
| 173 |
+
📈 *(Insert relevant barplots)*
|
| 174 |
+
|
| 175 |
+
## **7️⃣ What do Pearson correlations reveal about the strongest predictors?**
|
| 176 |
+
|
| 177 |
+
### 🔍 Insight
|
| 178 |
+
- Highest Pearson correlations with diabetes:
|
| 179 |
+
- **HbA1c**
|
| 180 |
+
- **Fasting glucose**
|
| 181 |
+
- **Diabetes Risk Score**
|
| 182 |
+
- **Age** (moderate)
|
| 183 |
+
- Lifestyle variables (diet, activity) have **weak linear correlations**.
|
| 184 |
+
|
| 185 |
+
📈 *(Insert correlation heatmap)*
|
| 186 |
+
|
| 187 |
+
## **8️⃣ Why calculate Spearman correlation as well?**
|
| 188 |
+
|
| 189 |
+
### 🧠 Insight
|
| 190 |
+
- Spearman helps detect **non-linear monotonic relationships**.
|
| 191 |
+
- Age, glucose, HbA1c all remain strong positive correlates.
|
| 192 |
+
- Confirms the **robustness** of findings from Pearson.
|
| 193 |
+
|
| 194 |
+
📈 *(Insert Spearman ranking plot)*
|
| 195 |
+
|
| 196 |
+
## **9️⃣ What is the class balance between diagnosed and non-diagnosed participants?**
|
| 197 |
+
|
| 198 |
+
### 🔍 Insight
|
| 199 |
+
- 60% diagnosed vs. 40% not diagnosed.
|
| 200 |
+
- This is **not representative of the real population**, but OK for analysis.
|
| 201 |
+
- Important note: in modeling, **accuracy alone would be misleading**.
|
| 202 |
+
|
| 203 |
+
📈 *(Insert countplot)*
|
| 204 |
+
|
| 205 |
+
## **🔟 Outlier Handling: Why did we remove glucose outliers in one question?**
|
| 206 |
+
|
| 207 |
+
### 🔍 Insight
|
| 208 |
+
- The dataset had **no missing values**, and overall required minimal cleaning.
|
| 209 |
+
- To demonstrate preprocessing skills, we:
|
| 210 |
+
- Identified extreme glucose outliers.
|
| 211 |
+
- Removed **21 values** (≈0.02%) for **one specific question**.
|
| 212 |
+
- This did **not affect EDA results**, but shows proper workflow.
|
| 213 |
+
|
| 214 |
+
📈 *(Insert outlier boxplot if desired)*
|
| 215 |
+
|
| 216 |
+
# ✅ Summary of Findings
|
| 217 |
+
|
| 218 |
+
- Clinical variables (HbA1c, glucose) are the **dominant predictors** of diabetes.
|
| 219 |
+
- Age and BMI contribute **moderately**.
|
| 220 |
+
- Lifestyle factors have **small effects**.
|
| 221 |
+
- Dataset imbalance (60/40) must be noted.
|
| 222 |
+
- Cleaning was minimal, but demonstrated skills via targeted outlier removal.
|
| 223 |
+
- Both Pearson and Spearman correlations confirmed variable importance.
|
| 224 |
+
|
| 225 |
+
---
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
|