Gaussian Process with 2 dimension input

Hi, you can check this notebook of Multidimensional GP with 2 predictors from Chris Fonnesbeck’s repos on this link

I copy the model here:

with pm.Model() as spatial_model:
    
    l = pm.HalfCauchy("l", beta=3, shape=(2,))
    sf2 = pm.HalfCauchy("sf2", beta=3)
    sn2 = pm.HalfCauchy("sn2", beta=3)

    K = pm.gp.cov.ExpQuad(2, l) * sf2**2
    
    gp_spatial = pm.gp.MarginalSparse(cov_func=K, approx="FITC")
    obs = gp_spatial.marginal_likelihood("obs", X=X_obs, Xu=Xu, y=y_obs, noise=sn2)

    mp = pm.find_MAP()

As X_obs has 2 columns, we need to set 2 in pm.gp.cov.ExpQuad(2, l).

Regards

1 Like