Documentation of 'jsat.classifiers.linear.kernelized.CSKLR' Java class
CSKLR
jsat.classifiers.linear.kernelized

Class CSKLR

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


    public class CSKLR
    extends BaseUpdateableClassifier
    implements Parameterized
    An implementation of Conservative Stochastic Kernel Logistic Regression. This is an online algorithm that obtains sparse solutions by conservatively rejecting updates based on a binomial distribution of the error on each update.

    This algorithm works best on data sets with a very high number of samples where a high accuracy is obtainable using a kernel model. It is often the case that this model produces accurate results, but has a low confidence due to the conservative updating. This can be counteracted by having a very large number of features, but that often increases the size of the model.

    It is important to read the documentation and test some different values for the learning rate and gamma variables. They behave different compared to many algorithms.

    It is possible to obtain a more confident model and a slightly larger model by using several epochs. Instead of using this class, the batch version of this algorithm should be used instead.

    See paper:
    Zhang, L., Jin, R., Chen, C., Bu, J.,&He, X. (2012). Efficient Online Learning for Large-Scale Sparse Kernel Logistic Regression. Twenty-Sixth AAAI Conference on Artificial Intelligence (pp. 1219–1225). Retrieved from here
    See Also:
    Serialized Form
    • Constructor Detail

      • CSKLR

        public CSKLR(double eta,
                     KernelTrick k,
                     double R,
                     CSKLR.UpdateMode mode)
        Creates a new CSKLR object
        Parameters:
        eta - the learning rate to use
        k - the kernel trick to use
        R - the maximal norm of the surface
        mode - the mode to use
    • Method Detail

      • guessR

        public static Distribution guessR(DataSet d)
        Guesses the distribution to use for the R parameter
        Parameters:
        d - the dataset to get the guess for
        Returns:
        the guess for the R parameter
        See Also:
        setR(double)
      • setEta

        public void setEta(double eta)
        Sets the learning rate to use for the algorithm. Unlike many other stochastic algorithms, the learning rate for CSKLR should be large, often in the range of (0.5, 1) - and can even be larger than 1 at times. If the learning rate is too low, it may be difficult to get strong confidence results from the algorithm.
        Parameters:
        eta - the positive learning rate to use
      • getEta

        public double getEta()
        Returns the learning rate to use
        Returns:
        the learning rate to use
      • setR

        public void setR(double R)
        Sets the maximal margin norm value for the algorithm. When the norm is exceeded, the coefficients will be rescaled to fit in the norm. If the maximal norm is too small (less than 5), it may be difficult to get strong confidence results from the algorithm.
        A good range of values suggested by the original paper is 10x ∀ x ∈ {0, 1, 2, 3, 4, 5}
        Parameters:
        R -
      • getR

        public double getR()
        Returns the maximal norm of the algorithm
        Returns:
        the maximal norm of the algorithm
      • setMode

        public void setMode(CSKLR.UpdateMode mode)
        Sets what update mode should be used. The update mode controls the sparsity of the mode, and the behavior of setGamma(double)
        Parameters:
        mode - the update mode to use
      • getMode

        public CSKLR.UpdateMode getMode()
        Returns the update mode in use
        Returns:
        the update mode in use
      • setGamma

        public void setGamma(double gamma)
        Sets the gamma value to use. This value, depending on which CSKLR.UpdateMode is used, controls the sparsity of the model.
        Parameters:
        gamma - the gamma parameter, which is at least always positive
      • getGamma

        public double getGamma()
        Returns the gamma sparsity parameter value
        Returns:
        the gamma sparsity parameter value
      • setKernel

        public void setKernel(KernelTrick k)
        Set which kernel trick to use
        Parameters:
        k - the kernel to use
      • getKernel

        public KernelTrick getKernel()
        Returns the kernel trick in use
        Returns:
        the kernel trick in use
      • update

        public void update(DataPoint dataPoint,
                           int targetClass)
        Description copied from interface: UpdateableClassifier
        Updates the classifier by giving it a new data point to learn from.
        Specified by:
        update in interface UpdateableClassifier
        Parameters:
        dataPoint - the data point to learn
        targetClass - the target class of the 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.
      • 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.