Nonparametric inference of prior probabilities from Bayes-optimal behavior