Class LogProbability<T>

  • Type Parameters:
    T - the label (category) class

    public class LogProbability<T>
    extends Probability<T>
    Class implementing the probability for a label.
    • Constructor Summary

      Constructors 
      Constructor Description
      LogProbability​(T label)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addIn​(double probability)
      Compounds the existing probability mass on the label with the new probability passed in to the method.
      Double get()
      Returns the probability associated with a label
      T getLabel()
      Returns the probabilities associated with all labels
      Double getLog()
      Returns the log probability associated with a label
      boolean isLarger​(Probability probability)
      Checks if a probability is greater than the old one.
      void set​(double probability)
      Assigns a probability to a label, discarding any previously assigned probability.
      void set​(Probability probability)
      Assigns a probability to a label, discarding any previously assigned probability.
      void setIfLarger​(double probability)
      Assigns a probability to a label, discarding any previously assigned probability, if the new probability is greater than the old one.
      void setIfLarger​(Probability probability)
      Assigns a probability to a label, discarding any previously assigned probability, if the new probability is greater than the old one.
      void setLog​(double probability)
      Assigns a log probability to a label, discarding any previously assigned probability.
      String toString()  
    • Constructor Detail

      • LogProbability

        public LogProbability​(T label)
    • Method Detail

      • set

        public void set​(double probability)
        Assigns a probability to a label, discarding any previously assigned probability.
        Overrides:
        set in class Probability<T>
        Parameters:
        probability - the probability to assign
      • set

        public void set​(Probability probability)
        Assigns a probability to a label, discarding any previously assigned probability.
        Overrides:
        set in class Probability<T>
        Parameters:
        probability - the probability to assign
      • setIfLarger

        public void setIfLarger​(double probability)
        Assigns a probability to a label, discarding any previously assigned probability, if the new probability is greater than the old one.
        Overrides:
        setIfLarger in class Probability<T>
        Parameters:
        probability - the probability to assign
      • setIfLarger

        public void setIfLarger​(Probability probability)
        Assigns a probability to a label, discarding any previously assigned probability, if the new probability is greater than the old one.
        Overrides:
        setIfLarger in class Probability<T>
        Parameters:
        probability - the probability to assign
      • isLarger

        public boolean isLarger​(Probability probability)
        Checks if a probability is greater than the old one.
        Overrides:
        isLarger in class Probability<T>
        Parameters:
        probability - the probability to assign
      • setLog

        public void setLog​(double probability)
        Assigns a log probability to a label, discarding any previously assigned probability.
        Overrides:
        setLog in class Probability<T>
        Parameters:
        probability - the log probability to assign
      • addIn

        public void addIn​(double probability)
        Compounds the existing probability mass on the label with the new probability passed in to the method.
        Overrides:
        addIn in class Probability<T>
        Parameters:
        probability - the probability weight to add
      • get

        public Double get()
        Returns the probability associated with a label
        Overrides:
        get in class Probability<T>
        Returns:
        the probability associated with the label
      • getLog

        public Double getLog()
        Returns the log probability associated with a label
        Overrides:
        getLog in class Probability<T>
        Returns:
        the log probability associated with the label
      • getLabel

        public T getLabel()
        Returns the probabilities associated with all labels
        Overrides:
        getLabel in class Probability<T>
        Returns:
        the HashMap of labels and their probabilities