A Survey of Optimization Methods from a Machine Learning Perspective