Documentation of 'jsat.classifiers.CategoricalResults' Java class
CategoricalResults
jsat.classifiers

Class CategoricalResults

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


    public class CategoricalResults
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable
    This class represents the probabilities for each possible result classification.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      CategoricalResults(double[] probabilities)
      Creates a new Categorical Result using the given array.
      CategoricalResults(int numCategories)
      Create a new Categorical Results, values will default to all zero.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      CategoricalResults clone()
      Creates a deep clone of this
      void divideConst(double c)
      Divides all the probabilities by a constant value in order to scale them
      double getProb(int cat)
      Returns the stored probability for the given category
      Vec getVecView() 
      void incProb(int cat, double prob)
      Increments the stored probability that a sample belongs to a given category
      int mostLikely()
      Returns the category that is the most likely according to the current probability values
      void normalize()
      Adjusts the probabilities by dividing each value by the total sum, so that all values are in the range [0, 1]
      void setProb(int cat, double prob)
      Sets the probability that a sample belongs to a given category.
      int size()
      Returns the number of classes that are in the result.
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

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

      • CategoricalResults

        public CategoricalResults(int numCategories)
        Create a new Categorical Results, values will default to all zero.
        Parameters:
        numCategories - the number of options to support.
      • CategoricalResults

        public CategoricalResults(double[] probabilities)
        Creates a new Categorical Result using the given array. It will use only a reference to the given array, and will assume the values are already normalized and sum to one.
        Parameters:
        probabilities - the array of probabilities for each outcome
    • Method Detail

      • size

        public int size()
        Returns the number of classes that are in the result.
        Returns:
        the class count
      • setProb

        public void setProb(int cat,
                            double prob)
        Sets the probability that a sample belongs to a given category.
        Parameters:
        cat - the category
        prob - the value to set, may be greater then one.
        Throws:
        java.lang.IndexOutOfBoundsException - if a non existent category is specified
        java.lang.ArithmeticException - if the value set is negative or not a number
      • incProb

        public void incProb(int cat,
                            double prob)
        Increments the stored probability that a sample belongs to a given category
        Parameters:
        cat - the category
        prob - the value to increment by, may be greater then one.
        Throws:
        java.lang.IndexOutOfBoundsException - if a non existent category is specified
        java.lang.ArithmeticException - if the value set is negative or not a number
      • mostLikely

        public int mostLikely()
        Returns the category that is the most likely according to the current probability values
        Returns:
        the the most likely category
      • divideConst

        public void divideConst(double c)
        Divides all the probabilities by a constant value in order to scale them
        Parameters:
        c - the constant to divide all probabilities by
      • normalize

        public void normalize()
        Adjusts the probabilities by dividing each value by the total sum, so that all values are in the range [0, 1]
      • getVecView

        public Vec getVecView()
      • getProb

        public double getProb(int cat)
        Returns the stored probability for the given category
        Parameters:
        cat - the category
        Returns:
        the associated probability
      • clone

        public CategoricalResults clone()
        Creates a deep clone of this
        Overrides:
        clone in class java.lang.Object
        Returns:
        a deep clone
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.