For some reason, I’m getting memory errors when running the following code on a simple regression model:
posterior_samples_regression = pm.sample_posterior_predictive(trace, model = model, samples=500)
This has worked in previous models. The full error code and model are below.
Error Code:
100%|██████████| 500/500 [06:02<00:00, 1.10s/it]
MemoryError Traceback (most recent call last)
in
----> 1 posterior_samples_regression = pm.sample_posterior_predictive(trace, model = model, samples=500)~/anaconda3/lib/python3.7/site-packages/pymc3/sampling.py in sample_posterior_predictive(trace, samples, model, vars, size, random_seed, progressbar)
1144 indices.close()
1145
→ 1146 return {k: np.asarray(v) for k, v in ppc_trace.items()}
1147
1148~/anaconda3/lib/python3.7/site-packages/pymc3/sampling.py in (.0)
1144 indices.close()
1145
→ 1146 return {k: np.asarray(v) for k, v in ppc_trace.items()}
1147
1148~/anaconda3/lib/python3.7/site-packages/numpy/core/numeric.py in asarray(a, dtype, order)
499
500 “”"
→ 501 return array(a, dtype, copy=False, order=order)
502
503MemoryError:
Model:
b_input = tt.shared(np.asarray(X_train))
with pm.Model() as model:
#priors a = pm.Normal('intercept', mu = 0, sd = 5) beta = pm.Normal('betas', mu = 0, sd = 5) sd = pm.HalfCauchy('sd', 5) mu = a + T.dot(beta, b_input) y = pm.Normal('y', mu = mu, sd = sd, observed = Y_train)
Has anyone else seen this specifically with sampling the posterior?