Description
Describe the workflow you want to enable
Currently KernelDensity.sample
only works for the gaussian
and tophat
kernels, but I'd like to add support for the linear
and exponential
kernels as well.
Describe your proposed solution
The sampling process amounts to picking a point from the original dataset at random, then sampling from the kernel distribution and adding it to that point. The laplace
distribution from numpy can be used for the exponential
kernel and the triangular
distribution from numpy can be used to generate samples from the linear
kernel, so this change is only adding a few extra lines, plus some tests. I have a working version for this so will put in a PR.
Adding for linear
and exponential
for now as they are the easiest to implement. epanechnikov
and cosine
are possible as well, but are slightly more involved.
Describe alternatives you've considered, if relevant
No response
Additional context
No response