DifferenceKernel

class safemdp.DifferenceKernel(kernel)

A fake kernel that can be used to predict differences two function values.

Given a gp based on measurements, we aim to predict the difference between the function values at two different test points, X1 and X2; that is, we want to obtain mean and variance of f(X1) - f(X2). Using this fake kernel, this can be achieved with mean, var = gp.predict(np.hstack((X1, X2)), kern=DiffKernel(gp.kern))

Parameters:

kernel: GPy.kern.*

The kernel used by the GP

Methods

K(x1[, x2]) Equivalent of kern.K
Kdiag(x) Equivalent of kern.Kdiag for the difference prediction.
K(x1, x2=None)

Equivalent of kern.K

If only x1 is passed then it is assumed to contain the data for both whose differences we are computing. Otherwise, x2 will contain these extended states (see PosteriorExact._raw_predict in GPy/inference/latent_function_inference0/posterior.py)

Parameters:

x1: np.array

x2: np.array

Kdiag(x)

Equivalent of kern.Kdiag for the difference prediction.

Parameters:x: np.array