holoviz / datashader

Quickly and accurately render even the largest data.
http://datashader.org
BSD 3-Clause "New" or "Revised" License
3.3k stars 366 forks source link

Geometric mean and median as reduction functions #603

Open suyang-nju opened 6 years ago

suyang-nju commented 6 years ago

This is a feature request for adding geometric mean and median to the list of reduction functions in datashader. For now, a work around for doing geometric mean is to use ds.mean() on log transformed data during aggregation, and then transform back.

jbednar commented 6 years ago

Computing the geometric mean should be straightforward, starting from the code for the arithmetic mean, and I would welcome a PR to add that to datashader, as long as it had tests that verified the results against those obtained from an independent implementation.

I know less about geometric medians, but computing the arithmetic median efficiently is not trivial, and I suspect the same would be true for the geometric median. This paper proposes an efficient algorithm for approximating the geometric median, and if that works well I'd also be happy to include it in datashader.