Class LinearKernelMachine

java.lang.Object
smile.base.svm.LinearKernelMachine
All Implemented Interfaces:
Serializable

public class LinearKernelMachine extends Object implements Serializable
Linear kernel machine.
See Also:
  • Constructor Details

    • LinearKernelMachine

      public LinearKernelMachine(double[] w, double b)
      Constructor.
      Parameters:
      w - the weight vector.
      b - the intercept.
  • Method Details

    • of

      public static LinearKernelMachine of(KernelMachine<double[]> kernelMachine)
      Creates a linear kernel machine.
      Parameters:
      kernelMachine - a generic kernel machine.
      Returns:
      a linear kernel machine
    • binary

      public static LinearKernelMachine binary(int p, KernelMachine<int[]> kernelMachine)
      Creates a linear kernel machine.
      Parameters:
      p - the dimension of input vector.
      kernelMachine - a generic kernel machine.
      Returns:
      a linear kernel machine
    • sparse

      public static LinearKernelMachine sparse(int p, KernelMachine<SparseArray> kernelMachine)
      Creates a linear kernel machine.
      Parameters:
      p - the dimension of input vector.
      kernelMachine - a generic kernel machine.
      Returns:
      a linear kernel machine
    • f

      public double f(double[] x)
      Returns the value of decision function.
      Parameters:
      x - the instance.
      Returns:
      the score.
    • f

      public double f(int[] x)
      Returns the value of decision function.
      Parameters:
      x - the binary sparse instance.
      Returns:
      the score.
    • f

      public double f(SparseArray x)
      Returns the value of decision function.
      Parameters:
      x - the sparse instance.
      Returns:
      the score.