Module Adam_s.Make

Parameters

Signature

type 'a t

user-defined record type

type fv = Owl.Algodiff.S.t

objective function value type

type prm = Owl.Algodiff.S.t

paramter type

type prms = prm t

user-defined paramter record type

type f = prms -> fv

objective function type

type state

internal state

type stop = state -> bool

stopping criterion function type

val iter : state -> int

iter s returns the number of iterations for optimisation state s

val prms : state -> prms

prms s returns the optimisation parameters of state s

val f : state -> f

f s returns the objective function of state s

val fv : state -> float

fv s returns the objective function value of state s

val init : prms0:prms -> f:f -> unit -> state

init ~prms0 ~f () returns an initialises optimisation state for initial parmaters prms0 and objective function f

val stop : state -> bool

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

val min : ?⁠stop:stop -> ?⁠beta1:float -> ?⁠beta2:float -> ?⁠eps:float -> lr:Owl_opt.Lr.t -> state -> state

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 here.

val max : ?⁠stop:stop -> ?⁠beta1:float -> ?⁠beta2:float -> ?⁠eps:float -> lr:Owl_opt.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.