## Module contents¶

Bases: object

Abstract class for a kernel augmented with integrability.

Note

Each specific implementation of this class must go with a specific standard kernel as input which inherits from IStandardKernel. This is because we both want the QuadratureKernel to be backend agnostic but at the same time QuadratureKernel needs access to specifics of the standard kernel. For example a specific pair of QuadratureKernel and IStandardKernel is QuadratureRBF and IRBF. The kernel embeddings are implemented w.r.t. a specific integration measure, for example the LebesgueMeasure.

Parameters
K(x1, x2)

The kernel k(x1, x2) evaluated at x1 and x2.

Parameters
• x1 (ndarray) – First argument of the kernel.

• x2 (ndarray) – Second argument of the kernel.

Return type

ndarray

Returns

The kernel at x1, x2.

qK(x2)

The kernel with the first argument integrated out (kernel mean) evaluated at x2.

Parameters

x2 (ndarray) – The locations where the kernel mean is evaluated, shape (n_points, input_dim).

Return type

ndarray

Returns

The kernel mean at x2, shape (1, n_points).

Kq(x1)

The kernel with the second argument integrated out (kernel mean) evaluated at x1.

Parameters

x1 (ndarray) – The locations where the kernel mean is evaluated, shape (n_points, input_dim).

Return type

ndarray

Returns

The kernel mean at x1, shape (n_points, 1).

qKq()

The kernel integrated over both arguments x1 and x2.

Return type

float

Returns

Double integrated kernel.

dK_dx1(x1, x2)

The gradient of the kernel wrt x1 evaluated at pair x1, x2.

Parameters
• x1 (ndarray) – First argument of the kernel, shape (n_points N, input_dim).

• x2 (ndarray) – Second argument of the kernel, shape (n_points M, input_dim).

Return type

ndarray

Returns

The gradient at (x1, x2), shape (input_dim, N, M).

dK_dx2(x1, x2)

The gradient of the kernel wrt x2 evaluated at pair x1, x2.

Note that this is equal to the transposed gradient of the kernel wrt x1 evaluated at x2 and x1 (swapped arguments).

Parameters
• x1 (ndarray) – First argument of the kernel, shape (n_points N, N, input_dim).

• x2 (ndarray) – Second argument of the kernel, shape (n_points N, M, input_dim).

Return type

ndarray

Returns

The gradient at (x1, x2), shape (input_dim, N, M).

dKdiag_dx(x)

The gradient of the diagonal of the kernel $$v(x):=k(x, x)$$ evaluated at x.

Parameters

x (ndarray) – The locations where the gradient is evaluated, shape = (n_points M, input_dim).

Return type

ndarray

Returns

The gradient at x, shape (input_dim, M).

dqK_dx(x2)

The gradient of the kernel mean (integrated in first argument) evaluated at x2.

Parameters

x2 (ndarray) – The locations where the gradient is evaluated, shape (n_points N, N, input_dim).

Return type

ndarray

Returns

The gradient at x2, shape (input_dim, N).

dKq_dx(x1)

The gradient of the kernel mean (integrated in second argument) evaluated at x1.

Parameters

x1 (ndarray) – The locations where the gradient is evaluated, shape (n_points N, N, input_dim).

Return type

ndarray

Returns

The gradient with shape (N, input_dim).

Abstract class for a product kernel augmented with integrability.

The product kernel is of the form $$k(x, x') = \sigma^2 \prod_{i=1}^d k_i(x, x')$$ where $$k_i(x, x')$$ is a univariate kernel acting on dimension $$i$$.

Parameters
qK(x2, skip=None)

The kernel with the first argument integrated out (kernel mean) evaluated at x2.

Parameters

x2 (ndarray) – The locations where the kernel mean is evaluated, shape (n_points, input_dim).

Return type

ndarray

Returns

The kernel mean at x2, shape (1, n_points).

qKq()

The kernel integrated over both arguments x1 and x2.

Return type

float

Returns

Double integrated kernel.

dqK_dx(x2)

The gradient of the kernel mean (integrated in first argument) evaluated at x2.

Parameters

x2 (ndarray) – The locations where the gradient is evaluated, shape (n_points N, N, input_dim).

Return type

ndarray

Returns

The gradient at x2, shape (input_dim, N).

Bases: object

Mixin for quadrature kernel w.r.t. Lebesgue measure.

classmethod from_integral_bounds(kern, integral_bounds, normalized=False, variable_names='')

Create the quadrature kernel w.r.t. a Lebesgue measure from the integral bounds.

Parameters
Returns

An instance of a quadrature kernel w.r.t. Lebesgue measure.

Bases: object

Mixin for quadrature kernel w.r.t. Gaussian measure.

classmethod from_measure_params(kern, mean, variance, variable_names='')

Create the quadrature kernel w.r.t. a Gaussian measure from the measure parameters.

Parameters
• kern (IStandardKernel) – Standard EmuKit kernel.

• mean (ndarray) – The mean of the Gaussian measure, shape (input_dim, ).

• variance (Union[float, ndarray]) – The variances of the Gaussian measure, shape (input_dim, ). If a scalar value is given, all dimensions will have same variance.

• variable_names (str) – The (variable) name(s) of the integral

Returns

An instance of a quadrature kernel w.r.t. Gaussian measure.

Base class for a Brownian motion kernel augmented with integrability.

$k(x, x') = \sigma^2 \operatorname{min}(x, x')\quad\text{with}\quad x, x' \geq 0,$

where $$\sigma^2$$ is the variance property.

Note

This class is compatible with the standard kernel IBrownian. Each child of this class implements an embedding w.r.t. a specific integration measure.

Parameters
Raises
• ValueError – If measure has wrong dimensionality.

• ValueError – If the reasonable box of the measure allows for negative values.

property variance: float

The scale $$\sigma^2$$ of the kernel.

Return type

float

A Brownian motion kernel augmented with integrability w.r.t. the standard Lebesgue measure.

Parameters
qK(x2)

The kernel with the first argument integrated out (kernel mean) evaluated at x2.

Parameters

x2 (ndarray) – The locations where the kernel mean is evaluated, shape (n_points, input_dim).

Return type

ndarray

Returns

The kernel mean at x2, shape (1, n_points).

qKq()

The kernel integrated over both arguments x1 and x2.

Return type

float

Returns

Double integrated kernel.

dqK_dx(x2)

The gradient of the kernel mean (integrated in first argument) evaluated at x2.

Parameters

x2 (ndarray) – The locations where the gradient is evaluated, shape (n_points N, N, input_dim).

Return type

ndarray

Returns

The gradient at x2, shape (input_dim, N).

Base class for an RBF kernel augmented with integrability.

$k(x, x') = \sigma^2 e^{-\frac{1}{2}\sum_{i=1}^{d}r_i^2},$

where $$d$$ is the input dimensionality, $$r_i = \frac{x_i-x_i'}{\lambda_i}$$ is the scaled vector difference of dimension $$i$$, $$\lambda_i$$ is the $$i$$ th element of the lengthscales property and $$\sigma^2$$ is the variance property.

Note

This class is compatible with the standard kernel IRBF. Each child of this class implements an embedding w.r.t. a specific integration measure.

Parameters
property lengthscales: ndarray

The lengthscales $$\lambda$$ of the kernel.

Return type

ndarray

property variance: float

The scale $$\sigma^2$$ of the kernel.

Return type

float

An RBF kernel augmented with integrability w.r.t. the standard Lebesgue measure.

Parameters
qK(x2)

The kernel with the first argument integrated out (kernel mean) evaluated at x2.

Parameters

x2 (ndarray) – The locations where the kernel mean is evaluated, shape (n_points, input_dim).

Return type

ndarray

Returns

The kernel mean at x2, shape (1, n_points).

qKq()

The kernel integrated over both arguments x1 and x2.

Return type

float

Returns

Double integrated kernel.

dqK_dx(x2)

The gradient of the kernel mean (integrated in first argument) evaluated at x2.

Parameters

x2 (ndarray) – The locations where the gradient is evaluated, shape (n_points N, N, input_dim).

Return type

ndarray

Returns

The gradient at x2, shape (input_dim, N).

An RBF kernel augmented with integrability w.r.t. a Gaussian measure.

Parameters
qK(x2, scale_factor=1.0)

The kernel with the first argument integrated out (kernel mean) evaluated at x2.

Parameters

x2 (ndarray) – The locations where the kernel mean is evaluated, shape (n_points, input_dim).

Return type

ndarray

Returns

The kernel mean at x2, shape (1, n_points).

qKq()

The kernel integrated over both arguments x1 and x2.

Return type

float

Returns

Double integrated kernel.

dqK_dx(x2)

The gradient of the kernel mean (integrated in first argument) evaluated at x2.

Parameters

x2 (ndarray) – The locations where the gradient is evaluated, shape (n_points N, N, input_dim).

Return type

ndarray

Returns

The gradient at x2, shape (input_dim, N).

Base class for a product Matern52 kernel augmented with integrability.

The kernel is of the form $$k(x, x') = \sigma^2 \prod_{i=1}^d k_i(x, x')$$ where

$k_i(x, x') = (1 + \sqrt{5} r_i + \frac{5}{3} r_i^2) \exp(- \sqrt{5} r_i).$

Above, $$d$$ is the input dimensionality, $$r_i =\frac{|x_i - x'_i|}{\lambda_i}$$, is the scaled distance, $$\sigma^2$$ is the variance property and $$\lambda_i$$ is the $$i$$ th element of the lengthscales property.

Note

This class is compatible with the standard kernel IProductMatern52. Each subclass of this class implements an embedding w.r.t. a specific integration measure.

Parameters
property nu: float

The smoothness parameter of the kernel.

Return type

float

property lengthscales: ndarray

The lengthscales $$\lambda$$ of the kernel.

Return type

ndarray

property variance: float

The scale $$\sigma^2$$ of the kernel.

Return type

float

A product Matern52 kernel augmented with integrability w.r.t. the standard Lebesgue measure.

Parameters

Base class for a product Matern32 kernel augmented with integrability.

The kernel is of the form $$k(x, x') = \sigma^2 \prod_{i=1}^d k_i(x, x')$$ where

$k_i(x, x') = (1 + \sqrt{3}r_i ) e^{-\sqrt{3} r_i}.$

Above, $$d$$ is the input dimensionality, $$r_i =\frac{|x_i - x'_i|}{\lambda_i}$$, is the scaled distance, $$\sigma^2$$ is the variance property and $$\lambda_i$$ is the $$i$$ th element of the lengthscales property.

Note

This class is compatible with the standard kernel IProductMatern32. Each subclass of this class implements an embedding w.r.t. a specific integration measure.

Parameters
property nu: float

The smoothness parameter of the kernel.

Return type

float

property lengthscales: ndarray

The lengthscales $$\lambda$$ of the kernel.

Return type

ndarray

property variance: float

The scale $$\sigma^2$$ of the kernel.

Return type

float

A product Matern32 kernel augmented with integrability w.r.t. the standard Lebesgue measure.

Parameters

Base class for a product Matern12 (a.k.a. Exponential) kernel augmented with integrability.

The kernel is of the form $$k(x, x') = \sigma^2 \prod_{i=1}^d k_i(x, x')$$ where

$k_i(x, x') = e^{-r_i}.$

Above, $$d$$ is the input dimensionality, $$r_i =\frac{|x_i - x'_i|}{\lambda_i}$$, is the scaled distance, $$\sigma^2$$ is the variance property and $$\lambda_i$$ is the $$i$$ th element of the lengthscales property.

Note

This class is compatible with the standard kernel IProductMatern12. Each subclass of this class implements an embedding w.r.t. a specific integration measure.

Parameters
property nu: float

The smoothness parameter of the kernel.

Return type

float

property lengthscales: ndarray

The lengthscales $$\lambda$$ of the kernel.

Return type

ndarray

property variance: float

The scale $$\sigma^2$$ of the kernel.

Return type

float

A product Matern12 kernel augmented with integrability w.r.t. the standard Lebesgue measure.

Parameters

Base class for a product Brownian kernel augmented with integrability.

The kernel is of the form $$k(x, x') = \sigma^2 \prod_{i=1}^d k_i(x, x')$$ where

$k_i(x, x') = \operatorname{min}(x_i-c, x_i'-c)\quad\text{with}\quad x_i, x_i' \geq c,$

$$d$$ is the input dimensionality, $$\sigma^2$$ is the variance property and $$c$$ is the offset property.

Note

This class is compatible with the standard kernel IProductBrownian. Each subclass of this class implements an embedding w.r.t. a specific integration measure.

Parameters
Raises

ValueError – If the reasonable box of the measure allows for values smaller than the offset $$c$$.

property variance: float

The scale $$\sigma^2$$ of the kernel.

Return type

float

property offset: float

The offset $$c$$ of the kernel.

Return type

float