Class SumKernel<T>

java.lang.Object
smile.math.kernel.SumKernel<T>
Type Parameters:
T - the input type of kernel function.
All Implemented Interfaces:
Serializable, ToDoubleBiFunction<T,T>, MercerKernel<T>

public class SumKernel<T> extends Object implements MercerKernel<T>
The sum kernel takes two kernels and combines them via k1(x, y) + k2(x, y)
See Also:
  • Constructor Details

    • SumKernel

      public SumKernel(MercerKernel<T> k1, MercerKernel<T> k2)
      Constructor.
      Parameters:
      k1 - the kernel to combine.
      k2 - the kernel to combine.
  • Method Details

    • k

      public double k(T x, T y)
      Description copied from interface: MercerKernel
      Kernel function.
      Specified by:
      k in interface MercerKernel<T>
      Parameters:
      x - an object.
      y - an object.
      Returns:
      the kernel value.
    • kg

      public double[] kg(T x, T y)
      Description copied from interface: MercerKernel
      Computes the kernel and its gradient over hyperparameters.
      Specified by:
      kg in interface MercerKernel<T>
      Parameters:
      x - an object.
      y - an object.
      Returns:
      the kernel value and gradient.
    • of

      public MercerKernel<T> of(double[] params)
      Description copied from interface: MercerKernel
      Returns the same kind kernel with the new hyperparameters.
      Specified by:
      of in interface MercerKernel<T>
      Parameters:
      params - the hyperparameters.
      Returns:
      the same kind kernel with the new hyperparameters.
    • hyperparameters

      public double[] hyperparameters()
      Description copied from interface: MercerKernel
      Returns the hyperparameters of kernel.
      Specified by:
      hyperparameters in interface MercerKernel<T>
      Returns:
      the hyperparameters of kernel.
    • lo

      public double[] lo()
      Description copied from interface: MercerKernel
      Returns the lower bound of hyperparameters (in hyperparameter tuning).
      Specified by:
      lo in interface MercerKernel<T>
      Returns:
      the lower bound of hyperparameters.
    • hi

      public double[] hi()
      Description copied from interface: MercerKernel
      Returns the upper bound of hyperparameters (in hyperparameter tuning).
      Specified by:
      hi in interface MercerKernel<T>
      Returns:
      the upper bound of hyperparameters.