Proposal - Double exponential smoothing (Holt-Winters) query function.

1,089 views
Skip to first unread message

eliot.d...@gmail.com

unread,
Mar 5, 2016, 11:46:03 PM3/5/16
to Prometheus Developers
This is something I need to be able to replace my in-house anomaly detection monitoring.

Holt-Winters is a common method for time-series forecasting and anomaly detection that takes seasonal trends into account.
https://en.wikipedia.org/wiki/Exponential_smoothing

I have written a short POC of this function using a library I wrote.
https://github.com/eliothedeman/smoothie

The POC can be found here.
https://github.com/eliothedeman/prometheus

I wanted to see if you guys would be interested in a more advanced query function like this.

The current implementation is fast enough if you aren't making queries too often. However you often run these type of queries over week/month time periods, so an approach that is optimized to Prometheus would probably be preferable if there is interest.

Thanks for reading!

Ben Kochie

unread,
Mar 6, 2016, 2:36:45 AM3/6/16
to eliot.d...@gmail.com, Prometheus Developers
Yes, we've definitely had discussions about adding Holt-Winters to Prometheus.


--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brian Brazil

unread,
Mar 6, 2016, 4:18:22 AM3/6/16
to eliot.d...@gmail.com, Prometheus Developers
On 6 March 2016 at 04:46, <eliot.d...@gmail.com> wrote:
This is something I need to be able to replace my in-house anomaly detection monitoring.

Holt-Winters is a common method for time-series forecasting and anomaly detection that takes seasonal trends into account.
https://en.wikipedia.org/wiki/Exponential_smoothing

I have written a short POC of this function using a library I wrote.
https://github.com/eliothedeman/smoothie

The POC can be found here.
https://github.com/eliothedeman/prometheus

I wanted to see if you guys would be interested in a more advanced query function like this.

This is very much of interest, in particular for prediction.
 

The current implementation is fast enough if you aren't making queries too often. However you often run these type of queries over week/month time periods, so an approach that is optimized to Prometheus would probably be preferable if there is interest.

There'll be people using this for alerting, so we'd want it to be reasonably fast. Benchmarks would be useful.

--

eliot.d...@gmail.com

unread,
Mar 6, 2016, 7:52:51 PM3/6/16
to Prometheus Developers, eliot.d...@gmail.com

Thanks for the feedback guys!

I made some metrics, but I am not sure if they are valid in this situation due to my ignorance of the testing DSL.


Anyway the three benchmarks I made resulted in this...
BenchmarkHoltWinters4Week5Min-4 200 7567760 ns/op 1154777 B/op 8351 allocs/op
BenchmarkHoltWinters1Week5Min-4 1000 1888860 ns/op 202215 B/op 2169 allocs/op
BenchmarkHoltWinters1Day1Min-4 1000 1361158 ns/op 162461 B/op 1589 allocs/op

And the benchmarks can be found here...
https://github.com/eliothedeman/prometheus/commit/29b600ae25793e74d5eb28d1d9232149945da0d7

Let me know if I am doing something drastically wrong. I'll try to get forecasting working and get a benchmark of that soon.

Brian Brazil

unread,
Mar 7, 2016, 2:42:00 AM3/7/16
to eliot.d...@gmail.com, Prometheus Developers
On 7 March 2016 at 00:52, <eliot.d...@gmail.com> wrote:
On Saturday, March 5, 2016 at 11:46:03 PM UTC-5, eliot.d...@gmail.com wrote:
> This is something I need to be able to replace my in-house anomaly detection monitoring.
>
> Holt-Winters is a common method for time-series forecasting and anomaly detection that takes seasonal trends into account.
> https://en.wikipedia.org/wiki/Exponential_smoothing
>
> I have written a short POC of this function using a library I wrote.
> https://github.com/eliothedeman/smoothie
>
> The POC can be found here.
> https://github.com/eliothedeman/prometheus
>
> I wanted to see if you guys would be interested in a more advanced query function like this.
>
> The current implementation is fast enough if you aren't making queries too often. However you often run these type of queries over week/month time periods, so an approach that is optimized to Prometheus would probably be preferable if there is interest.
>
> Thanks for reading!

Thanks for the feedback guys!

I made some metrics, but I am not sure if they are valid in this situation due to my ignorance of the testing DSL.


Anyway the three benchmarks I made resulted in this...
        BenchmarkHoltWinters4Week5Min-4      200           7567760 ns/op         1154777 B/op       8351 allocs/op

Doing a bit more testing, most of that isn't the function itself as min_over_time and all the setup takes 5.6ms so this is ~1.5ms. We don't have benchmarks for other functions, but I suspect this would benefit from being faster.

Brian
 
        BenchmarkHoltWinters1Week5Min-4     1000           1888860 ns/op          202215 B/op       2169 allocs/op
        BenchmarkHoltWinters1Day1Min-4      1000           1361158 ns/op          162461 B/op       1589 allocs/op

And the benchmarks can be found here...
https://github.com/eliothedeman/prometheus/commit/29b600ae25793e74d5eb28d1d9232149945da0d7

Let me know if I am doing something drastically wrong. I'll try to get forecasting working and get a benchmark of that soon.
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

eliot.d...@gmail.com

unread,
Mar 7, 2016, 1:10:36 PM3/7/16
to Prometheus Developers, eliot.d...@gmail.com
On Saturday, March 5, 2016 at 11:46:03 PM UTC-5, eliot.d...@gmail.com wrote:

Yeah I am going to write a more optimized version today, I think I can get it sub 1ms by cutting down on allocations. Will post the results when done.

Reply all
Reply to author
Forward
0 new messages