emukit.quadrature.interfaces package¶
Module contents¶
Interfaces for the quadrature package.
- class emukit.quadrature.interfaces.IBaseGaussianProcess(kern)¶
Bases:
IModel
,IDifferentiable
Interface for a Gaussian process as used by quadrature models.
Implementations of this class can be used by Gaussian process based quadrature models such as
WarpedBayesianQuadratureModel
.Note
When this class is initialized with data, use the raw evaluations Y of the integrand as this is a general Gaussian process class that can be used with various quadrature methods. Possible transformations of Y such as the ones applied in
WarpedBayesianQuadratureModel
will be performed automatically there.See also
- Parameters
kern (
QuadratureKernel
) – An instance of a quadrature kernel.
- property observation_noise_variance: float¶
The variance of the Gaussian observation noise.
- Return type
- predict_with_full_covariance(X_pred)¶
Predictive mean and full co-variance at the locations X_pred.
- Parameters
X_pred (
ndarray
) – Points at which to predict, shape (n_points, input_dim)- Return type
Tuple
[ndarray
,ndarray
]- Returns
Predictive mean, predictive full co-variance, shapes (num_points, 1) and (num_points, num_points).
- solve_linear(z)¶
Solve the linear system \(Gx=z\) for \(x\).
\(G\) is the Gram matrix \(G := K(X, X) + \sigma^2 I\), of shape (num_dat, num_dat) and \(z\) is a matrix of shape (num_dat, num_obs).
- Parameters
z (
ndarray
) – A matrix of shape (num_dat, num_obs).- Return type
ndarray
- Returns
The solution \(x\) of the linear, shape (num_dat, num_obs).
- graminv_residual()¶
The solution \(z\) of the linear system
\[(K_{XX} + \zeta^2 I) z = (Y - m(X))\]where \(X\) and \(Y\) are the available nodes and function evaluation, \(m(X)\) is the predictive mean at \(X\), and \(\zeta^2\) the observation noise variance.
- Return type
ndarray
- Returns
The solution \(z\) of the linear system, shape (num_dat, 1).
- class emukit.quadrature.interfaces.IStandardKernel¶
Bases:
object
Interface for a standard kernel k(x, x’) that in principle can be integrated.
See also
- K(x1, x2)¶
The kernel k(x1, x2) evaluated at x1 and 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
Kernel evaluated at x1, x2, shape (N, M).
- dK_dx1(x1, x2)¶
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 of the kernel wrt x1 evaluated at (x1, x2), shape (input_dim, N, M)
- dKdiag_dx(x)¶
The gradient of the diagonal of the kernel (the variance) v(x):=k(x, x) evaluated at x.
- Parameters
x (
ndarray
) – The locations where the gradient is evaluated, shape (n_points, input_dim).- Return type
ndarray
- Returns
The gradient of the diagonal of the kernel evaluated at x, shape (input_dim, n_points).
- class emukit.quadrature.interfaces.IBrownian¶
Bases:
IStandardKernel
Interface for a Brownian motion kernel.
\[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
Inherit from this class to wrap your standard Brownian motion kernel. The wrapped kernel can then be handed to a quadrature Brownian motion kernel that augments it with integrability.
See also
- dK_dx1(x1, x2)¶
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 of the kernel wrt x1 evaluated at (x1, x2), shape (input_dim, N, M)
- dKdiag_dx(x)¶
The gradient of the diagonal of the kernel (the variance) v(x):=k(x, x) evaluated at x.
- Parameters
x (
ndarray
) – The locations where the gradient is evaluated, shape (n_points, input_dim).- Return type
ndarray
- Returns
The gradient of the diagonal of the kernel evaluated at x, shape (input_dim, n_points).
- class emukit.quadrature.interfaces.IRBF¶
Bases:
IStandardKernel
Interface for an RBF kernel.
\[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 thevariance
property.Note
Inherit from this class to wrap your standard RBF kernel. The wrapped kernel can then be handed to a quadrature RBF kernel that augments it with integrability.
See also
- property lengthscales: ndarray¶
The lengthscales \(\lambda\) of the kernel.
- Return type
ndarray
- dK_dx1(x1, x2)¶
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 of the kernel wrt x1 evaluated at (x1, x2), shape (input_dim, N, M)
- dKdiag_dx(x)¶
The gradient of the diagonal of the kernel (the variance) v(x):=k(x, x) evaluated at x.
- Parameters
x (
ndarray
) – The locations where the gradient is evaluated, shape (n_points, input_dim).- Return type
ndarray
- Returns
The gradient of the diagonal of the kernel evaluated at x, shape (input_dim, n_points).
- class emukit.quadrature.interfaces.IProductBrownian¶
Bases:
IStandardKernel
Interface for a Brownian product kernel.
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') = \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 theoffset
property.Make sure to encode only a single variance parameter, and not one for each individual \(k_i\).
Note
Inherit from this class to wrap your standard product Brownian kernel. The wrapped kernel can then be handed to a quadrature product Brownian kernel that augments it with integrability.
See also
- class emukit.quadrature.interfaces.IProductMatern12¶
Bases:
IStandardKernel
Interface for a Matern12 (a.k.a. Exponential) product kernel.
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') = e^{-r_i}.\]\(d\) is the input dimensionality, \(r_i:=\frac{|x_i - x'_i|}{\lambda_i}\), \(\sigma^2\) is the
variance
property and \(\lambda_i\) is the \(i\) th element of thelengthscales
property.Make sure to encode only a single variance parameter, and not one for each individual \(k_i\).
Note
Inherit from this class to wrap your standard product Matern12 kernel. The wrapped kernel can then be handed to a quadrature product Matern12 kernel that augments it with integrability.
See also
- property lengthscales: ndarray¶
The lengthscales \(\lambda\) of the kernel.
- Return type
ndarray
- dKdiag_dx(x)¶
The gradient of the diagonal of the kernel (the variance) v(x):=k(x, x) evaluated at x.
- Parameters
x (
ndarray
) – The locations where the gradient is evaluated, shape (n_points, input_dim).- Return type
ndarray
- Returns
The gradient of the diagonal of the kernel evaluated at x, shape (input_dim, n_points).
- class emukit.quadrature.interfaces.IProductMatern32¶
Bases:
IStandardKernel
Interface for a Matern32 product kernel.
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') = (1 + \sqrt{3}r_i ) e^{-\sqrt{3} r_i}.\]\(d\) is the input dimensionality, \(r_i:=\frac{|x_i - x'_i|}{\lambda_i}\), \(\sigma^2\) is the
variance
property and \(\lambda_i\) is the \(i\) th element of thelengthscales
property.Make sure to encode only a single variance parameter, and not one for each individual \(k_i\).
Note
Inherit from this class to wrap your standard product Matern32 kernel. The wrapped kernel can then be handed to a quadrature product Matern32 kernel that augments it with integrability.
See also
- property lengthscales: ndarray¶
The lengthscales \(\lambda\) of the kernel.
- Return type
ndarray
- dKdiag_dx(x)¶
The gradient of the diagonal of the kernel (the variance) v(x):=k(x, x) evaluated at x.
- Parameters
x (
ndarray
) – The locations where the gradient is evaluated, shape (n_points, input_dim).- Return type
ndarray
- Returns
The gradient of the diagonal of the kernel evaluated at x, shape (input_dim, n_points).
- class emukit.quadrature.interfaces.IProductMatern52¶
Bases:
IStandardKernel
Interface for a Matern52 product kernel.
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') = (1 + \sqrt{5} r_i + \frac{5}{3} r_i^2) \exp(- \sqrt{5} r_i).\]\(d\) is the input dimensionality, \(r_i:=\frac{|x_i - x'_i|}{\lambda_i}\), \(\sigma^2\) is the
variance
property and \(\lambda_i\) is the \(i\) th element of thelengthscales
property.Make sure to encode only a single variance parameter, and not one for each individual \(k_i\).
Note
Inherit from this class to wrap your standard product Matern52 kernel. The wrapped kernel can then be handed to a quadrature product Matern52 kernel that augments it with integrability.
See also
- property lengthscales: ndarray¶
The lengthscales \(\lambda\) of the kernel.
- Return type
ndarray
- dKdiag_dx(x)¶
The gradient of the diagonal of the kernel (the variance) v(x):=k(x, x) evaluated at x.
- Parameters
x (
ndarray
) – The locations where the gradient is evaluated, shape (n_points, input_dim).- Return type
ndarray
- Returns
The gradient of the diagonal of the kernel evaluated at x, shape (input_dim, n_points).