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

Class KernelSGD

    • Constructor Detail

      • KernelSGD

        public KernelSGD()
        Creates a new Kernel SGD object for classification with the RBF kernel
      • KernelSGD

        public KernelSGD(LossFunc loss,
                         KernelTrick kernel,
                         double lambda,
                         KernelPoint.BudgetStrategy budgetStrategy,
                         int budgetSize)
        Creates a new Kernel SGD object
        Parameters:
        loss - the loss function to use
        kernel - the kernel trick to use
        lambda - the regularization penalty
        budgetStrategy - the budget maintenance strategy to use
        budgetSize - the maximum support vector budget
      • KernelSGD

        public KernelSGD(LossFunc loss,
                         KernelTrick kernel,
                         double lambda,
                         KernelPoint.BudgetStrategy budgetStrategy,
                         int budgetSize,
                         double eta,
                         double errorTolerance)
        Creates a new Kernel SGD object
        Parameters:
        loss - the loss function to use
        kernel - the kernel trick to use
        lambda - the regularization penalty
        eta - the initial learning rate
        budgetStrategy - the budget maintenance strategy to use
        errorTolerance - the error tolerance used in certain budget maintenance steps
        budgetSize - the maximum support vector budget
      • KernelSGD

        public KernelSGD(KernelSGD toCopy)
        Copy constructor
        Parameters:
        toCopy - the object to copy
    • Method Detail

      • setEpochs

        public void setEpochs(int epochs)
        Sets the number of iterations of the training set done during batch training
        Parameters:
        epochs - the number of iterations in batch training
      • getEpochs

        public int getEpochs()
        Returns the number of epochs to use
        Returns:
        the number of epochs to use
      • setLoss

        public void setLoss(LossFunc loss)
        Sets the loss function to use. The loss function controls whether or not classification or regression is supported.
        Parameters:
        loss -
      • getLoss

        public LossFunc getLoss()
        Returns the loss function in use
        Returns:
        the loss function in use
      • setLambda

        public void setLambda(double lambda)
        Sets the L2 regularization parameter used during learning.
        Parameters:
        lambda - the positive regularization parameter
      • getLambda

        public double getLambda()
        Returns the L2 regularization parameter
        Returns:
        the L2 regularization parameter
      • setErrorTolerance

        public void setErrorTolerance(double errorTolerance)
        Sets the error tolerance used for certain budget strategies
        Parameters:
        errorTolerance - the error tolerance in [0, 1]
      • getErrorTolerance

        public double getErrorTolerance()
        Returns the error tolerance that would be used
        Returns:
        the error tolerance that would be used
      • setBudgetSize

        public void setBudgetSize(int budgetSize)
        Sets the maximum budget size, or number of support vectors, to allow during training. Increasing the budget size will increase the accuracy of the model, but will also increase the computational cost
        Parameters:
        budgetSize - the maximum allowed number of support vectors
      • getBudgetSize

        public int getBudgetSize()
        Returns the budget size, or maximum number of allowed support vectors.
        Returns:
        the maximum number of allowed support vectors
      • setBudgetStrategy

        public void setBudgetStrategy(KernelPoint.BudgetStrategy budgetStrategy)
        Sets the budget maintenance strategy.
        Parameters:
        budgetStrategy - the method to meet budget size requirements
      • getBudgetStrategy

        public KernelPoint.BudgetStrategy getBudgetStrategy()
        Returns the method of budget maintenance
        Returns:
        the method of budget maintenance
      • setEta

        public void setEta(double eta)
        Sets the base learning rate to start from. Because of the decay rate in use a good value for η is 1.0.
        Parameters:
        eta - the starting learning rate to use
      • getEta

        public double getEta()
        Returns the base learning rate
        Returns:
        the base learning rate
      • setKernel

        public void setKernel(KernelTrick kernel)
        Sets the kernel to use
        Parameters:
        kernel - the kernel to use
      • getKernel

        public KernelTrick getKernel()
        Returns the kernel in use
        Returns:
        the kernel 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
      • update

        public void update(DataPoint dataPoint,
                           double targetValue)
        Description copied from interface: UpdateableRegressor
        Updates the classifier by giving it a new data point to learn from.
        Specified by:
        update in interface UpdateableRegressor
        Parameters:
        dataPoint - the data point to learn
        targetValue - the target value 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.
      • 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)
        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
      • guessLambda

        public static Distribution guessLambda(DataSet d)
        Guess the distribution to use for the regularization term λ .
        Parameters:
        d - the data set to get the guess for
        Returns:
        the guess for the λ parameter

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.