A generalized Bayes rule for prediction