Averaged Stochastic Gradient Descent (Polyak-Ruppert averaging).
Runs SGD with a decaying step size and a decay on the parameter
itself, while also maintaining a running average (ax)
of the parameter values. The algorithm is the reference framework's,
state names and all: step, eta, mu and ax per
parameter.
Math
With the slot's own step count (1 on its first update), and the values carried over from the previous step (, ):
then, for the next step,
Before the average therefore tracks exactly; after it, is the mean of the iterates since .
References
Polyak and Juditsky, "Acceleration of stochastic approximation by averaging" (SIAM J. Control Optim., 1992).
See Also
SGD : the plain instantaneous update.
Attributes
lr_doubleeta is first set and each time it is advanced, so a scheduler's change takes effect from the next step's eta.lambd_doublealpha_doublet0_doubleweight_ decay_doubleax_std::vector<Storage>eta_ , mu_std::vector<double>round_to_state_scalar) so a restored run continues bit-identically.Notes
is the slot's own update count (Optimizer::steps_), so a
parameter introduced into training late (or temporarily frozen) starts
its own schedule.
Constructors
1Construct an ASGD optimizer.
Parameters
paramsstd::vector<std::shared_ptr<TensorImpl>>lrdouble= None1e-2). Must be non-negative.lambddouble= None1e-4).alphadouble= None0.75).t0double= None1e6).weight_ decaydouble= None0.0).Static methods
1Virtual methods
2Methods
5Allocate per-slot state on the first observed gradient.
ax_ starts at zero, eta_ at the current learning rate and
mu_ at one.
Parameters
istd::size_tpconst std::shared_ptr<TensorImpl>&set_hyperparams
void set_hyperparams(double lr, double lambd, double alpha, double t0, double weight_decay)Replace the hyper-parameters between steps; nothing is applied when check_hyperparams rejects them. lr reaches the update through the next step's eta, which the reference framework computes at the end of each step.
Checkpoint identifier ("asgd_v1").
Apply the ASGD update for one parameter slot.
Decays and steps with the slot's current , folds it into with , then advances and for the slot's next step.
Parameters
istd::size_tparams_, ax_, eta_, mu_.pstd::shared_ptr<TensorImpl>&gconst Storage&