Adam
You will learn
How Adam combines momentum with a running scale, and why its bias correction makes step 1 a fixed size.
Adam combines the two ideas: m, a running mean of the gradient, as in momentum, and v, a running mean of its square, as in RMSProp; the step is lr m / sqrt(v). Both start at 0 and are too small early on, so Adam divides them by 1 - beta^t, and on step 1 that makes the move exactly lr times the sign of the gradient: gradients 2, -40 and 0.5 all move their weights by 0.001. On the spec's bowl (x - 3)^2 at lr 0.1, Adam rises from 0, overshoots to about 3.18 and settles at 3.00005 by step 200. The spec adam.t27 computes every step.