Thank you! This has been extremely helpful!
A note for anyone who may stumble upon this in future…
For whatever reason, pm.math.softmax didn’t exist for me. However Jesse’s solution with these two small changes gave the same result…
responses = pm.Multinomial(
"responses",
n=df_n.values,
# p=pm.math.softmax(respondent_prefs, axis=1),
p=theano.tensor.nnet.softmax(respondent_prefs), # <---- Replacement
shape=(n_respondents,n_options),
observed=df
)
and
def softmax(x):
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum()
print(softmax(az.summary(trace, var_names=['pop_mu'])['mean']))