Anytime Prediction and Learning for the Balance between Computation and Accuracy