Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Kernel Density adding .sample() support for linear and exponential kernels #21224

Copy link
Copy link
Open
@lrjball

Description

@lrjball
Issue body actions

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.