Hello,
I was wondering if there is an easy way to differentiate a GP function respect to x*. I can easily do it numerically, but I want to get a posterior interval for it as well.
with pm.Model() as model:
x_scale = 2.0
m_scale = 8.0
eta1 = pm.HalfNormal("eta1", sigma=2)
cov_func1 = eta1 ** 2 * pm.gp.cov.Matern52(input_dim=input_dim, ls=x_scale, active_dims=[0]) \
* pm.gp.cov.Matern52(input_dim=input_dim, ls=m_scale, active_dims=[1])
eta2 = pm.HalfNormal("eta2", sigma=2)
cov_func2 = eta2 ** 2 * pm.gp.cov.Matern52(input_dim=input_dim, ls=x_scale, active_dims=[0]) \
* pm.gp.cov.Matern52(input_dim=input_dim, ls=m_scale, active_dims=[1])
gp1 = pm.gp.MarginalSparse(cov_func=cov_func1, approx="VFE")
gp2 = pm.gp.MarginalSparse(cov_func=cov_func2, approx="VFE")
# set flat prior for Xu
# Xu = pm.Flat("Xu1", shape=Xu_init.shape, testval=Xu_init)
sigma_1 = pm.HalfCauchy("sigma_1", beta=5)
sigma_2 = pm.HalfCauchy("sigma_2", beta=5)
y1_err_ = tt.sqrt(Ys1err * Ys1err + sigma_1 * sigma_1)
y2_err_ = tt.sqrt(Ys2err * Ys2err + sigma_2 * sigma_2)
y1_ = gp1.marginal_likelihood("y1", X=Xs, Xu=Xu_init, y=Ys1, noise=y1_err_)
y2_ = gp2.marginal_likelihood("y2", X=Xs, Xu=Xu_init, y=Ys2, noise=y2_err_)
with model:
mp = pm.find_MAP(method="BFGS")
Thanks,