Class BinarySparseLinearKernel

java.lang.Object
smile.math.kernel.BinarySparseLinearKernel
All Implemented Interfaces:
Serializable, ToDoubleBiFunction<int[],int[]>, Function, DotProductKernel, MercerKernel<int[]>

public class BinarySparseLinearKernel extends Object implements MercerKernel<int[]>, DotProductKernel
The linear dot product kernel on sparse binary arrays in int[], which are the indices of nonzero elements. When using a linear kernel, input space is identical to feature space.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    double[]
    hi()
    Returns the upper bound of hyperparameters (in hyperparameter tuning).
    double[]
    Returns the hyperparameters of kernel.
    double
    k(double dot)
    Computes the dot product kernel function.
    double
    k(int[] x, int[] y)
    Kernel function.
    double[]
    kg(double dot)
    Computes the dot product kernel function and its gradient over hyperparameters.
    double[]
    kg(int[] x, int[] y)
    Computes the kernel and its gradient over hyperparameters.
    double[]
    lo()
    Returns the lower bound of hyperparameters (in hyperparameter tuning).
    of(double[] params)
    Returns the same kind kernel with the new hyperparameters.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface smile.math.kernel.DotProductKernel

    apply, f, K

    Methods inherited from interface smile.math.Function

    inv

    Methods inherited from interface smile.math.kernel.MercerKernel

    apply, applyAsDouble, K, K, KG
  • Constructor Details

    • BinarySparseLinearKernel

      public BinarySparseLinearKernel()
      Constructor.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • k

      public double k(double dot)
      Description copied from interface: DotProductKernel
      Computes the dot product kernel function.
      Specified by:
      k in interface DotProductKernel
      Parameters:
      dot - the dot product.
      Returns:
      the kernel value.
    • kg

      public double[] kg(double dot)
      Description copied from interface: DotProductKernel
      Computes the dot product kernel function and its gradient over hyperparameters.
      Specified by:
      kg in interface DotProductKernel
      Parameters:
      dot - The dot product.
      Returns:
      the kernel value and gradient.
    • k

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

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

      public BinarySparseLinearKernel of(double[] params)
      Description copied from interface: MercerKernel
      Returns the same kind kernel with the new hyperparameters.
      Specified by:
      of in interface MercerKernel<int[]>
      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<int[]>
      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<int[]>
      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<int[]>
      Returns:
      the upper bound of hyperparameters.