Accelerated Gradient Methods for Stochastic Optimization and Online Learning