Class SparseLinearSVM

All Implemented Interfaces:
Serializable, ToDoubleFunction<SparseArray>, ToIntFunction<SparseArray>, Classifier<SparseArray>

public class SparseLinearSVM extends AbstractClassifier<SparseArray>
Sparse linear support vector machines for classification.
See Also:
  • Constructor Details

    • SparseLinearSVM

      public SparseLinearSVM(int p, KernelMachine<SparseArray> svm)
      Constructor.
      Parameters:
      p - the dimension of input vector.
      svm - The kernel machine.
  • Method Details

    • weights

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

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

      public int predict(SparseArray x)
      Description copied from interface: Classifier
      Predicts the class label of an instance.
      Parameters:
      x - the instance to be classified.
      Returns:
      the predicted class label.
    • score

      public double score(SparseArray x)
      Description copied from interface: Classifier
      The raw prediction score.
      Parameters:
      x - the instance to be classified.
      Returns:
      the raw prediction score.