-
Notifications
You must be signed in to change notification settings - Fork 42
Restructuring KernelDensity.jl #140
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
Open
jaksle
wants to merge
28
commits into
JuliaStats:master
Choose a base branch
from
jaksle:interface-fix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current capabilities of KernelDensity are quite limited, especially if we compare them to what is avaiable e.g. in SciPy, and this supposed to be is the main source of kernel estimation tools in Julia statistical ecosystem. The current interface and type system were made for calculating discretised pdf using Fourier transform in 1D or 2D and not for much else. This is a proposition of completely new type system and interface which is more flexible. See: #68, #110, #120, #126, #125, #129, #139.
Check
exampleUse.jlto see how it works.The main principles of this proposition are:
KernelEstimatedatatype contains full information about the fit, so a statistician can infer all they possibly want from it.KernelEstimateis a subtype ofMixtureDistributionso it fits well the rest of JuliaStats, can be much more easily used in other tasks and has a lot of useful default methods already implemented inDistributions.KernelEstimate. However, they can be stored in it and if so, getting pdf from interpolation of it becomes avaiable. If it is not present, different methods for getting pdf can be used (e.g. from the naive sum formula, which for small samples is completely reasonable). It can be also added usingprecompute!.The current approach does not allow for adaptive kde. You can allow for it with the same design, but for the sake of efficiency and code simplicity it might be better to add something like
AdaptiveKernelEstimateif such a need arises.I've currently implemented methods only for 1D. Adding 2D is only a matter of few simple additions, but in #110 there is code already for any dimension, it is debatable if it is worth to treat 2D case separately at all. But this is better to do that after getting some feedback.
Old interface may, or may not stay for backwards compability.
As it stands this proposition does not add any new numerical methods, but even simply linking it to Distributions adds a lot of features to this library, which for example Scipy or Sklearn do not have.