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

Class LSSVM

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


    public class LSSVM
    extends SupportVectorLearner
    implements BinaryScoreClassifier, Regressor, Parameterized, WarmRegressor, WarmClassifier
    The Least Squares Support Vector Machine (LS-SVM) is an alternative to the standard SVM classifier for regression and binary classification problems. It can be faster to train, but is usually significantly slower to perform predictions with. This is because the LS-SVM solution is dense, so all training points become support vectors.

    The LS-SVM algorithm may be warm started only from another LS-SVM object trained on the same data set.

    NOTE: A SMO implementation similar to PlattSMO is used. This is done because is can easily operate without explicitly forming the whole kernel matrix. However it is recommended to use the LS-SVM when the problem size is small enough such that SupportVectorLearner.CacheMode.FULL can be used.

    If N is the number of data points:
    • Training complexity is roughly O(n^3), but can be lower for small C
    • Prediction complexity is O(n)
    • This implementation is multi-threaded, but scales best when there are several thousand data points per core. For smaller problems, especially when full cache mode can be used, there may be negative speedups when using the parallel training methods

    See:
    • Suykens, J.,&Vandewalle, J. (1999). Least Squares Support Vector Machine Classifiers. Neural processing letters, 9(3), 293–298. doi:10.1023/A:1018628609742
    • Keerthi, S. S.,&Shevade, S. K. (2003). SMO algorithm for Least Squares SVM. In Proceedings of the International Joint Conference on Neural Networks (Vol. 3, pp. 2088–2093). IEEE. doi:10.1109/IJCNN.2003.1223730
    See Also:
    Serialized Form
    • Constructor Detail

      • LSSVM

        public LSSVM()
        Creates a new LS-SVM learner that uses a linear model and does not use a cache
      • LSSVM

        public LSSVM(KernelTrick kernel)
        Creates a new LS-SVM learner that does not use a cache
        Parameters:
        kernel - the kernel method to use
      • LSSVM

        public LSSVM(KernelTrick kernel,
                     SupportVectorLearner.CacheMode cacheMode)
        Creates a new LS-SVM learner
        Parameters:
        kernel - the kernel method to use
        cacheMode - the caching scheme to use for kernel evaluations
      • LSSVM

        public LSSVM(LSSVM toCopy)
        Creates a deep copy of another LS-SVM
        Parameters:
        toCopy - the object to copy
    • Method Detail

      • setC

        public void setC(double C)
        Sets the regularization constant when training. Lower values correspond to higher amounts of regularization.
        Parameters:
        C - the positive regularization parameter
      • getC

        public double getC()
        Returns the regularization parameter value used
        Returns:
        the regularization parameter value
      • 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.
      • 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
      • 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.
      • 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
      • 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,
                          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
      • 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
      • guessC

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

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.