jsat.classifiers.svm
Class SVMnoBias
- java.lang.Object
-
- jsat.classifiers.svm.SupportVectorLearner
-
- jsat.classifiers.svm.SVMnoBias
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, BinaryScoreClassifier, Classifier
public class SVMnoBias extends SupportVectorLearner implements BinaryScoreClassifier
This class implements a version of the Support Vector Machine without a bias term. In addition, the current implementation requires that the Kernel Trick used be anormalizedkernel. If the given kernel is not normalized, this class will automatically wrap it to become normalized.
Because there is no bias term, this class should never be used with the Linear kernel. But for the more common RBF kernel the lack of bias term should have minimal impact on accuracy.
See: Steinwart, I., Hush, D., & Scovel, C. (2011). Training SVMs Without Offset. The Journal of Machine Learning Research, 12, 141–202.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jsat.classifiers.svm.SupportVectorLearner
SupportVectorLearner.CacheMode
-
-
Constructor Summary
Constructors Constructor and Description SVMnoBias(KernelTrick kf)Creates a new SVM object that uses no cache mode.SVMnoBias(SVMnoBias toCopy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description CategoricalResultsclassify(DataPoint data)Performs classification on the given data point.SVMnoBiasclone()doublegetC()Returns the soft margin complexity parameter of the SVMdoublegetScore(DataPoint dp)Returns the numeric score for predicting a class of a given data point, where the sign of the value indicates which class the data point is predicted to belong to.doublegetTolerance()Returns the solution tolerancevoidsetC(double C)Sets the complexity parameter of SVM.voidsetKernel(KernelTrick kernel)Sets the kernel trick to usevoidsetTolerance(double tolerance)Sets the tolerance for the solution.booleansupportsWeightedData()Indicates whether the model knows how to train using weighted data points.voidtrain(ClassificationDataSet dataSet, boolean parallel)Trains the classifier and constructs a model for classification using the given data set.-
Methods inherited from class jsat.classifiers.svm.SupportVectorLearner
getCacheMode, getCacheValue, getKernel, setCacheMode, setCacheSize, setCacheValue
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.classifiers.Classifier
train
-
-
-
-
Constructor Detail
-
SVMnoBias
public SVMnoBias(KernelTrick kf)
Creates a new SVM object that uses no cache mode.- Parameters:
kf- the kernel trick to use
-
SVMnoBias
public SVMnoBias(SVMnoBias toCopy)
-
-
Method Detail
-
setKernel
public void setKernel(KernelTrick kernel)
Description copied from class:SupportVectorLearnerSets the kernel trick to use- Overrides:
setKernelin classSupportVectorLearner- Parameters:
kernel- the kernel trick to use
-
getScore
public double getScore(DataPoint dp)
Description copied from interface:BinaryScoreClassifierReturns the numeric score for predicting a class of a given data point, where the sign of the value indicates which class the data point is predicted to belong to.- Specified by:
getScorein interfaceBinaryScoreClassifier- Parameters:
dp- the data point to predict the class label of- Returns:
- the score for the given data point
-
clone
public SVMnoBias clone()
- Specified by:
clonein interfaceBinaryScoreClassifier- Specified by:
clonein interfaceClassifier- Overrides:
clonein classjava.lang.Object
-
classify
public CategoricalResults classify(DataPoint data)
Description copied from interface:ClassifierPerforms classification on the given data point.- Specified by:
classifyin interfaceClassifier- Parameters:
data- the data point to classify- Returns:
- the results of the classification.
-
train
public void train(ClassificationDataSet dataSet, boolean parallel)
Description copied from interface:ClassifierTrains the classifier and constructs a model for classification using the given data set. If the training method knows how, it will used the threadPool to conduct training in parallel. This method will block until the training has completed.- Specified by:
trainin interfaceClassifier- Parameters:
dataSet- the data set to train onparallel-trueif multiple threads should be used to train the model.falseif it should be done in a single threaded manner.
-
supportsWeightedData
public boolean supportsWeightedData()
Description copied from interface:ClassifierIndicates whether the model knows how to train using weighted data points. If it does, the model will train assuming the weights. The values returned by this method may change depending on the parameters set for the model.- Specified by:
supportsWeightedDatain interfaceClassifier- Returns:
- true if the model supports weighted data, false otherwise
-
setC
public void setC(double C)
Sets the complexity parameter of SVM. The larger the C value the harder the margin SVM will attempt to find. Lower values of C allow for more misclassification errors.- Parameters:
C- the soft margin parameter
-
getC
public double getC()
Returns the soft margin complexity parameter of the SVM- Returns:
- the complexity parameter of the SVM
-
setTolerance
public void setTolerance(double tolerance)
Sets the tolerance for the solution. Higher values converge to worse solutions, but do so faster- Parameters:
tolerance- the tolerance for the solution
-
getTolerance
public double getTolerance()
Returns the solution tolerance- Returns:
- the solution tolerance
-
-
DataMelt 3.0 © DataMelt by jWork.ORG