I’d like to use HyperOpt.jl to optimise a vector of parameters, but I’m having trouble using following the libraries documentation (a readme)
As far as I can tell this should be sufficient
using Hyperopt
n = 10
d1 = rand(n)
function f(aa, d1)
return abs.(sum(aa .- d1))
end
ho = @hyperopt for i=50,
a = [LinRange(0,1,1000) for _ in 1:n],
f(a,d1)
end
But this fails. While this works
ho = @hyperopt for i=50,
a = LinRange(0,1,1000),
d2 = d1
f(a,d2)
end
I think there are two things going on here:
- I cannot set
ato be a vector ofLinRange - A constant has to be defined in the macro, I’m not sure why this is the case
How can I implement the first code block correctly?