EarlyStopping
struct
defined in module
FluxTraining
EarlyStopping(criteria...; kwargs...)
EarlyStopping(n)
Stop training early when
criteria
are met. See
EarlyStopping
.
jl
for available stopping
criteria.
Passing an integer
n
uses the simple patience criterion: stop if the
validation loss hasn’t increased for
n
epochs.
You can control which phases are taken to measure the out-of-sample loss
and the training loss with keyword arguments
trainphase
(default
AbstractTrainingPhase
) and
testphase
(default
AbstractValidationPhase
).
Learner
(
model
,
lossfn
,
callbacks
=
[
EarlyStopping
(
3
)
]
)
import
FluxTraining
.
ES
:
Disjunction
,
InvalidValue
,
TimeLimit
callback
=
EarlyStopping
(
Disjunction
(
InvalidValue
(
)
,
TimeLimit
(
0.5
)
)
)
Learner
(
model
,
lossfn
,
callbacks
=
[
callback
]
)
There are
4
methods for EarlyStopping
:
EarlyStopping(criterion::EarlyStopping.StoppingCriterion, state, testphase::Type{<:FluxTraining.Phases.Phase}, trainphase::Type{<:FluxTraining.Phases.Phase})
EarlyStopping(n::Int64; kwargs...)
EarlyStopping(criterion; testphase, trainphase)
EarlyStopping(criterion, state, testphase, trainphase)
The following pages link back here: