This is a machine learning–powered web application developed using Python, Flask, and a tuned XGBoostRegressor model to predict calorie expenditure during physical activity.
After training and tuning the regression model with XGBoostRegressor, the final optimized model is exported using Pickle and served through a backend built with Flask.
- Predicts calorie expenditure (continuous numeric value) using health and activity indicators.
- Built using a tuned regression model (XGBoostRegressor).
- Interactive and clean web UI built using HTML/CSS powered frontend via Flask.
- Includes multiple engineered features to improve prediction accuracy.
- Uses a pre-trained model (best_xgbr_model_final.pkl).
- Lightweight, fast, and deployable on any Python-supported machine.
The model predicts calorie expenditure using the following inputs:
| Feature | Type / Unit |
|---|---|
| Sex | Male / Female |
| Age | Numeric (years) |
| Height | cm |
| Weight | kg |
| Duration | minutes |
| Heart_Rate | bpm |
| Body_Temp | °C |
During model training, the following additional features were created and are required during prediction as well:
Duration_Heart = Duration × Heart_RateDuration_Temp = Duration × Body_TempAge_Duration = Age × DurationWeight_Duration = Weight × DurationHeight_Duration = Height × DurationHR_per_Weight = Heart_Rate / Weight
These features are automatically calculated during model training and are expected by the model during inference (prediction).
- Python
- XGBoostRegressor – Core Machine Learning regression model
- Scikit‑learn – Preprocessing and model utilities
- Pandas / NumPy – Data preprocessing & feature engineering
- Flask – Web application backend
- Pickle – Model serialization
- Jupyter Notebook – Model training & evaluation
- HTML / CSS – Frontend design
datasets/train.csv datasets/test.csv
models/final_ml_model_6.ipynb models/best_xgbr_model_final.pkl
templates/index.html templates/result.html
static/styles.css
app.py README.md requirements.txt .gitignore
-
Clone the repository:
git clone https://github.com/Kalana-S/Calorie-Expenditure-Predicting-System.git cd Calorie-Expenditure-Predicting-System -
Create virtual environment (optional but recommended):
python -m venv venv venv\Scripts\activate # For Windows # OR source venv/bin/activate # For macOS/Linux
-
Install dependencies:
pip install -r requirements.txt
-
Run the Flask app:
python app.py
-
Open your browser and go to
http://127.0.0.1:5000
Contributions, issues, and feature requests are welcome! Feel free to open a pull request or start a discussion.
This project is licensed under the MIT License – see the LICENSE file for details.

