EWMean¶
Exponentially weighted mean.
Parameters¶
-
fading_factor
Default →
0.5
The closer
fading_factor
is to 1 the more the statistic will adapt to recent values.
Attributes¶
-
mean (float)
The running exponentially weighted mean.
Examples¶
from river import stats
X = [1, 3, 5, 4, 6, 8, 7, 9, 11]
ewm = stats.EWMean(fading_factor=0.5)
for x in X:
ewm.update(x)
print(ewm.get())
1.0
2.0
3.5
3.75
4.875
6.4375
6.71875
7.859375
9.4296875
Methods¶
get
Return the current value of the statistic.
update
Update and return the called instance.
Parameters
- x — 'numbers.Number'