Stationary#
- class tinygp.kernels.stationary.Stationary(scale: JAXArray | float = <factory>, distance: Distance = <factory>)[source]#
Bases:
KernelA stationary kernel is defined with respect to a distance metric
Note that a stationary kernel is always isotropic. If you need more non-isotropic length scales, wrap your kernel in a transform using
tinygp.transforms.Linearortinygp.transforms.Cholesky.- Parameters:
scale – The length scale, in the same units as
distancefor the kernel. This must be a scalar.distance – An object that implements
distanceandsquared_distancemethods. Typically a subclass oftinygp.kernels.stationary.Distance. Each stationary kernel also has adefault_distanceproperty that is used whendistanceisn’t provided.
- abstractmethod evaluate(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray#
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 coordinatesx1andx2.When implementing a custom kernel, this method should treat
X1andX2as single datapoints. In other words, these inputs will typically either be scalars of have shapen_dim, wheren_dimis the number of input dimensions, rather thann_dataor(n_data, n_dim), and you should let theKernelvmapmagic 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()withXas both arguments, but subclasses can use this to make diagonal calcuations more efficient.