viesti / clj-lttb

Largest-Triangle-Three-Buckets (LTTB) for Clojure: https://github.com/sveinn-steinarsson/highcharts-downsample
MIT License
8 stars 0 forks source link

This isn't averaging, is it? #2

Open rosejn opened 2 years ago

rosejn commented 2 years ago

Thanks for sharing this implementation. I'm reading through to understand the algorithm while also reading the original thesis, and something jumped out. The idea is to compute the triangle areas with the previous bucket point, each of the candidate points in the current bucket, and the average of the points in the next bucket. I was expecting to see some kind of looping or iteration over the next bucket to compute the average, but it looks like you are just dividing a single value by the bucket length. Kind of surprising that this still produces a reasonable value, but I guess maybe it shows how the algorithm isn't so sensitive to that 3rd point in the triangle.

https://github.com/viesti/clj-lttb/blob/8ae80e8d215dae3a94df3da25e2007aa636d897e/src/lttb/core.cljc#L26