vega icon indicating copy to clipboard operation
vega copied to clipboard

Support additional bandwidth estimation methods for KDEs

Open joelostblom opened this issue 2 years ago • 0 comments

Currently, Scott's rule of thumb is used to estimate the bandwidth for the kernel density estimates in vega. However, from my understanding, this is rarely the optimal choice. For data that can be assumed to be normally distributed, the Silverman rule of thumb appears to be preferred, and the safest choice without any assumption seems to be the Improved Seather & Jones algorithm (isj) which doesn't rely on the normality assumption and doesn't oversmooth multimodal data like Scott's and Silverman's rule does.

There is some more discussion in this blog post, comparisons in this report, and further examples in this notebook. There are Python implementations of isj in arviz, zfit, and KDEpy in case it is helpful.

joelostblom avatar Sep 12 '23 23:09 joelostblom