The Sample Complexity of Optimizing a Convex Function