Polynomial#
- class tinygp.kernels.Polynomial(order: tinygp.helpers.JAXArray, scale: tinygp.helpers.JAXArray = <factory>, sigma: tinygp.helpers.JAXArray = <factory>)[source]#
Bases:
Kernel
A polynomial kernel
\[k(\mathbf{x}_i,\,\mathbf{x}_j) = [(\mathbf{x}_i / \ell) \cdot (\mathbf{x}_j / \ell) + \sigma^2]^P\]- Parameters:
order – The power \(P\).
scale – The parameter \(\ell\).
sigma – The parameter \(\sigma\).
- evaluate(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray [source]#
Evaluate the kernel at a pair of input coordinates
This should be overridden be subclasses to return the kernel-specific value. Two things to note:
Users shouldn’t generally call
Kernel.evaluate()
. Instead, always “call” the kernel instance directly; for example, you can evaluate the Matern-3/2 kernel usingMatern32(1.5)(x1, x2)
, for arrays of input coordinatesx1
andx2
.When implementing a custom kernel, this method should treat
X1
andX2
as single datapoints. In other words, these inputs will typically either be scalars of have shapen_dim
, wheren_dim
is the number of input dimensions, rather thann_data
or(n_data, n_dim)
, and you should let theKernel
vmap
magic handle all the broadcasting for you.
- evaluate_diag(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray #
Evaluate the kernel on its diagonal
The default implementation simply calls
Kernel.evaluate()
withX
as both arguments, but subclasses can use this to make diagonal calcuations more efficient.