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

Class SPA

    • Constructor Detail

      • SPA

        public SPA()
        Creates a new Passive Aggressive learner that does 10 epochs and uses PA2.
      • SPA

        public SPA(int epochs,
                   PassiveAggressive.Mode mode)
        Creates a new Passive Aggressive learner
        Parameters:
        epochs - the number of training epochs to use during batch training
        mode - which version of the update to perform
    • Method Detail

      • setUseBias

        public void setUseBias(boolean useBias)
        Sets whether or not the implementation will use an implicit bias term appended to the inputs or not.
        Parameters:
        useBias - true to add an implicit bias term, false to use the data as given
      • isUseBias

        public boolean isUseBias()
        Returns true if an implicit bias term will be added, false otherwise
        Returns:
        true if an implicit bias term will be added, false otherwise
      • setC

        public void setC(double C)
        Set the aggressiveness parameter. Increasing the value of this parameter increases the aggressiveness of the algorithm. It must be a positive value. This parameter essentially performs a type of regularization on the updates
        An infinitely large value is equivalent to being completely aggressive, and is performed when the mode is set to PassiveAggressive.Mode.PA.
        Parameters:
        C - the positive aggressiveness parameter
      • getC

        public double getC()
        Returns the aggressiveness parameter
        Returns:
        the aggressiveness parameter
      • setMode

        public void setMode(PassiveAggressive.Mode mode)
        Sets which version of the PA update is used.
        Parameters:
        mode - which PA update style to perform
      • getMode

        public PassiveAggressive.Mode getMode()
        Returns which version of the PA update is used
        Returns:
        which PA update style is used
      • 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
      • 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
      • guessC

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

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.