First-order and Stochastic Optimization Methods for Machine Learning