jsat.classifiers
Class OneVSOne
- java.lang.Object
-
- jsat.classifiers.OneVSOne
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier, Parameterized
- Direct Known Subclasses:
- DDAG
public class OneVSOne extends java.lang.Object implements Classifier, Parameterized
A One VS One classifier extends binary decision classifiers into multi-class decision classifiers. This is done by creating a binary-classification problem for every possible pair of classes, and then classifying by taking the result of all possible combinations and choosing the class that got the most results. This allows for a soft decision result, however, it often proves to be a meaningless soft boundary.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description OneVSOne(Classifier baseClassifier)Creates a new One-vs-One classifierOneVSOne(Classifier baseClassifier, boolean concurrentTrain)Creates a new One-vs-One classifier
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description CategoricalResultsclassify(DataPoint data)Performs classification on the given data point.OneVSOneclone()booleanisConcurrentTraining()voidsetConcurrentTraining(boolean concurrentTrain)Controls whether or not training of the several classifiers occurs concurrently or sequentually.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 java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.classifiers.Classifier
train
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
-
-
-
Constructor Detail
-
OneVSOne
public OneVSOne(Classifier baseClassifier)
Creates a new One-vs-One classifier- Parameters:
baseClassifier- the binary classifier to extend
-
OneVSOne
public OneVSOne(Classifier baseClassifier, boolean concurrentTrain)
Creates a new One-vs-One classifier- Parameters:
baseClassifier- the binary classifier to extendconcurrentTrain- true to have training of individual classifiers occur in parallel, false to have them use their native parallel training method.
-
-
Method Detail
-
setConcurrentTraining
public void setConcurrentTraining(boolean concurrentTrain)
Controls whether or not training of the several classifiers occurs concurrently or sequentually.- Parameters:
concurrentTrain- true to have training of individual classifiers occur in parallel, false to have them use their native parallel training method.
-
isConcurrentTraining
public boolean isConcurrentTraining()
- Returns:
- true if training of individual classifiers occur in parallel, false they use their native parallel training method.
-
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
-
clone
public OneVSOne clone()
- Specified by:
clonein interfaceClassifier- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG