arviz-devs / arviz

Exploratory analysis of Bayesian models with Python
https://python.arviz.org
Apache License 2.0
1.59k stars 395 forks source link

Introduce weights keyword to plot_kde #2345

Open jvaara opened 5 months ago

jvaara commented 5 months ago

Certain Approximate Bayes Computation packages provide samples with weights; it would be useful to be able to use plot_kde directly for these applications.

At least for the stats.density_utils._fast_kde_2d, it would be a straightforward modification.

Cheers

tomicapretto commented 5 months ago

Given how the KDE is implemented in ArviZ, using a grid of points, we first need to consider how to account for the weights in the binning. This seems to be already solved in KDEpy https://github.com/tommyod/KDEpy/blob/master/KDEpy/binning.py