AlexNet used stochastic gradient descent with momentum 0.9 and weight decay 0.0005, with the weight decay folded into the momentum variable, and a learning rate it divided by 10 by hand whenever the validation error stopped improving. Implement both.
alexnet_step(w, v, grad, lr, momentum=0.9, weight_decay=0.0005)
grad is the gradient of the loss averaged over the batch, at w. Return (w_new, v_new) with
lr_schedule(val_errors, lr0=0.01, patience=1, max_drops=3)
val_errors[e] is the validation error measured at the end of epoch e. Return the list of learning rates used during each epoch (same length as val_errors).lr0. After epoch e: if its error is strictly lower than the best error seen so far, it becomes the new best and the count of epochs without improvement resets to 0; otherwise the count goes up by 1. When the count reaches patience and fewer than max_drops drops have happened, divide the learning rate by 10 (it applies from the next epoch) and reset the count to 0.max_drops drops the learning rate never changes again.