Package org.tribuo.common.libsvm
Class SVMParameters<T extends Output<T>>
java.lang.Object
org.tribuo.common.libsvm.SVMParameters<T>
- All Implemented Interfaces:
Serializable
A container for SVM parameters and the kernel.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final KernelType
The kernel.protected final libsvm.svm_parameter
The libSVM format parameters.The type of the SVM. -
Constructor Summary
ConstructorDescriptionSVMParameters
(SVMType<T> svmType, KernelType kernelType) Constructs the default SVMParameters using the specified SVMType and KernelType. -
Method Summary
Modifier and TypeMethodDescriptionstatic libsvm.svm_parameter
copyParameters
(libsvm.svm_parameter input) Deep copy of the svm_parameters including the arrays.double
getGamma()
Gets the gamma value.Gets the kernel type.libsvm.svm_parameter
Gets the underlying SVM parameter object.Gets the SVM type.void
setCacheSize
(double cacheMB) Sets the cache size.void
setCoeff
(double coeff) Sets the coefficient.void
setCost
(double c) Sets the cost for C_SVC.void
setDegree
(int degree) Sets the degree of the polynomial kernel.void
setEpsilon
(double epsilon) Sets the termination closeness.void
setGamma
(double gamma) Sets gamma in the RBF kernel.void
setNu
(double nu) Sets the value of nu for NU_SVM.void
Makes the model that is built provide probability estimates.static String
svmParamsToString
(libsvm.svm_parameter param) A sensible toString for svm_parameter.toString()
-
Field Details
-
svmType
The type of the SVM. -
kernelType
The kernel. -
parameters
protected final libsvm.svm_parameter parametersThe libSVM format parameters.
-
-
Constructor Details
-
SVMParameters
Constructs the default SVMParameters using the specified SVMType and KernelType.- Parameters:
svmType
- The SVM algorithm.kernelType
- The kernel.
-
-
Method Details
-
getSvmType
Gets the SVM type.- Returns:
- The SVM type.
-
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
-
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
A sensible toString for svm_parameter.- Parameters:
param
- The parameters.- Returns:
- A String describing the parameters.
-