Exponentially Weighted Moving Average (EWMA)
Created on 2022-06-04T10:45:54-05:00
EWMAs are nice because they hold averages without having to keep all the data to average with them.
A fun use is to use them to integrate the amount of data processed over a cycle to update an average of data processed over time and make progress clocks that are reasonably accurate in their estimated time to completions.
Algorithm
With the variables:
- v: the value of the EWMA
- r: the new value being averaged with the EWMA
- a: alpha value controlling how to quash new and old values
Updating an EWMA is:
v <- (a * r) + ((1-a) * v)
Choice of Alpha
You can set the alpha to (2/(N+1)) where N is the number of distinct buckets; so an average taken each day would be how many days to average over.
You can also use curve fitting or evolution methods to pick Alphas if you are attempting something weird like emulating the decay rate of a digital circuit.