4. Inference

4.1. Power inference

Power meters are expensive tools and it is possible to get an estimate using simple data which are acquired through phone or GPS-based cycling computer. We are presenting several models which allow to estimate the power from those data.

4.1.1. Physical model using all forces applied to a cyclist

This is possible to compute the power by adding all forces applied to cyclist in motion. The mathematical formulation of such model is:

P_{meca} = \left( \frac{1}{2} \rho \cdot SC_x \cdot V_a^2 + C_r \cdot mg \cdot \cos \alpha + mg \cdot \sin \alpha + m \cdot a \right) \cdot V_d

where \rho is the air density in kg.m^{-3}, S is frontal surface of the cyclist in m^2, C_x is the drag coefficient, V_a is the air speed in m.s^{-1}, C_r is the rolling coefficient, m is the mass of the rider and bicycle in kg, g in the gravitational constant which is equal to 9.81 m.s^{-2}, \alpha is the slope in radian, a is the acceleration in m.s^{-1}, and V_d is the rider speed in m.s^{-1}.

The function model.strava_power_model allows to estimate the power using this model. Note that we are using the default argument but the you can set more precisely the argument to fit your condition. To estimate, we need to:

>>> from skcycling.datasets import load_fit
>>> from skcycling.io import bikeread
>>> from skcycling.model import strava_power_model
>>> ride = bikeread(load_fit()[0])
>>> power = strava_power_model(ride, cyclist_weight=72)
>>> print(power['2014-05-07 12:26:28':
...             '2014-05-07 12:26:38'])  # Show 10 sec of estimated power
2014-05-07 12:26:28    196.567898
2014-05-07 12:26:29    198.638094
2014-05-07 12:26:30    191.444894
2014-05-07 12:26:31     26.365864
2014-05-07 12:26:32     89.826104
2014-05-07 12:26:33    150.842325
2014-05-07 12:26:34    210.083958
2014-05-07 12:26:35    331.573965
2014-05-07 12:26:36    425.013711
2014-05-07 12:26:37    428.806914
2014-05-07 12:26:38    425.410451
Freq: S, dtype: float64

By default the term g \cdot a \cdot V_d is not computed. Using this term, the results can be unstable when the change of power is non smooth. To enable it, turn use_acceleration=True

4.1.2. Machine learning model

This part is in progress. Find more at this link.