- Data Preparation & Exploration
- Feature Engineering
- Data Visualization & EDA
- Model Training & Evaluation
- Hyperparameter Tuning
- Advanced Predictions and Analysis
This project leverages machine learning to predict calories burned during training sessions, based on physiological measurements, and generational fitness trends. The analysis includes classification of users into generations, heart rate zones, BMI categories, and provides model-driven recommendations for improving training outcomes.
- Source: CSV file containing 15,000 entries
User_ID, Gender, Age, Height, Weight, Duration, Heart_Rate, Body_Temp, Calories
- Enrichment: Generational categorization, BMI & weight class assignment, mapping of recommended exercise and BPM ranges
- Explore relationships between physical characteristics and calories burned.
- Engineer features such as generation, BMI, weight category for more interpretable insights.
- Train, optimize, and compare machine learning regression models.
- Use model predictions to provide personalized improvement strategies.
- Data Preparation & Exploration
- Imported libraries (pandas, numpy, scikit-learn, seaborn, matplotlib).
- Read and examined the data for structure, missing values, outliers.
- Summarized dataset stats (describe(), column datatypes, shape).
- Feature Engineering
- Generation assignment: Based on age cutoffs (e.g., Millennials, Generation X, Baby Boomers, etc.)
- BMI calculation: Weight / (Height/100)^2
- Weight category segmentation: Classified as Underweight, Normal weight, Overweight, Obese.
- Label encoding: Converted categorical gender to numeric.
- Dummy variables: For generation and weight category to enable regression modeling.
- Additional Enrichment: Added columns with recommended exercises, heart rate (BPM) per generation.
- Data Visualization & EDA
- Bar plots and counts of gender, generation, and weight categories.
- Boxplots for detecting outliers in Duration, Calories, and BMI.
- Scatterplots and pairplots to inspect relationships between variables.
- Correlation heatmaps to identify feature associations.
- Grouped analyses (e.g., avg. calories/duration by gender and generation).
- Model Training & Evaluation
- Feature scaling with StandardScaler.
- Train-test split.
- K-Nearest Neighbors (KNN)
- Bagging Regressor (Decision Trees)
- AdaBoost Regressor
- Random Forest Regressor
- Gradient Boosting Regressor
- R² (coefficient of determination)
- MAE (mean absolute error)
- RMSE (root mean squared error)
- Compared each model’s performance on both train and test sets.
- Hyperparameter Tuning
-
Optimized Bagging Regressor parameters using RandomizedSearchCV.
-
Searched across base decision tree depth, number of estimators, sample sizes, and bootstrapping options.
-
Performance improved significantly: Baseline: RMSE ~8.78, R² ~0.98 Tuned: RMSE ~5.27, R² ~0.993
- Advanced Predictions and Analysis
- Integrated estimated max BPM and fitness recommendations by generation.
- Created a new feature set using demographic, categorical, and generational exercise context.
- Predicted calories burned for user records with recommended max BPM, enabling comparison of actual vs “improved scenario”.
- Added "Comparison" column indicating if the modeled scenario shows improvement.
- Visualized the distribution of users with “Improved” vs. “Not Improved” calorie burn.
- Best Model: Tuned Bagging Regressor (via RandomizedSearchCV) with tuned depth and splits.
- Key Features: Training duration, heart rate, and generational category were the most influential for prediction.
- Interpretation: Nearly all models achieved high accuracy, but tuning resulted in more robust and consistent predictions.
- Actionable Insight: Many users could further increase calories burned by aligning with recommended BPM and exercise types for their generation.
Claudio Do Prado Vera Pinto