Predicting on new data with gp.conditional

I’m able to use a theano.shared for X_new, does this not work?

X_New_shared = theano.shared(X_New)

with model:
  f_pred = gp.conditional('f_pred', X_New_shared, shape=(X_New.shape[0], )) # needed to specify shape

then run ppc sampling

with model:
  pred_samples = pm.sample_posterior_predictive(map_trace, vars=[f_pred], samples=2000)

then swap out the shared value

X_New_shared.set_value(different_X_New)

then rerun sample_posterior_predictive,

with model:
  pred_samples = pm.sample_posterior_predictive(map_trace, vars=[f_pred], samples=2000)

Is this what you meant? But yes, agree with @BioGoertz, it would be nice to overwrite variables. I think it must be possible, but I’m not sure.

3 Likes