.Flux
early_stopping
function
defined in module
Flux
early_stopping(f, delay; distance = -, init_score = 0, min_dist = 0)
Return a function that internally counts by one when
distance(best_score, f(...)) <= min_dist
, where
best_score
is the last seen best value of
f(...)
. If the count is greater than or equal to
delay
, the function returns
true
, otherwise it returns
false
. The count is reset when
distance(best_score, f(...)) > min_dist
.
julia> loss = let l = 0
() -> l += 1
end; # pseudo loss function that returns increasing values
julia> es = Flux.early_stopping(loss, 3);
julia> for i in 1:10
@info "Epoch $i"
es() && break
end
[ Info: Epoch 1
[ Info: Epoch 2
[ Info: Epoch 3
There is
1
method for Flux.early_stopping
:
The following page links back here: