Documentation of 'jsat.classifiers.OneVSAll' Java class
OneVSAll
jsat.classifiers

Class OneVSAll

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Classifier, Parameterized


    public class OneVSAll
    extends java.lang.Object
    implements Classifier, Parameterized
    This classifier turns any classifier, specifically binary classifiers, into multi-class classifiers. For a problem with k target classes, OneVsALl will create k different classifiers. Each one is a reducing of one class against all other classes. Then all k classifiers's results are summed to produce a final classifier

    If the base learner is an instance of BinaryScoreClassifier, then the winning class label will be the associated classifier that produced the highest score.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      OneVSAll(Classifier baseClassifier)
      Creates a new One VS All classifier.
      OneVSAll(Classifier baseClassifier, boolean concurrentTraining)
      Creates a new One VS All classifier.
    • Constructor Detail

      • OneVSAll

        public OneVSAll(Classifier baseClassifier,
                        boolean concurrentTraining)
        Creates a new One VS All classifier.
        Parameters:
        baseClassifier - the base classifier to replicate
        concurrentTraining - controls whether or not classifiers are trained simultaneously or using sequentially using their Classifier#train(jsat.classifiers.ClassificationDataSet, java.util.concurrent.ExecutorService) method.
        See Also:
        setConcurrentTraining(boolean)
    • Method Detail

      • setConcurrentTraining

        public void setConcurrentTraining(boolean concurrentTraining)
        Controls what method of parallel training to use when #train(jsat.classifiers.ClassificationDataSet, java.util.concurrent.ExecutorService) is called. If set to true, each of the k classifiers will be trained in parallel, using their serial algorithms. If set to false, the k classifiers will be trained sequentially, calling the Classifier#train(jsat.classifiers.ClassificationDataSet, java.util.concurrent.ExecutorService) for each classifier.

        This should be set to true for classifiers that do not support parallel training.
        Setting this to true also uses k times the memory, since each classifier is being created and trained at the same time.
        Parameters:
        concurrentTraining - whether or not to train the classifiers in parallel
      • classify

        public CategoricalResults classify(DataPoint data)
        Description copied from interface: Classifier
        Performs classification on the given data point.
        Specified by:
        classify in interface Classifier
        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: Classifier
        Trains 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:
        train in interface Classifier
        Parameters:
        dataSet - the data set to train on
        parallel - true if multiple threads should be used to train the model. false if it should be done in a single threaded manner.
      • clone

        public OneVSAll clone()
        Specified by:
        clone in interface Classifier
        Overrides:
        clone in class java.lang.Object
      • supportsWeightedData

        public boolean supportsWeightedData()
        Description copied from interface: Classifier
        Indicates 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:
        supportsWeightedData in interface Classifier
        Returns:
        true if the model supports weighted data, false otherwise

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.