STOR-i / GaussianProcesses.jl

A Julia package for Gaussian Processes
https://stor-i.github.io/GaussianProcesses.jl/latest/
Other
308 stars 53 forks source link

Box constrained optimization ignores `kwargs` such as `show_trace` and `iterations` #228

Open apintar opened 5 months ago

apintar commented 5 months ago

When calling optimize! with kernbounds != nothing, kwargs... is ignored.

The relevant line appears to be 32 in the file optimize.jl.

The current line is

results = optimize(func.f, func.df, lb, ub, init, Fminbox(method), args...)

I would propose replacing it with

results = optimize(func, lb, ub, init, Fminbox(method), Optim.Options(;kwargs...))

I've tested this change on a local clone of GaussianProcesses.jl with my own example, and it appears to work as intended. I have not run the tests in the test folder.

For consistency, I would also propose a change in line 28 from

results = optimize(func, init, args...; method=method, kwargs...)     # Run optimizer

to

 results = optimize(func, init, method, Optim.Options(;kwargs...))     # Run optimizer

One thing to note. It's unclear to me what role args... plays, so perhaps my proposed solution overlooks something.