polars.Series.ewm_sum
-
Compute exponentially-weighted moving sum.
Warning
This functionality is considered unstable. It may be changed at any point without it being considered a breaking change.
- Parameters:
-
- com
-
Specify decay in terms of center of mass, \(\gamma\), with
\[\alpha = \frac{1}{1 + \gamma} \; \forall \; \gamma \geq 0\] - span
-
Specify decay in terms of span, \(\theta\), with
\[\alpha = \frac{2}{\theta + 1} \; \forall \; \theta \geq 1\] - half_life
-
Specify decay in terms of half-life, \(\tau\), with
\[\alpha = 1 - \exp \left\{ \frac{ -\ln(2) }{ \tau } \right\} \; \forall \; \tau > 0\] - alpha
-
Specify smoothing factor alpha directly, \(0 < \alpha \leq 1\).
- min_samples
-
Minimum number of observations in window required to have a value (otherwise result is null).
- ignore_nulls
-
Ignore missing values when calculating weights.
Examples
>>> s = pl.Series([1, 2, 3]) >>> s.ewm_sum(alpha=0.5) shape: (3,) Series: '' [f64] [ 1.0 2.5 4.25 ]
Series.ewm_sum(
*,
com: float | None = None,
span: float | None = None,
half_life: float | None = None,
alpha: float | None = None,
min_samples: int = 1,
ignore_nulls: bool = False,
) → Series
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/series/api/polars.Series.ewm_sum.html