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.