A study of the MET-based calculation behind estimates of caloric expenditures during cycling events. Includes both the discrete MET (DMET) calculation and the continuous MET (CMET) calculation developed through machine learning methods.
This repository contains:
- The repository requirements in
requirements.txt
- The Jupyter Notebook development documentation in
project/Cycling Caloric Expenditure.ipynb
- A static HTML webpage of the documentation in
project/Cycling Caloric Expenditure.html
- A module for calculating the discrete-based caloric output
project/lib/discrete-met-model.py
- A module for calculating the continuous-based caloric output
project/lib/continuous-met-model.py
- Figures generated by the study contained in the Jupyter Lab Notebook
project/figures/*
- Figures used by the notebook and webpage in
project/jupyter-figures/*
Sports scientists have developed methods for estimating the number of calories burned by an athlete during their workout. Among these methods is the metabolic equivalent for task (MET) calculation of caloric consumption that attempts to scale different athletic activities against each other according to their relative intensities. For cyclists, the MET scale provides calculations for caloric consumption based on the average speed of the cyclist throughout the workout. However, the scale does not provide for speeds between the specific zones of their study. Consequently, this scale results in inaccurate estimates for athletes who do not travel at the exact average speeds included in the scale. Within the scope of this study, I refer to the original scale as the discrete MET (DMET) model. Using a polynomial regression model, the gaps within the DMET model were closed to form a continuous MET (CMET) calculation that offers superior caloric expenditure estimates. In order to form some basis for comparison, the MET model for the stationary-bike and the models used by three major activity tracking applications were also studied.
Install the requirements in a python environment using the included requirements file. Then navigate into the project
directory.
pip install -r requirements.txt
Import the discrete_met_model
and the continuous_met_model
models from lib
.
>>> from lib.discrete_met_model import *
>>> from lib.continuous_met_model import *
To calculate the number of calories burned during a workout using the discrete MET model, pass in your current weight in pounds, the duration and the average speed of your workout.
>>> dmet_calc_total_calories_burned(weight=155.0, duration=120, speed=14.5)
1476.1904761904766
The continuous MET calculation takes the same arguments in the same order as the discrete calculation but offers considerably better results.
>>> cmet_calc_total_calories_burned(weight=155.0, duration=120, speed=14.5)
1286.5800318094882