A Bayesian Formulation of Behavioral Control