Silhouette is the Python library for intensity duration modelling in endurance sports.
Project description
Silhouette
A Python library for fitting power-duration curves to cycling data. Scikit-learn compatible.
Models
| Model | Parameters |
|---|---|
TwoParameterRegressor |
CP, W' |
ThreeParameterRegressor |
CP, W', P_max |
OmniDurationRegressor |
CP, W', P_max, a, tcp_max |
Installation
uv add silhouette
Or with pip:
pip install silhouette
Quick start
import numpy as np
from silhouette import OmniDurationRegressor
durations = np.array([5, 10, 30, 60, 120, 300, 600, 1200, 1800, 3600])
power = np.array([1050, 850, 600, 480, 400, 340, 310, 290, 275, 255])
reg = OmniDurationRegressor()
reg.fit(durations.reshape(-1, 1), power)
reg.cp_ # critical power (W)
reg.p_max_ # peak power (W)
reg.w_prime_ # anaerobic work capacity (J)
reg.predict(np.array([[300]])) # predicted power at 5 minutes
All three models share the same interface. Swap OmniDurationRegressor for TwoParameterRegressor or ThreeParameterRegressor and the code works the same way.
Known parameters
When parameters are already known, use curve directly without fitting:
from silhouette import TwoParameterRegressor
t = np.arange(1, 3601)
power = TwoParameterRegressor.curve(t, cp=250, w_prime=20_000)
Custom bounds
reg = OmniDurationRegressor(
bounds={"cp": (200, 400), "p_max": (800, 1500)},
initial_params={"cp": 280},
)
Time to exhaustion
The inverse of the power-duration curve: given a power, how long can it be sustained?
# On a fitted model
tte = reg.predict_inverse(np.array([250, 300, 350]))
# With known parameters
tte = TwoParameterRegressor.curve_inverse(350, cp=250, w_prime=20_000)
References
- Monod, H., & Scherrer, J. (1965). The work capacity of a synergic muscular group. Ergonomics, 8(3), 329-338.
- Morton, R. H. (1996). A 3-parameter critical power model. Ergonomics, 39(4), 611-619.
- Puchowicz, M. J., Baker, J., & Clarke, D. C. (2020). Development and field validation of an omni-domain power-duration model. Journal of Sports Sciences, 38(7), 801-813.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file silhouette-0.3.0.tar.gz.
File metadata
- Download URL: silhouette-0.3.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23a20734623a67a607a5ba85ffc09204ef14e931e5a9d21d46ca3cb053218ec5
|
|
| MD5 |
b488cb01c4c909d44871a1fd49f1076c
|
|
| BLAKE2b-256 |
b139ed91fc7b0592ac8e0a253216e74572a74c7c6528283ce2179543fa514a1a
|
File details
Details for the file silhouette-0.3.0-py3-none-any.whl.
File metadata
- Download URL: silhouette-0.3.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f903ada17c0a53c869786950d38bd460ea2b94104f244fa7a5d44d39193c423
|
|
| MD5 |
46278e661d57c3ac420f3bbcaec74dce
|
|
| BLAKE2b-256 |
d5dd862fee27a75a157e367151feb549e9148f928c8d94b50d9ec4aaefe38af5
|