polars.Expr.ewm_mean¶
- Expr.ewm_mean(com: Optional[float] = None, span: Optional[float] = None, half_life: Optional[float] = None, alpha: Optional[float] = None, adjust: bool = True, min_periods: int = 1) polars.internals.expr.Expr ¶
Exponential moving average.
- Parameters
- com
Specify decay in terms of center of mass, \(alpha = 1/(1 + com) \;for\; com >= 0\).
- span
Specify decay in terms of span, \(alpha = 2/(span + 1) \;for\; span >= 1\)
- half_life
Specify decay in terms of half-life, \(alpha = 1 - exp(-ln(2) / halflife) \;for\; halflife > 0\)
- alpha
Specify smoothing factor alpha directly, \(0 < alpha < 1\).
- adjust
Divide by decaying adjustment factor in beginning periods to account for imbalance in relative weightings
When adjust = True the EW function is calculated using weights \(w_i = (1 - alpha)^i\)
When adjust = False the EW function is calculated recursively.
- min_periods
Minimum number of observations in window required to have a value (otherwise result is Null).