In the paper, we focus primarily on the problem of recovering a linear form g’*x of unknown “signal” x known to belong to a given convex compact set X in R^n from N independent realizations of a random variable taking values in a finite set, the distribution p of the variable being affinely parameterized by x. With no additional assumptions on X and the dependence of p on x, we develop minimax optimal, within an absolute constant factor, and computationally efficient estimation routine. We then apply this routine to recovering x itself in the Euclidean norm.