Kernels module (tmrc.kernels)

Various kernels used for RKHS-embedding and Diffusion Maps algorithm.

class tmrc.kernels.GaussianKernel(epsi=1.0)

The Gaussian kernel, defined by k(x,y)=exp(-||x-y||^2/epsi)

epsi

bandwidth of the kernel

Type:float
evaluate(np.array, np.array)

pairwise evaluation of the kernel

evaluate(x, y)

pairwise evaluation of the kernel

Parameters:
  • x (array of shape [# x points, system dimension]) – points for the first argument of the kernel
  • y (array of shape [# y points, system dimension]) – points for the second argument of the kernel
Returns:

matrix with pairwise kernel evaluations

Return type:

array of shape [# x points, # y points]

class tmrc.kernels.Kernel

Parent class for kernel functions.

Implements common methods that are independent of the specific kernel definition.

computeMercerEigs(self, xtest, neigs)

Computes the Mercer eigenvalues and eigenvectors associated with the kernel

computeMercerEigs(xtest, neigs)

Computes the Mercer eigenvalues and eigenvectors associated with the kernel

Parameters:
  • xtest (np.array) – Test points for the Mercer eigenfunctions
  • neigs (int) – number of eigenpairs to compute
Returns:

the first neigs eigenpairs of the Gram matrix

Return type:

tuple of (eigenvalues, eigenvectors)

pointcloudDist(X, Y)

Maximum mean discrepancy (MMD) between two densities (given by finite samples)

Parameters:
  • X (np.array of shape [# points, system dimension]) – contains samples from first density
  • Y (np.array of shape [# points, system dimension]) – contains samples from second density
Returns:

MMD between the two densities

Return type:

float

class tmrc.kernels.PolynomialKernel(p=2)

Polynomial kernel of arbitrary degree, defined by k(x,y)=(1-x’y)^p

p

degree of the kernel

Type:int
evaluate(np.array, np.array)

pairwise evaluation of the kernel

evaluate(x, y)

pairwise evaluation of the kernel

Parameters:
  • x (array of shape [# x points, system dimension]) – points for the first argument of the kernel
  • y (array of shape [# y points, system dimension]) – points for the second argument of the kernel
Returns:

matrix with pairwise kernel evaluations

Return type:

array of shape [# x points, # y points]