Optimizing the control of transition to turbulence using a Bayesian method