This project predicts the obesity level of individuals based on their physical and lifestyle attributes using multiple machine learning models. It involves end-to-end data processing, exploratory data analysis (EDA), feature engineering, model evaluation, and hyperparameter tuning.
- Source: The dataset is split into:
train_dataset.csv
test_dataset.csv
- Target Column:
NObeyesdad
— Multi-class label representing obesity levels.
- Age
- Height
- Weight
- BMI (calculated)
- FCVC: Frequency of consuming vegetables
- NCP: Number of main meals
- CH2O: Daily water consumption
- FAF: Physical activity frequency
- TUE: Time using technology devices
- Gender, Family history, Food habits, Transportation methods, etc.
- Calculated BMI from weight and height
- Handled missing values using mean/mode
- Removed duplicates
- One-Hot and Label Encoding for categorical data
- Outlier handling using IQR method
- Feature scaling using
StandardScaler
- Boxplots, Distribution plots, Countplots
- Correlation heatmap
- Feature importance visualization using Random Forest
- Logistic Regression
- Decision Tree
- Random Forest
- K-Nearest Neighbors (KNN)
- Neural Network (MLPClassifier)
- Support Vector Machine (SVM)
- Gradient Boosting Classifier
- Stacking Classifier (Ensemble)
- Accuracy
- Precision (weighted)
- Recall (weighted)
- F1-Score (weighted)
- Confusion Matrix
- Classification Report
- GridSearchCV for:
- Logistic Regression (
C
,penalty
,solver
) - KNN (
n_neighbors
,p
,metric
,algorithm
)
- Logistic Regression (
Combines:
- Logistic Regression
- Tuned KNN
- Random Forest
- Decision Tree
- Neural Network
- SVM
- Gradient Boosting
Meta-model: Logistic Regression
StandardScaler
saved asscaler.pkl
- Final
SVM
model saved assvm_model.pkl
- Feature distributions
- Boxplots: Features vs Obesity Level
- Countplot of Obesity Classes
- Feature importance charts
- Correlation heatmap
📦 Obesity-Prediction-ML ├── data/ │ ├── train_dataset.csv │ └── test_dataset.csv ├── models/ │ ├── svm_model.pkl │ └── scaler.pkl ├── obesity_prediction.ipynb / .py └── README.md