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 voidaddIn(double probability)Compounds the existing probability mass on the label with the new probability passed in to the method.Doubleget()Returns the probability associated with a labelTgetLabel()Returns the probabilities associated with all labelsDoublegetLog()Returns the log probability associated with a labelbooleanisLarger(Probability probability)Checks if a probability is greater than the old one.voidset(double probability)Assigns a probability to a label, discarding any previously assigned probability.voidset(Probability probability)Assigns a probability to a label, discarding any previously assigned probability.voidsetIfLarger(double probability)Assigns a probability to a label, discarding any previously assigned probability, if the new probability is greater than the old one.voidsetIfLarger(Probability probability)Assigns a probability to a label, discarding any previously assigned probability, if the new probability is greater than the old one.voidsetLog(double probability)Assigns a log probability to a label, discarding any previously assigned probability.StringtoString()
-
-
-
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:
setin 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:
setin 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:
setIfLargerin 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:
setIfLargerin 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:
isLargerin 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:
setLogin 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:
addInin classProbability<T>- Parameters:
probability- the probability weight to add
-
get
public Double get()
Returns the probability associated with a label- Overrides:
getin classProbability<T>- Returns:
- the probability associated with the label
-
getLog
public Double getLog()
Returns the log probability associated with a label- Overrides:
getLogin classProbability<T>- Returns:
- the log probability associated with the label
-
getLabel
public T getLabel()
Returns the probabilities associated with all labels- Overrides:
getLabelin classProbability<T>- Returns:
- the HashMap of labels and their probabilities
-
toString
public String toString()
- Overrides:
toStringin classProbability<T>
-
-