JuliaStats / KernelDensity.jl

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

drop Optim? #83

Closed PaulSoderlind closed 3 years ago

PaulSoderlind commented 4 years ago

Optim is a rather heavy dependency, especially since the optimisation problem in kde_lscv appears to be fairly straightforward.

I therefore experimented with a simple golden section search - and it works well. It seems as if Optim could be dropped and the short golden section search code (a total of 18 lines) could be added to the package.

The key parts of the code are a follows:

hGSS = golden_section_searchX(hlb, hub,0.0001) do h
... [current loss function]
end

function golden_section_searchX(f, a, b, ϵ)
... [standard code, 16 lines]
end
tpapp commented 4 years ago

I am sympathetic to this, cf JuliaNLSolvers/Optim.jl/issues/744.

@pkofod, is there any change of moving the univariate routines to a smaller, lighter package?

If not, then we could think about creating a small package along the lines of Roots.jl for these methods so that they could be reused.

pkofod commented 4 years ago

@pkofod, is there any change of moving the univariate routines to a smaller, lighter package?

I havn't specifically thought about doing it, but in principle they could. The thing is, with the way package loading works in Julia, it'll never be instantaneous to have dependencies, so if it's very important to have low using times, you need to self-host the code.