[reposted from frequently asked as I am not sure if that was the right place to ask]
Hi, i’m following the Statistical Rethinking textbook with the PYMC code examples here.
I followed the example and used aesara’s shared to manipulate a predictor variable but was met with the following error during pm.Model() on the pm.Deterministic line 7:
----> 7 mu = pm.Deterministic(‘mu’, a + ba * age_shared + bm * marriage_shared)
NotImplementedError : Cannot convert ba to a tensor variable.
marriage_shared = shared(data["Marriage_std"].values) age_shared = shared(data["MedianAgeMarriage_std"].values) with pm.Model() as m5_3a: # A -> D <- M sigma = pm.Exponential('sigma', 1) a = pm.Normal('a', 0, 0.2) ba = pm.Normal('ba', 0, 0.5) bm = pm.Normal('bm', 0, 0.5) mu = pm.Deterministic('mu', a + ba * age_shared + bm * marriage_shared) divorce = pm.Normal('divorce', mu, sigma, observed= d['divorce_std']) # A -> M sigma_m = pm.Exponential('sigma_m', 1) am = pm.Normal('am', 0, 0.2) bam = pm.Normal('bam', 0 , 0.5) mu_m = pm.Deterministic('mu_m', am + bam * age_shared) marriage = pm.Normal('marriage', mu_m, sigma_m, observed= d['marriage_std']) trace5_3a = pm.sample()
pymc = 5.0.1
aesara = 2.8.10
Any idea what went wrong?