An Empirical Bayes Approach to Optimizing Machine Learning Algorithms