Documentation of 'jsat.classifiers.linear.STGD' Java class
STGD
jsat.classifiers.linear

Class STGD

    • Constructor Detail

      • STGD

        public STGD(int K,
                    double learningRate,
                    double threshold,
                    double gravity)
        Creates a new STGD learner
        Parameters:
        K - the regularization frequency
        learningRate - the learning rate to use
        threshold - the regularization threshold
        gravity - the regularization parameter
    • Method Detail

      • setK

        public void setK(int K)
        Sets the frequency of applying the gravity parameter to the weight vector. This value must be positive, and the gravity will be applied every K updates. Increasing this value encourages greater sparsity.
        Parameters:
        K - the frequency to apply regularization in [1, Infinity )
      • getK

        public int getK()
        Returns the frequency of regularization application
        Returns:
        the frequency of regularization application
      • setLearningRate

        public void setLearningRate(double learningRate)
        Sets the learning rate to use
        Parameters:
        learningRate - the learning rate > 0.
      • getLearningRate

        public double getLearningRate()
        Returns the learning rate to use
        Returns:
        the learning rate to use
      • setThreshold

        public void setThreshold(double threshold)
        Sets the threshold for a coefficient value to avoid regularization. While a coefficient reaches this magnitude, regularization will not be applied.
        Parameters:
        threshold - the coefficient regularization threshold in ( 0, Infinity ]
      • getThreshold

        public double getThreshold()
        Returns the coefficient threshold parameter
        Returns:
        the coefficient threshold parameter
      • setGravity

        public void setGravity(double gravity)
        Sets the gravity regularization parameter that "weighs down" the coefficient values. Larger gravity values impose stronger regularization, and encourage greater sparsity.
        Parameters:
        gravity - the regularization parameter in ( 0, Infinity )
      • getGravity

        public double getGravity()
        Returns the regularization parameter
        Returns:
        the regularization parameter
      • getBias

        public double getBias()
        Description copied from interface: SingleWeightVectorModel
        Returns the bias term used for the model, or 0 of the model does not support or was not trained with a bias term.
        Specified by:
        getBias in interface SingleWeightVectorModel
        Returns:
        the bias term for the model
      • getRawWeight

        public Vec getRawWeight(int index)
        Description copied from interface: SimpleWeightVectorModel
        Returns the raw weight vector associated with the given class index. If the given class is an implicit zero vector, a ConstantVector object may be returned.
        Do not alter the returned weight vector, as it will change the model's values.

        If a regression problem, only index = 0 should be used
        Specified by:
        getRawWeight in interface SimpleWeightVectorModel
        Parameters:
        index - the class index to get the weight vector for
        Returns:
        the weight vector used for the specified class
      • getBias

        public double getBias(int index)
        Description copied from interface: SimpleWeightVectorModel
        Returns the bias term used with the weight vector for the given class index. If the model does not support or was not trained with bias weights, 0 will be returned.

        If a regression problem, only index = 0 should be used
        Specified by:
        getBias in interface SimpleWeightVectorModel
        Parameters:
        index - the class index to get the weight vector for
        Returns:
        the bias term for the specified class
      • numWeightsVecs

        public int numWeightsVecs()
        Description copied from interface: SimpleWeightVectorModel
        Returns the number of weight vectors that can be returned. For binary classification problems the value may be 1 if only a single weight vector's sign is used to determine the class. For multi-class problems, the weight vector count includes the implicit zero vector (if one is being used).
        Specified by:
        numWeightsVecs in interface SimpleWeightVectorModel
        Returns:
        the number of weight vectors for which SimpleWeightVectorModel.getRawWeight(int) can be called.
      • 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 y)
        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
        y - 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.
      • 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
      • 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

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.