You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some reason casting to Int64 does not make a numpy typed series and causes Theano to freak out. Just changing this cast to astype('int') here solves the issue.
#married = theano.shared(d.married)
with pm.Model() as model_69:
# Data
age = pm.Data('age', d['age'].values)
married = pm.Data('married', d['married'].values)
happiness = pm.Data('happiness', d['happiness'].values)
# Priors
a = pm.Normal('a', mu=0, sd=1, shape=2)
bA = pm.Normal('bA', mu=0, sd=2)
sigma = pm.Exponential('sigma', lam=1)
# Regression
mu = a[married] + bA * age
happy_hat = pm.Normal('happy_hat', mu=mu, sd=sigma, observed=happiness)
# Prior sampling, trace definition and posterior sampling
prior = pm.sample_prior_predictive(samples = 30)
posterior_69 = pm.sample()
posterior_pred_69 = pm.sample_posterior_predictive(posterior_69)
Running pymc3 3.10, tried reverting back to 3.7 for the purposes of working my way through this textbook, but I was running into tons of issues with theano. Any advice?
EDIT:
It appears that this may be a result of an interaction with age though as the very first line of the stack mentions this:
WARNING (theano.tensor.opt): Cannot construct a scalar test value from a test value with no size: age
I was getting a
TypeError
on this line even though you had casted the column to anInt64
already.statrethink_course_in_pymc3/notebooks/pymc3/rethink_stats_pymc3_w04.ipynb
Line 430 in 820436d
For some reason casting to
Int64
does not make a numpy typed series and causes Theano to freak out. Just changing this cast toastype('int')
here solves the issue.statrethink_course_in_pymc3/notebooks/pymc3/rethink_stats_pymc3_w04.ipynb
Line 396 in 820436d
I'll submit a PR later unless you get to this first 😄
The text was updated successfully, but these errors were encountered: