tommyod / KDEpy

Kernel Density Estimation in Python
https://kdepy.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
585 stars 90 forks source link

Grid definitions for multivariant KDE #110

Closed lukekruse closed 2 years ago

lukekruse commented 2 years ago

Hello!

I am trying to use your module to perform KDE on my 2D data set but I am having trouble with correctly specifying grid_points within FFTKDE.evaluate. The script works great for determining the KDE in the vicinity for which data is provided, however I would like the output range of the KDE to be larger than that of the data. For example, although the smallest observed value for the first variable is 0.5, I would like to estimate the KDE at say, 0. I think this can be done from the comments in the FFTKDE script but I cannot figure out the proper form of the grid to pass.

Best, Luke

tommyod commented 2 years ago

Take a look at how grid creation is done here: https://github.com/tommyod/KDEpy/blob/b1a34fdb91bc98bd8c4f4d6109923c2fe28f85ba/KDEpy/utils.py#L61

Use the code in that function as a starting point, modify as needed!