Hi!
I tried to implement the “Stochastic Volatility model” from the examples section of the website.
Copy & paste doesn’t work because the jupyter kernel crashes at this code block
with stochastic_vol_model:
prior = pm.sample_prior_predictive(500)
with the exception:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
~/anaconda3/envs/datascience/lib/python3.7/site-packages/pymc3/distributions/distribution.py in _draw_value(param, point, givens, size)
575 try:
--> 576 return dist_tmp.random(point=point, size=size)
577 except (ValueError, TypeError):
~/anaconda3/envs/datascience/lib/python3.7/site-packages/pymc3/distributions/continuous.py in random(self, point, size)
1960 nu, mu, lam = draw_values([self.nu, self.mu, self.lam],
-> 1961 point=point, size=size)
1962 return generate_samples(stats.t.rvs, nu, loc=mu, scale=lam**-0.5,
~/anaconda3/envs/datascience/lib/python3.7/site-packages/pymc3/distributions/distribution.py in draw_values(params, point, size)
412 if to_eval == missing_inputs:
--> 413 raise ValueError('Cannot resolve inputs for {}'.format([str(params[j]) for j in to_eval]))
414 to_eval = set(missing_inputs)
ValueError: Cannot resolve inputs for ['Elemwise{mul,no_inplace}.0']
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-234-9d6a8559045e> in <module>
1 with btc_model:
----> 2 prior = pm.sample_prior_predictive(50)
~/anaconda3/envs/datascience/lib/python3.7/site-packages/pymc3/sampling.py in sample_prior_predictive(samples, model, vars, var_names, random_seed)
1320 names = get_default_varnames(model.named_vars, include_transformed=False)
1321 # draw_values fails with auto-transformed variables. transform them later!
-> 1322 values = draw_values([model[name] for name in names], size=samples)
1323
1324 data = {k: v for k, v in zip(names, values)}
~/anaconda3/envs/datascience/lib/python3.7/site-packages/pymc3/distributions/distribution.py in draw_values(params, point, size)
393 point=point,
394 givens=temp_givens,
--> 395 size=size)
396 givens[next_.name] = (next_, value)
397 drawn[(next_, size)] = value
~/anaconda3/envs/datascience/lib/python3.7/site-packages/pymc3/distributions/distribution.py in _draw_value(param, point, givens, size)
583 with _DrawValuesContextBlocker():
584 val = np.atleast_1d(dist_tmp.random(point=point,
--> 585 size=None))
586 # Sometimes point may change the size of val but not the
587 # distribution's shape
~/anaconda3/envs/datascience/lib/python3.7/site-packages/pymc3/distributions/continuous.py in random(self, point, size)
1959 """
1960 nu, mu, lam = draw_values([self.nu, self.mu, self.lam],
-> 1961 point=point, size=size)
1962 return generate_samples(stats.t.rvs, nu, loc=mu, scale=lam**-0.5,
1963 dist_shape=self.shape,
~/anaconda3/envs/datascience/lib/python3.7/site-packages/pymc3/distributions/distribution.py in draw_values(params, point, size)
411 while to_eval or missing_inputs:
412 if to_eval == missing_inputs:
--> 413 raise ValueError('Cannot resolve inputs for {}'.format([str(params[j]) for j in to_eval]))
414 to_eval = set(missing_inputs)
415 missing_inputs = set()
ValueError: Cannot resolve inputs for ['Elemwise{mul,no_inplace}.0']
I’m using Python 3.6 with pymc3 3.7.
Any ideas? Found a bug report where someone suggested that changing variable string names…but not for me unfortunately
Thanks!