I’m trying an approach for prediction using pymc3 models:
In short: after training:
a) collect all the RVs that don’t have parent nodes i.e. are priors
b) form kde s out of their samples in the trace, after training
c) then recreate the model, removing any observed data that was given during training, re-defining these RVs (in (a)) as Interpolated distributions using kde s computed in (b).
d) run sample_prior_predictive using the updated model (and new input data if presented with)
However, in the process the random() method for the Interpolated distribution keeps throwing up an error that I don’t fully undestand. As an example: this snippet right here:
import numpy as np, pymc3 as pm
x = np.arange(10) ; y = np.random.random(10)
with pm.Model() as m:
v = pm.Interpolated(‘v’, x,y)
print(v.random(size = 10))
Traceback (most recent call last):
File “/home/tsanyal/anaconda3/lib/python3.7/site-packages/pymc3-3.6-py3.7.egg/pymc3/distributions/distribution.py”, line 617, in generate_samples
ValueError: Need at least 1 and at most 32 array objects.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “”, line 1, in
File “/home/tsanyal/anaconda3/lib/python3.7/site-packages/pymc3-3.6-py3.7.egg/pymc3/model.py”, line 43, in call
File “/home/tsanyal/anaconda3/lib/python3.7/site-packages/pymc3-3.6-py3.7.egg/pymc3/distributions/continuous.py”, line 3993, in random
File “/home/tsanyal/anaconda3/lib/python3.7/site-packages/pymc3-3.6-py3.7.egg/pymc3/distributions/distribution.py”, line 619, in generate_samples
ValueError: max() arg is an empty sequence
Any ideas on how to solve this?