  Perception, in theoretical neuroscience, has been modeled as the encoding of
external stimuli into internal signals, which are then decoded. The Bayesian
mean is an important decoder, as it is optimal for purposes of both estimation
and discrimination. We present widely-applicable approximations to the bias and
to the variance of the Bayesian mean, obtained under the minimal and
biologically-relevant assumption that the encoding results from a series of
independent, though not necessarily identically-distributed, signals.
Simulations substantiate the accuracy of our approximations in the small-noise
regime. The bias of the Bayesian mean comprises two components: one driven by
the prior, and one driven by the precision of the encoding. If the encoding is
'efficient', the two components have opposite effects; their relative strengths
are determined by the objective that the encoding optimizes. The experimental
literature on perception reports both 'Bayesian' biases directed towards prior
expectations, and opposite, 'anti-Bayesian' biases. We show that different
tasks are indeed predicted to yield such contradictory biases, under a
consistently-optimal encoding-decoding model. Moreover, we recover Wei and
Stocker's "law of human perception", a relation between the bias of the
Bayesian mean and the derivative of its variance, and show how the coefficient
of proportionality in this law depends on the task at hand. Our results provide
a parsimonious theory of optimal perception under constraints, in which
encoding and decoding are adapted both to the prior and to the task faced by
the observer.
