I think I have a pretty basic question: When can I expect gp.conditional
and gp.prior
to agree when I run them both on the same data?
For example, the following model:
with pm.Model() as gp_model:
# data containers
X = pm.Data("X", item_times[:, None], shape=(None, 1))
trials = pm.Data("trials", item_trials)
sends = pm.Data("sends", item_sends)
# priors
ell1 = pm.HalfNormal("ell1", sigma=1.25)
ell2 = pm.HalfNormal("ell2", sigma=1.25)
eta1 = pm.HalfNormal("eta1", sigma=1.0)
eta2 = pm.HalfNormal("eta2", sigma=1.0)
# define the kernel
cov = eta1 * pm.gp.cov.Matern12(1, ell1) + eta2 * pm.gp.cov.Periodic(1, 12, ls=ell2)
gp = pm.gp.Latent(cov_func=cov)
f = gp.prior("f", X=X)
# logit link and Binomial likelihood
lik = pm.Binomial("lik", n=trials, logit_p=f, observed=sends)
is sampled with nutpie
:
compiled_gp_model = nutpie.compile_pymc_model(gp_model)
idata = nutpie.sample(
compiled_gp_model, chains=2
)
and then we extend it with
with gp_model:
f_pred = gp.conditional("f_pred", item_times[:, None])
idata.extend(
pm.sample_posterior_predictive(
idata,
var_names=["f_pred"],
)
)
and I would (naively) expect that the idata.posterior.f
and idata.posterior_predictive.f_pred
would “agree” in some sense, but they are wildly different.
For some example data this is the plot of both:
Am I misunderstanding what is happening?