Cosine-annealing schedule from down to over epochs, following half a cosine wave.
Smoothly anneals the lr so training spends the early epochs at high lr (exploration) and the late epochs at low lr (convergence). Often combined with warm restarts (SGDR) for cyclic re-exploration.
Math
for ; saturates at for .
References
Loshchilov & Hutter, "SGDR: Stochastic Gradient Descent with Warm Restarts" (ICLR 2017) — Lucid does not yet implement the warm-restart variant.
Attributes
T_max_intCycle length in optimiser epochs.
eta_min_floatFloor of the schedule. Defaults to 0.
Constructors
1ctor
CosineAnnealingLR
void CosineAnnealingLR(Optimizer & opt, int T_max, double eta_min)Build a cosine-annealing schedule.
Parameters
optOptimizerTarget optimiser.
T_maxintNumber of epochs per half-cycle.
eta_minfloat, default 0.0Floor of the schedule.