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

Class ALMA2

    • Constructor Summary

      Constructors 
      Constructor and Description
      ALMA2()
      Creates a new ALMA learner using an alpha of 0.8
      ALMA2(double alpha)
      Creates a new ALMA learner using the given alpha
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      CategoricalResults classify(DataPoint data)
      Performs classification on the given data point.
      ALMA2 clone() 
      double getAlpha()
      Returns the approximation coefficient used
      double getB()
      Returns the B value of the ALMA algorithm
      double getBias()
      Returns the bias term used for the model, or 0 of the model does not support or was not trained with a bias term.
      double getBias(int index)
      Returns the bias term used with the weight vector for the given class index.
      double getC() 
      Vec getRawWeight()
      Returns the only weight vector used for the model
      Vec getRawWeight(int index)
      Returns the raw weight vector associated with the given class index.
      double getScore(DataPoint dp)
      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.
      Vec getWeightVec()
      Returns the weight vector used to compute results via a dot product.
      boolean isUseBias()
      Returns whether or not an implicit bias term is in use
      int numWeightsVecs()
      Returns the number of weight vectors that can be returned.
      void setAlpha(double alpha)
      Alpha controls the approximation of the large margin formed by ALMA, with larger values causing more updates.
      void setB(double B)
      Sets the B variable of the ALMA algorithm, this is set automatically by setAlpha(double).
      void setC(double C)
      Sets the C value of the ALMA algorithm.
      void setUp(CategoricalData[] categoricalAttributes, int numericAttributes, CategoricalData predicting)
      Prepares the classifier to begin learning from its UpdateableClassifier.update(jsat.classifiers.DataPoint, int) method.
      void setUseBias(boolean useBias)
      Sets whether or not an implicit bias term will be added to the data set
      boolean supportsWeightedData()
      Indicates whether the model knows how to train using weighted data points.
      void update(DataPoint dataPoint, int targetClass)
      Updates the classifier by giving it a new data point to learn from.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ALMA2

        public ALMA2()
        Creates a new ALMA learner using an alpha of 0.8
      • ALMA2

        public ALMA2(double alpha)
        Creates a new ALMA learner using the given alpha
        Parameters:
        alpha - the alpha value to use
        See Also:
        setAlpha(double)
    • Method Detail

      • getWeightVec

        public Vec getWeightVec()
        Returns the weight vector used to compute results via a dot product.
        Do not modify this value, or you will alter the results returned.
        Returns:
        the learned weight vector for prediction
      • setAlpha

        public void setAlpha(double alpha)
        Alpha controls the approximation of the large margin formed by ALMA, with larger values causing more updates. A value of 1.0 will update only on mistakes, while smaller values update if the error was not far enough away from the margin.

        NOTE: Whenever alpha is set, the value of B will also be set to an appropriate value. This is not the only possible value that will lead to convergence, and can be set manually after alpha is set to another value.
        Parameters:
        alpha - the approximation scale in (0.0, 1.0]
      • getAlpha

        public double getAlpha()
        Returns the approximation coefficient used
        Returns:
        the approximation coefficient used
      • setB

        public void setB(double B)
        Sets the B variable of the ALMA algorithm, this is set automatically by setAlpha(double).
        Parameters:
        B - the value for B
      • getB

        public double getB()
        Returns the B value of the ALMA algorithm
        Returns:
        the B value of the ALMA algorithm
      • setC

        public void setC(double C)
        Sets the C value of the ALMA algorithm. The default value is the one suggested in the paper.
        Parameters:
        C - the C value of ALMA
      • getC

        public double getC()
      • setUseBias

        public void setUseBias(boolean useBias)
        Sets whether or not an implicit bias term will be added to the data set
        Parameters:
        useBias - true to add an implicit bias term
      • isUseBias

        public boolean isUseBias()
        Returns whether or not an implicit bias term is in use
        Returns:
        true if a bias term is 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.
      • 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
      • 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
      • 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.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.