Skip to content

Commit

Permalink
Update learning_curves.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
OkonSamuel committed Jun 10, 2020
1 parent 5e2495c commit e518a07
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/learning_curves.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,18 @@ function _tuning_results(rngs::AbstractVector, acceleration::CPUProcesses,

old_rng = recursive_getproperty(tuned.model.model, rng_name)
n_rngs = length(rngs)
channel = RemoteChannel(()->Channel{Bool}(min(1000, n_rngs)), 1)

local ret
@sync begin
verbosity < 1 || (p = Progress(n_rngs,
verbosity < 1 || begin
p = Progress(n_rngs,
dt = 0,
desc = "Evaluating Learning curve with $(n_rngs) rngs: ",
barglyphs = BarGlyphs("[=> ]"),
barlen = 18,
color = :yellow))
color = :yellow)
channel = RemoteChannel(()->Channel{Bool}(min(1000, n_rngs)), 1)
end
# printing the progress bar
verbosity < 1 || @async begin
update!(p,0)
Expand All @@ -228,20 +231,19 @@ function _tuning_results(rngs::AbstractVector, acceleration::CPUProcesses,
ProgressMeter.updateProgress!(p)
end
close(channel)
end
end
@sync begin
ret = @distributed (_collate) for rng in rngs
recursive_setproperty!(tuned.model.model, rng_name, rng)
fit!(tuned, verbosity=verbosity-1, force=true)
r=tuned.report.plotting
verbosity < 1 || put!(channel, true)
r
end
end
end
end
recursive_setproperty!(tuned.model.model, rng_name, old_rng)
verbosity < 1 || put!(channel, false)
end

end
return ret
end

Expand Down

0 comments on commit e518a07

Please sign in to comment.