JuliaStats / KernelDensity.jl

Kernel density estimators for Julia
Other
172 stars 40 forks source link

differentiable kdes #77

Closed gszep closed 4 years ago

gszep commented 4 years ago

I would like the kde method to be used as part of a machine learning pipline. Therefore we need all methods to be extended to TrackedArray types. The plan would be to extend univariate.jl first. Which can be done by by-passing the use of rfft,irfft from FFTW.jl (which is not compatible with TrackedArrays) and use the conv layer from Flux.jl

closes #76

gszep commented 4 years ago

the following now works:

using Flux,KernelDensity
data = param(randn(100))
xrange = -3:0.1:3
kde(data,xrange,bandwidth=0.1)
gszep commented 4 years ago

closing this request since all changes have been moved into patches https://github.com/gszep/FluxContinuation/blob/master/patches/KernelDensity.jl

tpapp commented 4 years ago

How are those patches meant to be applied?

gszep commented 4 years ago

download that file and instead of using KernelDensity write include("pathtopatch/KernelDensity.jl")

gszep commented 4 years ago

note that currently the Fourier transform for Tracked types is redirected to a naivedft which unfortunately is N^2. this makes the patch unusable for more than ~4000 tracked data inputs. I'm working on a solution to use the NlogN fft algorithms