skfolio.utils.tools.half_life_to_decay_factor#
- skfolio.utils.tools.half_life_to_decay_factor(half_life)[source]#
Convert half-life to exponential decay factor.
The decay factor (\(\lambda\)) determines how much weight is given to past observations in exponentially weighted calculations. It is computed from the half-life using:
\[\lambda = 2^{-1/\text{half-life}}\]- Parameters:
- half_lifefloat
Half-life in number of observations. This is the number of observations for the weight to decay to 50%. Must be positive.
- Returns:
- decay_factorfloat
The exponential decay factor (\(\lambda\)), satisfying \(0 < \lambda < 1\).
Examples
>>> half_life_to_decay_factor(40) 0.9828...