Kernel decorators

These decorators are the preferred way to create subclasses of CrossKernel.

Index

crosskernel, kernel, crossstationarykernel, stationarykernel, crossisotropickernel, isotropickernel

Decorators

lsqfitgp.crosskernel(*args, bases=None, **kw)[source]

Decorator to convert a function to a subclass of CrossKernel.

Parameters:
*args

Either a function to decorate, or no arguments. The function is used as the core argument to CrossKernel.

basestuple of types, optional

The bases of the new class. If not specified, use CrossKernel.

**kw

Additional arguments are passed to CrossKernel.

Returns:
class_or_deccallable or type

If args is empty, a decorator ready to be applied, else the kernel class.

Notes

Arguments passed to the class constructor may modify the class. If the object returned by the the constructor is a subclass of the superclass targeted by the decorator, and all the arguments passed at instantiation are passed down to the decorated function, the class of the object is enforced to be the new class.

Examples

>>> @lgp.crosskernel(derivable=True)
... def MyKernel(x, y, a=0, b=0):
...     return (x - a) * (y - b)
lsqfitgp.kernel(*args, **kw)[source]

Like crosskernel but makes a subclass of Kernel.

Examples

>>> @lgp.kernel(loc=10) # the default loc will be 10
... def MyKernel(x, y, cippa=1, lippa=42):
...     return cippa * (x * y) ** lippa
lsqfitgp.crossstationarykernel(*args, **kw)[source]

Like crosskernel but makes a subclass of CrossStationaryKernel.

lsqfitgp.stationarykernel(*args, **kw)[source]

Like crosskernel but makes a subclass of StationaryKernel.

Examples

>>> @lgp.stationarykernel(input='posabs')
... def MyKernel(absdelta, cippa=1, lippa=42):
...     return cippa * sum(
...         jnp.exp(-absdelta[name] / lippa)
...         for name in absdelta.dtype.names
...     )
lsqfitgp.crossisotropickernel(*args, **kw)[source]

Like crosskernel but makes a subclass of CrossIsotropicKernel.

lsqfitgp.isotropickernel(*args, **kw)[source]

Like crosskernel but makes a subclass of IsotropicKernel.

Examples

>>> @lgp.isotropickernel(derivable=True)
... def MyKernel(distsquared, cippa=1, lippa=42):
...     return cippa * jnp.exp(-distsquared) + lippa