package owl-opt
 sectionYPositions = computeSectionYPositions($el), 10)"
  x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
  >
  
  
On This Page
  
  
  Owl's Optimisation Module
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
  
    
      v0.0.1.tar.gz
    
    
        
    
  
  
  
    
  
  
    
  
        sha256=2e35805a3479cb008133ebb768a8508cf9f46bc962a4c92a71dfdb11889b137e
    
    
  md5=2c8d6a63757fc7f43217aa94d54909e8
    
    
  doc/index.html
Owl Opt Library
The entry point of this library is Owl_opt.
Workflow
- define a record type 
'a tin some modulePrms - apply ppx deriver 
@@deriving prmsto type'a tso thatPrmshas typeOwl_opt.Prms.PT - pass 
Prmsthrough your favourite algorithm functor to create an optimisation moduleO - define an objective function 
fthat takes as input your record type'a t - define initial parameters 
prms0 - define learning rates 
lrwithOwl_opt.Lr - initialise optimisation state 
s0withO.init ~prms0 ~f - define stoping criterion function 
stop: state -> bool - minimise the optimisation session with 
O.min ~stop s0 
Example
 module Prms = struct
    type 'a t = {a: 'a; b: 'a} [@@deriving prms]
 end
 (* make an Adam optimisation module for the parameter definition Prms *)
 module O = Owl_opt.D.Adam.Make (Prms)
 (* define the objective function *)
 let f prms = Owl.Algodiff.D.Maths.(l2norm' (y - ((prms.a *@ x) + prms.b))) 
 (* define initial parameters *)
 let prms0 = {a = Owl.Algodiff.D.Mat.gaussian 5 5; b = Owl.Algodiff.D.gaussian 5 1} 
 (* define fixed learning rate *)
 let lr = Owl_opt.Lr.(Fix 1E-4) 
 (* initialise an optimisation session *)
 let s0 = O.init ~prms0 ~f () 
 (* define stopping criteria: stop when function value is smaller than 1E-4 *)
 let stop s = O.(fv s) < 1E-4
 (* minimise objective function f *)
 let s = O.min ~stop ~beta1:0.99 ~beta2:0.999 ~lr f
 (* final objective function value *)
 let c = O.fv s
 (* final prms *)
 let prms = O.prms s Important modules
1. Parameters
- module 
Owl_opt.Prmsand module type definitionOwl_opt.Prms.PT 
2. Learning rate
- module 
Owl_opt.Lr 
3. Double-precision
- Vanilla gradient descent 
Owl_opt.D.Gd.Make 
- Adam 
Owl_opt.D.Adam.Make 
- Rmsprop 
Owl_opt.D.Rmsprop.Make 
- Lbfgs (see Owl Opt Lbfgs)
 
4. Single-precision
- Vanilla gradient descent 
Owl_opt.S.Gd.Make 
- Adam 
Owl_opt.S.Adam.Make 
- Rmsprop 
Owl_opt.S.Rmsprop.Make 
 sectionYPositions = computeSectionYPositions($el), 10)"
  x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
  >
  
  
  On This Page