Class KernelMachine<T>

java.lang.Object
smile.base.svm.KernelMachine<T>
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
KernelMachine, SVM, SVM

public class KernelMachine<T> extends Object implements Serializable
Kernel machines. Kernel methods owe their name to the use of kernel functions, which enable them to operate in a high-dimensional, implicit feature space without ever computing the coordinates of the data in that space, but rather by simply computing the inner products between the images of all pairs of data in the feature space.

Kernel methods can be thought of as instance-based learners: rather than learning some fixed set of parameters corresponding to the features of their inputs, they instead store (a subset of) their training set (or a new representation) and learn for it a corresponding weight. Prediction for unlabeled inputs is treated by the application of a similarity function.

See Also:
  • Constructor Details

    • KernelMachine

      public KernelMachine(MercerKernel<T> kernel, T[] vectors, double[] weight)
      Constructor.
      Parameters:
      kernel - Kernel function.
      vectors - The instances in the kernel machine, e.g. support vectors.
      weight - The weights of instances.
    • KernelMachine

      public KernelMachine(MercerKernel<T> kernel, T[] vectors, double[] weight, double b)
      Constructor.
      Parameters:
      kernel - Kernel function.
      vectors - The instances in the kernel machine, e.g. support vectors.
      weight - The weights of instances.
      b - The intercept;
  • Method Details

    • kernel

      public MercerKernel<T> kernel()
      Returns the kernel function.
      Returns:
      the kernel function.
    • vectors

      public T[] vectors()
      Returns the support vectors of kernel machines.
      Returns:
      the support vectors of kernel machines.
    • weights

      public double[] weights()
      Returns the weights of instances.
      Returns:
      the weights of instances.
    • intercept

      public double intercept()
      Returns the intercept.
      Returns:
      the intercept.
    • score

      public double score(T x)
      Returns the decision function value.
      Parameters:
      x - an instance.
      Returns:
      the decision function value.
    • toString

      public String toString()
      Overrides:
      toString in class Object