<a id="skfolio-utils-tools-half-life-to-decay-factor"></a>

# skfolio.utils.tools.half_life_to_decay_factor

<a id="skfolio.utils.tools.half_life_to_decay_factor"></a>

### skfolio.utils.tools.half_life_to_decay_factor(half_life)

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_life** *float*
  : Half-life in number of observations. This is the number of observations
    for the weight to decay to 50%. Must be positive.
* **Returns:**
  **decay_factor** *float*
  : The exponential decay factor ($\lambda$), satisfying
    $0 < \lambda < 1$.

### Examples

```pycon
>>> half_life_to_decay_factor(40)
0.9828...
```

