When I try to call python skopt from Julia, I find a weird problem, here is a simple example that can reflect my question, if I define all variable range with Real
, it will cause error in res = opt.tell(suggested, y)
however, once I have one variable range defined with Integer
, then it works well, where is the problem?
function blackbox(para)
return (para[1]^2 - para[2])^2 + 2
end
using PyCall
skopt = pyimport("skopt")
py"""
from skopt.space import Real,Integer
space =[Real(-10, 10),
Integer(-10, 10)] # if use `Real(-10,10)`, it will cause error in `res = opt.tell(suggested, y)`
# but if I use Integer(-10, 10), it will run successfully, why?
"""
opt = skopt.Optimizer(py"space", n_initial_points=4, acq_func="EI", acq_optimizer="sampling")
suggested = opt.ask()
display(suggested)
y = blackbox(suggested)
display(y)
res = opt.tell(suggested, y)