A Bayesian approach to data-driven optimization under uncertainty