Module Rmsprop.Make
Parameters
AD : Owl_algodiff_generic_sig.Sig with type AD.A.elt = float
P : Owl_opt.Prms.PT
Signature
type fv
= AD.t
objective function value type
type prm
= AD.t
paramter type
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 : ?beta:float -> lr:Owl_opt.Lr.t -> prms0:prms -> unit -> state
init ?(beta=0.9) ~lr ~prms0 ~f ()
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) according to RMSprop 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.