JuliaAI / IterationControl.jl

A package for controlling iterative algorithms
Other
23 stars 1 forks source link

Add option Callback(f, raw=...) to apply f to raw model instead of expose(model) #22

Closed ablaom closed 3 years ago

ablaom commented 3 years ago

New docstring:

  Callback(f=_->nothing, stop_if_true=false, stop_message=nothing, raw=false)

  An iteration control, as in Callback(m->put!(v, my_loss_function(m)). 

  Call f(IterationControl.expose(model)), where model is the object being iterated, unless
  raw=true, in which case call f(model) (guaranteed if expose has not been overloaded.) If
  stop_if_true is true, then trigger an early stop if the value returned by f is true,
  logging the stop_message if specified.