The update rules of Optimisers.jl, used through OptimizationOptimisers:
solve(prob, Adam(0.05), maxiters = 500). Each iteration evaluates the
gradient and the objective at the current point and moves it by the
rule's step; maxiters (or epochs) is required. With save_best = TRUE
(the default) the solution is the best point evaluated, and the last
iteration only evaluates. An iteration whose gradient is not finite does
not move the point.
Usage
Descent(eta = 0.100000001490116)
Momentum(eta = 0.01, rho = 0.9)
Nesterov(eta = 0.001, rho = 0.9)
RMSProp(
eta = 0.001,
rho = 0.9,
epsilon = 1e-08,
centred = FALSE,
centered = FALSE
)
Rprop(eta = 0.001, ell = c(0.5, 1.2), gamma = c(1e-06, 50))
Adam(eta = 0.001, beta = c(0.9, 0.999), epsilon = 1e-08)
Lion(eta = 0.001, beta = c(0.9, 0.999))
RAdam(eta = 0.001, beta = c(0.9, 0.999), epsilon = 1e-08)
AdaMax(eta = 0.001, beta = c(0.9, 0.999), epsilon = 1e-08)
OAdam(eta = 0.001, beta = c(0.5, 0.9), epsilon = 1e-08)
AdaGrad(eta = 0.1, epsilon = 1e-08)
AdaDelta(rho = 0.9, epsilon = 1e-08)
AMSGrad(eta = 0.001, beta = c(0.9, 0.999), epsilon = 1e-08)
NAdam(eta = 0.001, beta = c(0.9, 0.999), epsilon = 1e-08)
AdamW(
eta = 0.001,
beta = c(0.9, 0.999),
lambda = 0,
epsilon = 1e-08,
couple = TRUE
)
AdaBelief(eta = 0.001, beta = c(0.9, 0.999), epsilon = 1e-16)
WeightDecay(lambda = 5e-04)
SignDecay(lambda = 0.001)
ClipGrad(delta = 10)
ClipNorm(omega = 10, p = 2, throw = TRUE)
OptimiserChain(...)
AccumGrad(n)
ADAM(...)
ADAMW(...)
NADAM(...)
RADAM(...)
OADAM(...)
ADAGrad(...)
ADADelta(...)
OptimisersArguments
- eta
Learning rate.
- rho
Momentum or decay factor.
- epsilon
Constant against division by zero.
- centred, centered
Use the centered variant of RMSProp (
centredis the name of the Julia keyword).- ell
Decrease and increase factors of Rprop.
- gamma
Smallest and largest step of Rprop.
- beta
Decay of the first and second moment estimates.
- lambda
Weight decay strength.
- couple
Couple the weight decay of AdamW with the learning rate.
- delta
Clipping bound of each component.
- omega
Largest norm of the gradient.
- p
Order of the norm.
- throw
Signal an error when the norm is not finite.
- ...
Rules of the chain, or the arguments of the rule.
- n
Number of gradients to accumulate.
Details
Descent(eta):x - eta * g. The defaultetais the single precision 0.1 of Julia, 0.10000000149011612.Momentum(eta, rho): velocityv = rho * v + eta * g, stepv.Nesterov(eta, rho): Nesterov momentum.RMSProp(eta, rho, epsilon, centred): scaling by the root mean square of the gradients (when centered: of their variance).Rprop(eta, ell, gamma): steps by the sign of the gradient with adaptive sizes, multiplied byelland kept withingamma.Adam(eta, beta, epsilon),AdaMax,NAdam,RAdam,OAdam,AMSGrad,AdaBelief: the Adam family.AdamW(eta, beta, lambda, epsilon, couple): Adam with weight decay (coupled with the learning rate as in pytorch, or decoupled).Lion(eta, beta): steps by the sign of an interpolated momentum.AdaGrad(eta, epsilon),AdaDelta(rho, epsilon).WeightDecay(lambda)addslambda * xto the gradient andSignDecay(lambda)addslambda * sign(x);ClipGrad(delta)clamps every component to[-delta, delta]andClipNorm(omega, p)rescales a gradient whosepnorm exceedsomega. These are meant to be composed withOptimiserChain(...), which applies its rules in order.AccumGrad(n)in a chain accumulates the mean ofngradients before the later rules see it; in between the point does not move.
ADAM, ADAMW, NADAM, RADAM, OADAM, ADAGrad and ADADelta are
the deprecated Optimisers.jl spellings of the same rules. Optimisers is
the module: a list of the rules and of setup(rule, x) (the initial
state), update(state, x, dx) (returns list(state, x)) and
apply(rule, state, x, dx) (returns list(state, dx), the step to
subtract).
Examples
f <- function(u, p) (1 - u[1])^2 + 100 * (u[2] - u[1]^2)^2
g <- function(u, p) c(-2 * (1 - u[1]) - 400 * u[1] * (u[2] - u[1]^2), 200 * (u[2] - u[1]^2))
prob <- OptimizationProblem(f, c(-1.2, 1), grad = g)
solve(prob, Adam(0.05), maxiters = 300)$u
#> [1] -0.10944888 0.01256562
solve(prob, OptimiserChain(ClipNorm(1), Descent(1e-3)), maxiters = 100)$objective
#> [1] 8.092378