pytorchtorchgaussian-processgpytorch

Applying kernels to separate dimensions in gpytorch


I am translating three-dimensional Gaussian process regression code from GPflow into GPyTorch to take advantage of PyTorch's native scalability for exact GPR.

This example is helpful, but can't find an explanation for how to apply distinct kernels to individual dimensions in a multi-dimensional GPR (e.g. a Matern52 kernel to dimensions [0,1], and a Matern 32 kernel to dimension [2]).

Does GPyTorch support that functionality, and if so how is it implemented/where can I find an example?


Solution

  • Use "active_dims" in the kernel functions :

    from(https://docs.gpytorch.ai/en/v1.1.1/kernels.html#rbfkernel) active_dims (tuple of ints, optional): Set this if you want to compute the covariance of only a few input dimensions. The ints corresponds to the indices of the dimensions. Default: None.