The brain has to adopt strategies that optimize its performance for the challenges of environment even if sensory stimuli are high dimensional and ambiguous. My research focuses on what representation of the information is efficient for encoding the environmental stimuli and what computations the brain has to perform to achieve optimal performance. I use formal models to characterize these aspects of the nervous system. I use the tools of probabilistic generative models and Bayesian inference for both high-level models of human behavior and lower-level models of neural activity.