holoviz / holoviews

With Holoviews, your data visualizes itself.
https://holoviews.org
BSD 3-Clause "New" or "Revised" License
2.7k stars 403 forks source link

Add more decimate options #2934

Open jbednar opened 6 years ago

jbednar commented 6 years ago

Right now, the HoloViews decimate operator randomly samples from the available data, dynamically on each zoom or pan. This is often a useful behavior, particularly for disconnected plots like Scatter, but for connected plots like Curve (e.g. timeseries) and Path, the results are chaotic and not a particularly good representation of the underlying data. For such cases, other options would be more useful:

If we implemented multiple types of sampling, the policy could be selected by mode='random', mode='regular', etc. We might want the default to be mode=None, where a mode appropriate to that Element type (e.g. random for Scatter and Points) would be selected.

ayoungs commented 6 years ago

I'm definitely a fan of the slicing with stride downsampling option!

jlstevens commented 6 years ago

Not sure about the other two suggestions but regular downsampling should be a quick, easy, understandable and useful way to decimate instead of always applying decimation randomly.

jbednar commented 6 years ago

Yes, that's the low-hanging fruit; I listed the other ones just so it's clear that there are many ways to do it and thus that the parameter shouldn't be Boolean, to allow for future expansion...

RiccardoGiro commented 4 years ago

Did you manage to implement any of those features?

jbednar commented 4 years ago

No, it's wide open for any interested user to dive into, and should be an easy win!

jbednar commented 2 years ago

Looks like I duplicated my own issue 4 years later: https://github.com/holoviz/holoviews/issues/5359

5359 includes links to LTTB sample code; please see that for details.

jvdd commented 1 year ago

Hey @jbednar

I wanted to let you know about a new library that I have developed called tsdownsample. It is an optimized implementation of various time series downsampling algorithms written in Rust, and it is available as a stand-alone Python package. The goal of this library was to improve the efficiency of these algorithms, while also allowing them to be used independently of plotly-resampler.

The library is still in the early stages of development, but it is beginning to mature. I am reaching out to see if there is interest in using tsdownsample to provide time series decimation options. If so, I would be happy to submit a pull request. Additionally, I welcome any feedback you may have on the interface for the downsample methods. More details can be found below :arrow_down:

The signature of the downsample methdods:

downsample([x], y, n_out, **kwargs)

Note the following:

jbednar commented 1 year ago

Thanks. We'll be looking at downsampling options in the coming months, and we'll be sure to check this out!

TheoMathurin commented 11 months ago

Am I mistaken in thinking that what's been added in https://github.com/holoviz/holoviews/pull/5552 by @philippjfr and @Hoxbro could be used in decimate to address this issue?

hoxbro commented 11 months ago

The first two options mentioned in the first comment were implemented in #5552

TheoMathurin commented 11 months ago

Alright so the idea is to use downsample1d directly instead of decimate + some options. It feels a bit like there are two parallel ways to perform downsampling but that's fine with me.

Thanks @Hoxbro!