3. Kernel decorators

These decorators convert a callable to a subclass of Kernel. The decorators can be used both with and without keyword arguments. The keyword arguments will be passed as initialization arguments to the superclass, and will be overwritten by keyword arguments given at initialization of the subclass.

lsqfitgp.kernel(*args, **kw)

Decorator to convert a function to a subclass of Kernel. Example:

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

Decorator to convert a function to a subclass of StationaryKernel. Example:

@stationarykernel(input='soft')
def MyKernel(absdelta, cippa=1, lippa=42):
    return cippa * sum(
        np.exp(-absdelta[name] / lippa)
        for name in absdelta.dtype.names
    )
lsqfitgp.isotropickernel(*args, **kw)

Decorator to convert a function to a subclass of IsotropicKernel. Example:

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