Class SVMParameters<T extends Output<T>>

java.lang.Object
org.tribuo.common.libsvm.SVMParameters<T>
All Implemented Interfaces:
Serializable

public class SVMParameters<T extends Output<T>> extends Object implements Serializable
A container for SVM parameters and the kernel.
See Also:
  • Field Details

    • svmType

      protected final SVMType<T extends Output<T>> svmType
      The type of the SVM.
    • kernelType

      protected final KernelType kernelType
      The kernel.
    • parameters

      protected final libsvm.svm_parameter parameters
      The libSVM format parameters.
  • Constructor Details

    • SVMParameters

      public SVMParameters(SVMType<T> svmType, KernelType kernelType)
      Constructs the default SVMParameters using the specified SVMType and KernelType.
      Parameters:
      svmType - The SVM algorithm.
      kernelType - The kernel.
  • Method Details

    • getSvmType

      public SVMType<T> getSvmType()
      Gets the SVM type.
      Returns:
      The SVM type.
    • getKernelType

      public KernelType getKernelType()
      Gets the kernel type.
      Returns:
      The kernel type.
    • getParameters

      public libsvm.svm_parameter getParameters()
      Gets the underlying SVM parameter object.
      Returns:
      The SVM parameters.
    • toString

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

      public void setProbability()
      Makes the model that is built provide probability estimates.
    • setCost

      public void setCost(double c)
      Sets the cost for C_SVC.
      Parameters:
      c - The cost.
    • setNu

      public void setNu(double nu)
      Sets the value of nu for NU_SVM.
      Parameters:
      nu - The nu.
    • setCoeff

      public void setCoeff(double coeff)
      Sets the coefficient.
      Parameters:
      coeff - The coefficient.
    • setEpsilon

      public void setEpsilon(double epsilon)
      Sets the termination closeness.
      Parameters:
      epsilon - The termination criterion.
    • setDegree

      public void setDegree(int degree)
      Sets the degree of the polynomial kernel.
      Parameters:
      degree - The polynomial degree.
    • setGamma

      public void setGamma(double gamma)
      Sets gamma in the RBF kernel.
      Parameters:
      gamma - The gamma.
    • getGamma

      public double getGamma()
      Gets the gamma value.
      Returns:
      The gamma value.
    • setCacheSize

      public void setCacheSize(double cacheMB)
      Sets the cache size.
      Parameters:
      cacheMB - The cache size.
    • copyParameters

      public static libsvm.svm_parameter copyParameters(libsvm.svm_parameter input)
      Deep copy of the svm_parameters including the arrays.
      Parameters:
      input - The parameters to copy.
      Returns:
      A copy of the svm_parameters.
    • svmParamsToString

      public static String svmParamsToString(libsvm.svm_parameter param)
      A sensible toString for svm_parameter.
      Parameters:
      param - The parameters.
      Returns:
      A String describing the parameters.