Polynomial¶
- class probnum.kernels.Polynomial(input_dim, constant=0.0, exponent=1.0)¶
Bases:
probnum.kernels._kernel.Kernel
[numpy.ndarray
]Polynomial kernel.
Covariance function defined by \(k(x_0, x_1) = (x_0^\top x_1 + c)^q\).
- Parameters
See also
Linear
Linear covariance function.
Examples
>>> import numpy as np >>> from probnum.kernels import Polynomial >>> K = Polynomial(input_dim=2, constant=1.0, exponent=3) >>> K(np.array([[1, -1], [-1, 0]])) array([[27., 0.], [ 0., 8.]])
Attributes Summary
Dimension of arguments of the covariance function.
Dimension of the evaluated covariance function.
Methods Summary
__call__
(x0[, x1])Evaluate the kernel.
Attributes Documentation
- input_dim¶
Dimension of arguments of the covariance function.
The dimension of inputs to the covariance function \(k : \mathbb{R}^{ d_{in}} \times \mathbb{R}^{d_{in}} \rightarrow \mathbb{R}^{d_{out} \times d_{out}}\).
- Return type
- output_dim¶
Dimension of the evaluated covariance function.
The resulting evaluated kernel \(k(x_0, x_1) \in \mathbb{R}^{d_{out} \times d_{out}}\) has shape=(output_dim, output_dim).
- Return type
Methods Documentation
- __call__(x0, x1=None)[source]¶
Evaluate the kernel.
Computes the covariance function at
x0
andx1
. If the inputs have more than one dimension the covariance function is evaluated pairwise for all observations determined by the first dimension ofx0
andx1
. If onlyx0
is given the kernel matrix \(K=k(X_0, X_0)\) is computed.- Parameters
- Returns
shape=(), (output_dim, output_dim) or (n0, n1) or (n0, n1, output_dim, output_dim) – Kernel evaluated at
x0
andx1
or kernel matrix containing pairwise evaluations for all observations inx0
(andx1
).- Return type
cov