Skip to content

Commit

Permalink
Merge pull request #9 from ablaom/error-message-fix
Browse files Browse the repository at this point in the history
Make all criteria structs immutable
  • Loading branch information
ablaom authored Mar 1, 2021
2 parents 2b9a7c0 + a6d774b commit c16de2b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/criteria.jl
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function update_training(criterion::PQ, loss)
nothing)
end

update(::PQ, loss) = error("First loss reported to the GL early stopping "*
update(::PQ, loss) = error("First loss reported to the PQ early stopping "*
"algorithm must be a training loss. ")

function update_training(criterion::PQ, loss, state)
Expand Down Expand Up @@ -274,7 +274,7 @@ A stop is triggered by `n` consecutive increases in the loss.
Denoted "_UP_s" in $PRECHELT_REF.
"""
mutable struct Patience <: StoppingCriterion
struct Patience <: StoppingCriterion
n::Int
function Patience(n::Int)
n > 0 ||
Expand Down Expand Up @@ -314,7 +314,7 @@ If wrapped in a `stopper::EarlyStopper`, this is the number of calls
to `done!(stopper)`.
"""
mutable struct NumberLimit <: StoppingCriterion
struct NumberLimit <: StoppingCriterion
n::Int
function NumberLimit(n::Int)
n > 0 ||
Expand Down Expand Up @@ -344,7 +344,7 @@ $STOPPING_DOC
A stop is triggered as soon as the loss drops below `value`.
"""
mutable struct Threshold <: StoppingCriterion
struct Threshold <: StoppingCriterion
value::Float64
end
Threshold(; value=0.0) = Threshold(value)
Expand Down

0 comments on commit c16de2b

Please sign in to comment.