How to set different priors to different features?

You can give a vector of parameters to independent multidimensional distributions to set different values for each component:

beta = pm.Normal('beta', mu=[0, 1], sigma=[0.1, 1], dims="predictors")

You can double check things like this using pm.draw to get a bunch of samples from a declared random variable, then check the summary statistics match what you’ve set:

pm.draw(beta, 1000).mean(axis=0)
>>> array([-1.38747093e-04,  1.00139075e+00])

pm.draw(beta, 1000).std(axis=0)
>>> array([0.10131437, 0.99300722])

Your concatenation method can also be checked this way, if you’re worried about the order of the betas. I think that way should work fine, what is wacky about your result?

1 Like