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

Class PlattSMO

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


    public class PlattSMO
    extends SupportVectorLearner
    implements BinaryScoreClassifier, WarmRegressor, Parameterized, WarmClassifier
    An implementation of SVMs using Platt's Sequential Minimum Optimization (SMO) for both Classification and Regression problems.

    This algorithm can be warm started for classification problems by any algorithm implementing the BinaryScoreClassifier interface. For regression any algorithm can be used as a warms start. For best results, warm starts should be from algorithms that will have a similar solution to PlattSMO.

    See:
    • Platt, J. C. (1998). Sequential Minimal Optimization: A Fast Algorithm for Training Support Vector Machines. Advances in kernel methods (pp. 185 – 208). Retrieved from here
    • Keerthi, S. S., Shevade, S. K., Bhattacharyya, C.,&Murthy, K. R. K. (2001). Improvements to Platt’s SMO Algorithm for SVM Classifier Design . Neural Computation, 13(3), 637–649. doi:10.1162/089976601300014493
    • Smola, A. J.,&Schölkopf, B. (2004). A tutorial on support vector regression. Statistics and Computing, 14(3), 199–222. doi:10.1023/B:STCO.0000035301.49549.88
    • Shevade, S. K., Keerthi, S. S., Bhattacharyya, C.,&Murthy, K. K. (1999) . Improvements to the SMO algorithm for SVM regression. Control D ivision, Dept. of Mechanical Engineering CD-99–16. Control Division, Dept. of Mechanical Engineering. doi:10.1109/72.870050
    • Shevade, S. K., Keerthi, S. S., Bhattacharyya, C.,&Murthy, K. K. (2000) . Improvements to the SMO algorithm for SVM regression. IEEE transactions on neural networks / a publication of the IEEE Neural Networks Council, 11(5), 1188–93. doi:10.1109/72.870050
    See Also:
    Serialized Form
    • Constructor Detail

      • PlattSMO

        public PlattSMO()
        Creates a new SVM object with a LinearKernel that uses no cache mode.
      • PlattSMO

        public PlattSMO(KernelTrick kf)
        Creates a new SVM object that uses no cache mode.
        Parameters:
        kf - the kernel trick to use
    • Method Detail

      • 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,
                          Classifier warmSolution,
                          boolean parallel)
        Description copied from interface: WarmClassifier
        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 WarmClassifier
        Parameters:
        dataSet - the data set to train on
        warmSolution - the solution to use to warm start this model
        parallel - true if the training should be done using multiple-cores, false for single threaded.
      • 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.
      • train

        public void train(ClassificationDataSet dataSet,
                          Classifier warmSolution)
        Description copied from interface: WarmClassifier
        Trains the classifier and constructs a model for classification using the given data set.
        Specified by:
        train in interface WarmClassifier
        Parameters:
        dataSet - the data set to train on
        warmSolution - the solution to use to warm start this model
      • train

        public void train(ClassificationDataSet dataSet)
        Description copied from interface: Classifier
        Trains the classifier and constructs a model for classification using the given data set.
        Specified by:
        train in interface Classifier
        Parameters:
        dataSet - the data set to train on
      • 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
        Specified by:
        supportsWeightedData in interface Regressor
        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
      • setMaxIterations

        public void setMaxIterations(int maxIterations)
        Sets the maximum number of iterations to perform of the training loop. This is important for cases with a C value that is to large for a non linear problem, which can result in SVM failing to converge.
        Parameters:
        maxIterations - the maximum number of main iteration loops
      • getMaxIterations

        public int getMaxIterations()
        Returns the maximum number of iterations
        Returns:
        the maximum number of iterations
      • setModificationOne

        public void setModificationOne(boolean modificationOne)
        Sets where or not modification one or two should be used when training. Modification two is more aggressive, but often results in less kernel evaluations.
        Parameters:
        modificationOne - true to us modificaiotn one, false to use modification two.
      • isModificationOne

        public boolean isModificationOne()
        Returns true if modification one is in use
        Returns:
        true if modification one is in use
      • 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
      • setEpsilon

        public void setEpsilon(double epsilon)
        Sets the epsilon for the epsilon insensitive loss when performing regression. This variable has no impact during classification problems. For regression problems, any predicated value that is within the epsilon of the target will be treated as "correct". Increasing epsilon usually decreases the number of support vectors, but may reduce the accuracy of the model
        Parameters:
        epsilon - the positive value for the acceptable error when doing regression
      • getEpsilon

        public double getEpsilon()
        Returns the epsilon insensitive loss value
        Returns:
        the epsilon insensitive loss value
      • train

        public void train(RegressionDataSet dataSet,
                          Regressor warmSolution,
                          boolean parallel)
        Description copied from interface: WarmRegressor
        Trains the regressor and constructs a model for regression 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 WarmRegressor
        Parameters:
        dataSet - the data set to train on
        warmSolution - the solution to use to warm start this model
        parallel - true if the training should be done using multiple-cores, false for single threaded.
      • train

        public void train(RegressionDataSet dataSet,
                          Regressor warmSolution)
        Description copied from interface: WarmRegressor
        Trains the regressor and constructs a model for regression using the given data set.
        Specified by:
        train in interface WarmRegressor
        Parameters:
        dataSet - the data set to train on
        warmSolution - the solution to use to warm start this model
      • warmFromSameDataOnly

        public boolean warmFromSameDataOnly()
        Description copied from interface: WarmRegressor
        Some models can only be warm started from a solution trained on the exact same data set as the model it is warm starting from. If this is the case true will be returned. The behavior for training on a different data set when this is defined is undefined. It may cause an error, or it may cause the algorithm to take longer or reach a worse solution.
        When true, it is important that the data set be unaltered - this includes mutating the values stored or re-arranging the data points within the data set.
        Specified by:
        warmFromSameDataOnly in interface WarmClassifier
        Specified by:
        warmFromSameDataOnly in interface WarmRegressor
        Returns:
        true if the algorithm can only be warm started from the model trained on the exact same data set.
      • guessC

        public static Distribution guessC(DataSet d)
        Guess the distribution to use for the regularization term C in a SVM.
        Parameters:
        d - the data set to get the guess for
        Returns:
        the guess for the C parameter in the SVM

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.