Sensory Adaptation within a Bayesian Framework for Perception