An Optimization Point of View of Learning Tasks