KernelDensity.jl
KernelDensity.jl copied to clipboard
Make KDE a distribution and implement other Distributions method
It would be nice to have:
-
cdf
using QuadGK? OrStatsBase.ecdf
? -
quantile
usingcdf
with bijection method
I'm going to bump this thread. In addition to pdf
, shouldn't other functions like mean
, std
, quantile
, cdf
, etc... be supported as well?
Yes this sounds like an obviously good improvement.
Yes, it would also be nice to have a rand
method.
Also loglikelihood
for whoever needs to perform maximum-likelihood estimation with the resulting KDE.
I was just looking at the internals of this library, checking other things and I noticed this. Unfortunately, KernelDensity.jl
was not designed with such features in mind. It does not store information required to effectively calculate kernel-based features other than the pdf.
What one can do is to introduce a new interface which does store it, make a new type like KernelEstimate <: Distribution
which stops one step before calculating the pdf and stores all the parameters of the fit. Perhaps it can be done even better, as I see Distributions.jl
has MixtureModel
implemented and kde is just a fitted mixture. I'll think about this.