Module Gd_d.Make
Parameters
Signature
type status
= Owl_opt__.Status.t
=
|
Continue of float
|
Stop of float
optimization status
type stop
= float -> state -> bool
stopping criterion function type
val iter : state -> int
iter s
returns the number of iterations for optimisation states
val prev_fv : state -> float
prev_fv s
returns the last objective function value of states
val fv_hist : state -> float list
fv_hist s
returns the history of the objective function values of states
up to the last objective function value (i.e.,prev_f s
is the same asList.hd (fv_hist s)
)
val init : prms0:prms -> lr:Owl_opt.Lr.t -> unit -> state
init ~prms0 ~lr ()
initialises and returns optimisation state for initial parmatersprms0
and learning ratelr
val stop : float -> state -> bool
stop fv s
is the default stopping criterion, which prints out the iteration and objective function value at each optimisation iteration and terminates when the objective function value goes below 1E-3
val min_step : ?stop:stop -> f:f -> state -> status
min_step ?(stop=stop) ~f s
computes the function valuefv
of optimization states
with parameters (i.e.,f (iter s) (prms s)
returnsfv
). If the stopping criterion is reached (i.e.stop fv s
istrue
), then returnStop fv
and no optimization is performed. Otherwise, minizief
by updating the parameters ofs
one step (in place) via gradient descent and returnsContinue fv
. Here,stop fv s
is a callback function that can be used to specify the termination criterion and print out intermediate function values.
val max_step : ?stop:stop -> f:f -> state -> status
max_step ?(stop=stop) ~f ~lr
is similar tomin_step
but maximises f.