# Batched Gaussian Processes

Hello,

I have a model where I need to optimize N independent Gaussian processes and would like to have a way to batch them using PyMC3’s GP API.

N is usually less than 10, so not massive. I basically need a way to specify

K_i(x, x') = \sigma^2 \exp \left[ -\frac{(x_i-x_i')^2}{2l_i^2} \right]

where i is the index for each batch, and x has shape (n, 3) but my Y data has shape (N, n).

Is there a way to do this natively in PyMC3? If not, can we hack it together using lists?

I can go into more detail about the goal, if needed, or I can link the paper I am reproducing.

Have you look into using MatrixNormal or KroneckerNormal?

I don’t quite see how to make those work for my problem. Can you give an example?

Examples can be found here

or one can use

Sd_gp_len_scale = expected_length_scale_list
GP_len_scale    = []

for i in range(len(Sd_gp_len_scale)):

GP_len_scale.append(pm.HalfNormal('GP_len_scale['+str(i)+']',
sigma = Sd_gp_len_scale[i])) #one can substitute their own variable names and distributions