GoldenCheetah / sweatpy

Endurance sports analysis library for Python
http://sweatpy.gssns.io
MIT License
75 stars 21 forks source link

Odd results from PowerDurationRegressor(model="2 param") #65

Closed pepl closed 3 years ago

pepl commented 3 years ago

I've been playing around with estimating CP along the "2 param" model and found the following oddity: Athlete A has a 3min MMP of 440 and athlete B of 400. Both have more or less the same 10min MMP.

If I feed that to the regressor, I get unexpected values (at least to me) along the following code. Am I using it wrongly, do I have a general misunderstanding or is it a bug?

$ cat cpcalctest.py 
import sweat

durations = [180., 600.] # 600
X = sweat.array_1d_to_2d(durations)

Y = [440, 361.3333333, ]
pdmreg = sweat.PowerDurationRegressor(model="2 param")
pdmreg.fit(X, Y)

print(Y)
print(pdmreg.cp_)
print(pdmreg.w_prime_)

Y = [400, 361.5555556, ]
pdmreg = sweat.PowerDurationRegressor(model="2 param")
pdmreg.fit(X, Y)

print(Y)
print(pdmreg.cp_)
print(pdmreg.w_prime_)
$ python3 cpcalctest.py 
[440, 361.3333333]
327.61904757142855
20228.57143714286
[400, 361.5555556]
345.0793651428571
9885.71427428572
pepl commented 3 years ago

After having a look at how the "2 param" is implemented: As it's linear and due to the higher slope those values are expected to be like that in that model, right?