Class Probability<T>

java.lang.Object
opennlp.tools.ml.naivebayes.Probability<T>
Type Parameters:
T - The label (category) class.
Direct Known Subclasses:
LogProbability

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

    Constructors
    Constructor
    Description
    Probability(T label)
    Instantiates a Probability with a given label.
  • Method Summary Link icon

    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.
    get()
     
     
     
    boolean
    isLarger(Probability<T> 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<T> 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<T> 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.
     

    Methods inherited from class java.lang.Object Link icon

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details Link icon

    • Probability Link icon

      public Probability(T label)
      Instantiates a Probability with a given label.
      Parameters:
      label - The label to assign probabilities to.
  • Method Details Link icon

    • set Link icon

      public void set(double probability)
      Assigns a probability to a label, discarding any previously assigned probability.
      Parameters:
      probability - The probability to assign.
    • set Link icon

      public void set(Probability<T> probability)
      Assigns a probability to a label, discarding any previously assigned probability.
      Parameters:
      probability - The probability to assign.
    • setIfLarger Link icon

      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.
      Parameters:
      probability - The probability to assign.
    • setIfLarger Link icon

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

      public boolean isLarger(Probability<T> probability)
      Checks if a probability is greater than the old one.
      Parameters:
      probability - The probability to assign.
      Returns:
      true if a probability is greater than the old one, false otherwise.
    • setLog Link icon

      public void setLog(double probability)
      Assigns a log probability to a label, discarding any previously assigned probability.
      Parameters:
      probability - The log probability to assign.
    • addIn Link icon

      public void addIn(double probability)
      Compounds the existing probability mass on the label with the new probability passed in to the method.
      Parameters:
      probability - The probability weight to add.
    • get Link icon

      public Double get()
      Returns:
      Retrieves the probability associated with a label.
    • getLog Link icon

      public Double getLog()
      Returns:
      Retrieves the log probability associated with a label.
    • getLabel Link icon

      public T getLabel()
      Returns:
      Retrieves the probabilities associated with all labels.
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object