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>
A class implementing the logarithmicProbabilityfor 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 existingprobabilitymass on the label with the new probability passed in to the method.Doubleget()TgetLabel()DoublegetLog()booleanisLarger(Probability<T> probability)Checks if a probability is greater than the old one.voidset(double probability)Assigns aprobabilityto a label, discarding any previously assigned probability.voidset(Probability<T> probability)Assigns aprobabilityto a label, discarding any previously assigned probability.voidsetIfLarger(double probability)Assigns aprobabilityto a label, discarding any previously assigned probability, if the new probability is greater than the old one.voidsetIfLarger(Probability<T> probability)Assigns aprobabilityto a label, discarding any previously assigned probability, if the new probability is greater than the old one.voidsetLog(double probability)Assigns a logprobabilityto a label, discarding any previously assigned probability.StringtoString()
-
-
-
Constructor Detail
-
LogProbability
public LogProbability(T label)
-
-
Method Detail
-
set
public void set(double probability)
Assigns aprobabilityto a label, discarding any previously assigned probability.- Overrides:
setin classProbability<T>- Parameters:
probability- The probability to assign.
-
set
public void set(Probability<T> probability)
Assigns aprobabilityto a label, discarding any previously assigned probability.- Overrides:
setin classProbability<T>- Parameters:
probability- TheProbabilityto assign.
-
setIfLarger
public void setIfLarger(double probability)
Assigns aprobabilityto 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<T> probability)
Assigns aprobabilityto a label, discarding any previously assigned probability, if the new probability is greater than the old one.- Overrides:
setIfLargerin classProbability<T>- Parameters:
probability- TheProbabilityto assign.
-
isLarger
public boolean isLarger(Probability<T> probability)
Description copied from class:ProbabilityChecks if a probability is greater than the old one.- Overrides:
isLargerin classProbability<T>- Parameters:
probability- the probability to check- Returns:
trueif a probability is greater than the old one,falseotherwise.
-
setLog
public void setLog(double probability)
Assigns a logprobabilityto 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 existingprobabilitymass 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()
- Overrides:
getin classProbability<T>- Returns:
- Retrieves the probability associated with a label.
-
getLog
public Double getLog()
- Overrides:
getLogin classProbability<T>- Returns:
- Retrieves the log probability associated with a label.
-
getLabel
public T getLabel()
- Overrides:
getLabelin classProbability<T>- Returns:
- Retrieves the probabilities associated with all labels,
-
toString
public String toString()
- Overrides:
toStringin classProbability<T>
-
-