I want to model a joint Gaussian Process with two response variables using a linear combination of two dimensional covariance functions (i.e a linear Coregionalization spatial process Or a bivariate geostatistical model) .
My idea is similar to this one: Multi-output gaussian processes. However, I have had problems with the “multiplication” because, as I understand it uses the kronecker product.
The model I’m trying to implement is described in (Schmidt, Gelfand eq. 1)
The model I want to implement is the following:
Let S1 and S2 two gp with covariance = gp.cov.Matern32(input_dims=2)
And then use the sum of two kronecker products of the covariance matrix
Now, I first tried to use a tt.tensor array (2x2) to act as the coregionalization matrix.
Then produce the Kronnecker product (covariance function) and sum a similar function
This is the code:
with pm.Model() as model: ## Building the covariance structure sigma_p = pm.HalfNormal('sigma_p',sd=3) #phi = pm.Uniform('phi',0,15) phi_p = pm.HalfNormal('phi_p',sd=1) cov_p= sigma_p * pm.gp.cov.Matern32(2,phi_p,active_dims=[0,1]) ## Building the covariance structure sigma_s = pm.HalfNormal('sigma_s',sd=3) #phi = pm.Uniform('phi',0,15) phi_s = pm.HalfNormal('phi_s',sd=1) cov_s= sigma_s * pm.gp.cov.Matern32(2,phi_s,active_dims=[0,1]) ## Build corregionalization matrix A = pm.Normal(name='a',mu=0,sd=1,shape=(2,2)) ### Letś try to do the exercise with kronnecker prod fl1 = [A,cov_p] fl2 = [A,cov_s] K1 = pm.gp.cov.Kron(factor_list=fl1) K2 = pm.gp.cov.Kron(factor_list=fl2) K = K1 + K2 gp = pm.gp.Latent(cov_func=K) f = gp.prior("latent_field", X=TX.values,reparameterize=False) y_obs = pm.Bernoulli('y_obs',logit_p=f,observed=Y)
However I had an error saying that the RV_Free variable has no attribute “input_dims” meaning that the only way to make the gp.cov.Kron to work is with a factor_list argument composed of ONLY covariance functions (i.e. gp.cov.Covariance).
I tried then to use the function gp.cov.Coregion however it seems to work only when input_dims=1 i.e. it only accepts 1d datasets.
ValueError: Coregion requires exactly one dimension to be active
So my question is, Do you think that its possible to achieve this with the current implementation of the GP API?
Do I need to extend it to cover multiple dimensional linear corregionalisations ?
Thanks for reading