Hi @junpenglao,
I’m not sure I follow. I am definitely interested in the last case, but am unsure of what you mean.
Suppose that train.content_id = [0, 0, 0, 1, 1]. There are 2 categories and the length of the vector is 5. Are you saying that instead of specifying the variable a_1 as
a_1 = pm.Normal(
'a_1', mu=0.0, tau=1 / a_1_sigma ** 2,
shape=train.content_id.cat.categories.size
)
specify the shape as len(train.content_id)? How would that work?
Further, do you have any literature covering examples of shared variables with nominal predictors? I could only find examples involving metric predictors here: http://docs.pymc.io/notebooks/posterior_predictive.html.
Thanks!