Hi Experts
I am experimenting with Gaussian Process smoothing notebook on some Danish Covid-19 numbers.
I want to make predictions on hold-out data. I have looked at some of the other examples but cant get it to work…When I look at the shape of the postererior it still have the wrong dimension.
LARGE_NUMBER = 1e5
from theano import shared
model = pm.Model()
x_shared = theano.shared(train_set.index)
y_shared = theano.shared(y)
with model:
smoothing_param = shared(0.9)
mu = pm.Normal("mu", sigma=LARGE_NUMBER)
tau = pm.Exponential("tau", 1.0/LARGE_NUMBER)
z = GaussianRandomWalk("z",
mu=mu,
tau=tau / (1.0 - smoothing_param),
shape=y.shape)
obs = pm.Normal("obs",
mu=z,
tau=tau / smoothing_param,
observed=y)
with model:
tr = pm.sample(1000, init='advi_map',tune=500, chains=1, cores=1, target_accept=0.95)
x_shared=[0,1,2]
with model:
# Switch out the observations and use `sample_posterior_predictive` to predict
#pm.set_data({'x_shared': new_values})
pred_samples = pm.sample_posterior_predictive(tr, samples=1000)
Thanks