diff --git a/Project.toml b/Project.toml index ec462e4..cc9a8be 100644 --- a/Project.toml +++ b/Project.toml @@ -23,10 +23,10 @@ BayesianOptimization = "0.1.1" GaussianProcesses = "0.9.0" Juno = "0.7" LatinHypercubeSampling = "1.2" -Parameters = "0.12" +Parameters = "0.11, 0.12" RecipesBase = "0.7" MacroTools = "0.5" -Lazy = "0.14" +Lazy = "0.13, 0.14" julia = "1.0" [extras] diff --git a/src/samplers.jl b/src/samplers.jl index a0ea878..e754f5c 100644 --- a/src/samplers.jl +++ b/src/samplers.jl @@ -253,7 +253,6 @@ function macrobody(ex, params, candidates, sampler::Hyperband) $(esc(ex.args[2])) end (::$typeof(costfun))($(esc(params[1])), $(esc(:state))) = $(esc(ex.args[2])) - @show methods(costfun) hyperband($sampler, ho, costfun) ho end diff --git a/test/runtests.jl b/test/runtests.jl index 2cbea04..26a4c87 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,4 +1,4 @@ -using Test, Random +using Test, Random, Distributed Random.seed!(0) using Hyperopt, Plots @@ -13,13 +13,32 @@ using Hyperopt, Plots f(a,b,c=c) end @test minimum(hor)[2] < 300 + @test length(hor.history) == 100 + @test length(hor.results) == 100 + @test all(hor.history) do h + all(hi in hor.candidates[i] for (i,hi) in enumerate(h)) + end + + horp = @phyperopt for i=100, sampler=RandomSampler(), a = LinRange(1,5,50), b = [true, false], c = exp10.(LinRange(-1,3,50)) + # println(i, "\t", a, "\t", b, "\t", c) + # print(i, " ") + f(a,b,c=c) + end + @test minimum(horp)[2] < 300 + @test length(horp.history) == 100 + @test length(horp.results) == 100 + addprocs(2) + @everywhere using Hyperopt + @everywhere f(a,b=true;c=10) = sum(@. 100 + (a-3)^2 + (b ? 10 : 20) + (c-100)^2) horp = @phyperopt for i=100, sampler=RandomSampler(), a = LinRange(1,5,50), b = [true, false], c = exp10.(LinRange(-1,3,50)) # println(i, "\t", a, "\t", b, "\t", c) # print(i, " ") f(a,b,c=c) end @test minimum(horp)[2] < 300 + @test length(horp.history) == 100 + @test length(horp.results) == 100 hob = @hyperopt for i=100, sampler=BlueNoiseSampler(), a = LinRange(1,5,100), b = repeat([true, false],50), c = exp10.(LinRange(-1,3,100)) # println(i, "\t", a, "\t", b, "\t", c)