12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061# 1 "src/opt/adam/adam_intf.ml"moduletypeSig=sig(** user-defined record type *)type'at(** objective function value type *)typefv(** paramter type *)typeprm(** user-defined paramter record type *)typeprms=prmt(** objective function type *)typef=prms->fv(** internal state *)typestate(** stopping criterion function type *)typestop=state->bool(** [iter s] returns the number of iterations for optimisation state [s] *)valiter:state->int(** [prms s] returns the optimisation parameters of state [s] *)valprms:state->prms(** [f s] returns the objective function of state [s] *)valf:state->f(** [fv s] returns the objective function value of state [s] *)valfv:state->float(** [init ~prms0 ~f ()] returns an initialises optimisation state for initial parmaters [prms0] and objective function [f] *)valinit:prms0:prms->f:f->unit->state(** [stop 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-4 *)valstop:state->bool(** [min ?(stop=stop) ?(beta1=0.99) ?(beta2=0.999) ?(eps=1E-8) ~lr s] minimises f for optimisation state [s] using Adam. Once the stopping criterion is reached, the function returns the optimised state. The hyperparamters [beta1], [beta2], and [eps] are defined {{:https://arxiv.org/pdf/1412.6980.pdf}here}. *)valmin:?stop:stop->?beta1:float->?beta2:float->?eps:float->lr:Lr.t->state->state(** [max ?(stop=stop) ?(beta1=0.99) ?(beta2=0.999) ?(eps=1E-8) ~lr s] is similar to [min] but maximises f. *)valmax:?stop:stop->?beta1:float->?beta2:float->?eps:float->lr:Lr.t->state->stateend