Hi Bill,
Following your example, I tried to use
gp = pm.gp.LatentKron(cov_funcs=[cov_x1, cov_x2])
f = gp.prior("f", Xs=Xs)
But I have difficulty in setting up Xs.
Following Kronecker Structured Covariances — PyMC3 3.11.4 documentation, which seems to be the example you are using, I set up Xs as:
Xs = [lons[:, None], lats[:, None]], dt_full_norm[:, None]]
where lons and lats are unique longitudes and latitudes, which will make a full grid if I use np.meshgrid. For time, dt_full_norm is the entire time stamp.
Then I applied as:
spatial_cov = pm.gp.cov.Matern52(input_dim=3, ls=[length_S, length_S], active_dims=[0,1])
temporal_cov = var*pm.gp.cov.ExpQuad(input_dim=3, ls=length_T, active_dims=[2])
gp = pm.gp.LatentKron(cov_funcs=[spatial_cov, temporal_cov])
f = gp.prior("f", Xs=Xs)
Then I have the following error message:
ValueError: Must provide a covariance function for each X
I think this happens because my Xs is a list instead of n x 3 array. I used to use n x 3 array, which was manually constructed by looking at only data points where observations are available. But Xs = [lons[:, None], lats[:, None]], dt_full_norm[:, None]] yields a list.
I think I am missing something here. Any suggestion?
Thank you.