I’m trying to predict using the model below:
with pm.Model() as model:
smoothing_param = shared(smoothing)
mu = pm.HalfNormal("mu", sigma=1e3)
tau = pm.Exponential("tau", 1.0/1e3)
z = pm.GaussianRandomWalk("z",
mu=mu,
tau=tau / (1.0 - smoothing_param),
shape=self.y_len)
y = pm.Normal("y",
mu=z,
tau=tau / smoothing_param,
observed=self.y_shared)
The model samples fine when the y_shared values are:
array([0.3373, 0.3919, 0.3656, 0.427 , 0.5428, 0.58 , 0.636 , 0.6937,
0.7287, 0.7345, 0.7517, 0.7874, 0.8003, 0.8062, 0.81 , 0.8394,
0.8432, 0.8794])
but if I pad the observation with NaNs to predict, I get the following error:
Auto-assigning NUTS sampler...
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (4 chains in 4 jobs)
NUTS: [sigma, intercept, step_m, glb_m]
Sampling 4 chains: 0%| | 0/10000 [00:00<?, ?draws/s]/.../lib/python3.7/site-packages/numpy/core/fromnumeric.py:3257: RuntimeWarning: Mean of empty slice.
out=out, **kwargs)
/.../lib/python3.7/site-packages/numpy/core/fromnumeric.py:3257: RuntimeWarning: Mean of empty slice.
out=out, **kwargs)
/.../lib/python3.7/site-packages/numpy/core/fromnumeric.py:3257: RuntimeWarning: Mean of empty slice.
out=out, **kwargs)
/...lib/python3.7/site-packages/numpy/core/fromnumeric.py:3257: RuntimeWarning: Mean of empty slice.
out=out, **kwargs)
Sampling 4 chains: 0%| | 0/10000 [00:00<?, ?draws/s]
Bad initial energy, check any log probabilities that are inf or -inf, nan or very small:
y NaN
Having read through a number of posts and comments on predicting/interpolating, my understanding was that this is the way to sample from unseen/oos data.
What should I do differently here?
c.f. Getting 'Bad initial energy: inf' when trying to sample simple model