It’s strange, but just try pm.sample. Sampling based on the likelihood surface works; but anything involving the RNG appears to be broken.
import numpy as np, pymc3 as pm
from matplotlib import pyplot as plt
x = np.arange(200)/20. - 5. ; y = np.exp(-x**2/2)/np.sqrt(2*np.pi)
plt.plot(x,y)
with pm.Model() as m:
v = pm.Interpolated('v', x.reshape((200,)), y.reshape((200,)))
tr = pm.sample(1000, tune=2000, chains=4, cores=4)
works for me.
However, there is weirdness the second you touch the prior predictive:
...
pm.sample_prior_predictive(500)
TypeError Traceback (most recent call last)
<ipython-input-28-f06baca22414> in <module>
5 with pm.Model() as m:
6 v = pm.Interpolated('v', x.reshape((200,)), y.reshape((200,)))
----> 7 tr = pm.sample_prior_predictive(10)
~/anaconda3/lib/python3.7/site-packages/pymc3-3.6-py3.7.egg/pymc3/sampling.py in sample_prior_predictive(samples, model, vars, random_seed)
1298 names = get_default_varnames(model.named_vars, include_transformed=False)
1299 # draw_values fails with auto-transformed variables. transform them later!
-> 1300 values = draw_values([model[name] for name in names], size=samples)
1301
1302 data = {k: v for k, v in zip(names, values)}
~/anaconda3/lib/python3.7/site-packages/pymc3-3.6-py3.7.egg/pymc3/distributions/distribution.py in draw_values(params, point, size)
390 point=point,
391 givens=temp_givens,
--> 392 size=size)
393 givens[next_.name] = (next_, value)
394 drawn[(next_, size)] = value
~/anaconda3/lib/python3.7/site-packages/pymc3-3.6-py3.7.egg/pymc3/distributions/distribution.py in _draw_value(param, point, givens, size)
484 return point[param.name]
485 elif hasattr(param, 'random') and param.random is not None:
--> 486 return param.random(point=point, size=size)
487 elif (hasattr(param, 'distribution') and
488 hasattr(param.distribution, 'random') and
~/anaconda3/lib/python3.7/site-packages/pymc3-3.6-py3.7.egg/pymc3/model.py in __call__(self, *args, **kwargs)
40
41 def __call__(self, *args, **kwargs):
---> 42 return getattr(self.obj, self.method_name)(*args, **kwargs)
43
44
TypeError: random() got an unexpected keyword argument 'point'