Skip to content

Kde boundaries #1567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 30, 2016
Merged

Kde boundaries #1567

merged 2 commits into from
Nov 30, 2016

Conversation

aloctavodia
Copy link
Member

This KDE implementation is faster than scipy.gaussian_kde. According to my test between ~10 times faster (for ~1000 points) and ~40 times faster (for ~10000 points). This implementation includes a boundary correction (using the reflection method). I think the only caveat is that it will not work very nice if the number of data points is low (probably lower than ~1000/500), in such a cases the tails of the distributions are not estimated very nice. Nevertheless I think this is OK, given that in general people uses at least 1000 samples.

The next image is an example of a KDE estimation without boundary corrections (the SciPy implementation)
non_boundaries

And this is an example with boundary correction (the implementation in this PR)

boundary_correction

I know is a small detail, but in my experience KDE plots without the correction can be confusing to those unaware of how KDE estimation works, or at least those unfamiliar with PyMC3/scipy-KDE.

This is an adaptation of the code from this repository and made some modifications. I made this change following this suggestion arviz-devs/arviz#5

@springcoil
Copy link
Contributor

Hey thanks for this commit. I agree with your comments about KDE.

This looks a good contribution.

@twiecki
Copy link
Member

twiecki commented Nov 30, 2016

Nice, that looks way better!

@twiecki twiecki merged commit a54a53e into pymc-devs:master Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants