A fast Go library for exponential moving averages

Posted by Baron Schwartz on Jul 23, 2013 3:42:00 AM

We’ve open-sourced our Go ewma library. It computes fast exponentially weighted moving averages over streams of numbers. There are two implementations with varying properties, and the library encourages the use of a MovingAverager interface for ease of building and using more implementations.

library_for_exponential

Like a moving average, a long exposure obscures variations.

An exponentially weighted moving average is a way to continuously compute a type of average for a series of numbers, as the numbers arrive. After a value in the series is added to the average, its weight in the average decreases exponentially over time. This biases the average towards more recent data. EWMAs are useful for many reasons, as I discussed in my Quantifying Abnormal Behavior talk at Velocity last month.

If you aren’t familiar with EWMAs, please read the repository’s documentation! It explains moving averages pictorially. This is a lot easier to understand than the dense math equations you’ll typically find.

We hope you find this code (and documentation) helpful. Please contribute in all the usual ways, with pull requests and issue reports!

(Photo credit)

Recent Posts

Posts by Topic

see all