Documentation of 'jsat.classifiers.svm.DCSVM' Java class
DCSVM
jsat.classifiers.svm

Class DCSVM

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


    public class DCSVM
    extends SupportVectorLearner
    implements Classifier, Parameterized, BinaryScoreClassifier
    This is an implementation of the Divide-and-Conquer Support Vector Machine (DC-SVM). It uses a a combination of clustering and warm-starting to train faster, as well as an early stopping strategy to provide a fast approximate SVM solution. The final accuracy should often be at or near that of a normal SVM, while being faster to train.

    The current implementation is based on SVMnoBias, meaning this code does not have a bias term and it only works with normalized kernels. Any non-normalized kernel will be normalized automatically. This is not a problem for the common RBF kernel.

    See:
    • Hsieh, C.-J., Si, S., & Dhillon, I. S. (2014). A Divide-and-Conquer Solver for Kernel Support Vector Machines. In Proceedings of the 31st International Conference on Machine Learning. Beijing, China.
    See Also:
    Serialized Form
    • Constructor Detail

      • DCSVM

        public DCSVM(KernelTrick k)
        Creates a new DC-SVM for the given kernel
        Parameters:
        k - the kernel to use
      • DCSVM

        public DCSVM()
        Creates a new DC-SVM for the RBF kernel
      • DCSVM

        public DCSVM(DCSVM toCopy)
        Copy Constructor
        Parameters:
        toCopy - object to copy
    • Method Detail

      • setStartLevel

        public void setStartLevel(int l_max)
        The DC-SVM algorithm works by creating a hierarchy of levels, and iteratively refining the solution from one level to the next. Level 0 corresponds to the exact SVM solution, and higher levels are courser approximations. This method controls which level the training starts at.
        Parameters:
        l_max - which level to start the training at.
      • getStartLevel

        public int getStartLevel()
        Returns:
        which level to start the training at.
      • setEndLevel

        public void setEndLevel(int l_early)
        The DC-SVM algorithm works by creating a hierarchy of levels, and iteratively refining the solution from one level to the next. Level 0 corresponds to the exact SVM solution, and higher levels are courser approximations. This method controls which level the training stops at, with 0 being the latest it can stop. The default stopping level is 3.
        Parameters:
        l_early - which level to stop the training at, and use for classification.
      • getEndLevel

        public int getEndLevel()
        Returns:
        which level to stop the training at, and use for classification.
      • setClusterSampleSize

        public void setClusterSampleSize(int m)
        At each level of the DC-SVM training, a clustering algorithm is used to divide the dataset into sub-groups for independent training. Increasing the number of points used for clustering improves model accuracy, but also increases training time. The default value is 2000. This value may need to be increased if using a higher staring level.
        Parameters:
        m - the number of data points to sample for each cluster size
      • getClusterSampleSize

        public int getClusterSampleSize()
      • 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.
      • getScore

        public double getScore(DataPoint dp)
        Description copied from interface: BinaryScoreClassifier
        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.
        Specified by:
        getScore in interface BinaryScoreClassifier
        Parameters:
        dp - the data point to predict the class label of
        Returns:
        the score for the given data point
      • 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.
      • 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
      • 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

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.