Plain SGD needs a decaying step size because its gradient noise never vanishes. SVRG and SAGA (Murphy, Probabilistic Machine Learning) build control variates whose variance shrinks as the iterates converge, so a constant step size reaches the optimum.
The objective is L2-regularized logistic regression with labels :
Both functions start from , use a constant step , and take the sampled example indices as input so runs are reproducible. Return the final as a 1-D float array.
svrg(X, y, lam, eta, idx): idx is a 2-D integer array with one row per epoch. At the start of each epoch set the snapshot and compute the full gradient . Then for each index in that row, in order:
saga(X, y, lam, eta, idx): idx is a 1-D integer array. Initialize a table for every and their average . For each index in order, compute at the current , step
and then replace by (the value computed before the step), updating to remain the table's mean.
Evaluate the sigmoid without overflow warnings (any output on stderr fails the run).