Package opennlp.tools.ml.naivebayes
Class LogProbability<T>
- java.lang.Object
-
- opennlp.tools.ml.naivebayes.Probability<T>
-
- opennlp.tools.ml.naivebayes.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 labelT
getLabel()
Returns the probabilities associated with all labelsDouble
getLog()
Returns the log probability associated with a labelboolean
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 classProbability<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 classProbability<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 classProbability<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 classProbability<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 classProbability<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 classProbability<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 classProbability<T>
- Parameters:
probability
- the probability weight to add
-
get
public Double get()
Returns the probability associated with a label- Overrides:
get
in classProbability<T>
- Returns:
- the probability associated with the label
-
getLog
public Double getLog()
Returns the log probability associated with a label- Overrides:
getLog
in classProbability<T>
- Returns:
- the log probability associated with the label
-
getLabel
public T getLabel()
Returns the probabilities associated with all labels- Overrides:
getLabel
in classProbability<T>
- Returns:
- the HashMap of labels and their probabilities
-
toString
public String toString()
- Overrides:
toString
in classProbability<T>
-
-