mlkernels.kernel module

class mlkernels.kernel.Kernel[source]

Bases: algebra.function.Function

Kernel function.

Kernels can be added and multiplied.

elwise(*args, **kw_args)[source]

Construct the kernel vector x and y element-wise.

Parameters
  • x (input) – First argument.

  • y (input, optional) – Second argument. Defaults to first argument.

Returns

Kernel vector as a rank-2 column vector.

Return type

tensor

pairwise(*args, **kw_args)[source]

Construct the kernel matrix between all x and y.

Parameters
  • x (input) – First argument.

  • y (input, optional) – Second argument. Defaults to first argument.

Returns

Kernel matrix.

Return type

matrix

periodic(period=1)[source]

Map to a periodic space.

Parameters

period (tensor, optional) – Period. Defaults to 1.

Returns

Periodic version of the kernel.

Return type

kernel.Kernel

property stationary

Stationarity of the kernel.

mlkernels.kernel.elwise[source]

Construct the kernel vector x and y element-wise.

Parameters
  • kernel (Kernel) – Kernel.

  • x (input) – First argument.

  • y (input, optional) – Second argument. Defaults to first argument.

Returns

Kernel vector as a rank-2 column vector.

Return type

matrix or matrix.AbstractMatrix

mlkernels.kernel.pairwise[source]

Construct the kernel matrix between all x and y.

Parameters
  • k (Kernel) – Kernel.

  • x (input) – First argument.

  • y (input, optional) – Second argument. Defaults to first argument.

Returns

Kernel matrix.

Return type

matrix or matrix.AbstractMatrix

mlkernels.kernel.periodicise[source]

Map a kernel to a periodic space.

Parameters
  • k (kernel.Kernel) – Kernel to make periodic.

  • period (tensor, optional) – Period. Defaults to 1.

Returns

Periodic version of the kernel.

Return type

kernel.Kernel