Package opennlp.tools.ml.naivebayes
Class Probabilities<T>
- java.lang.Object
-
- opennlp.tools.ml.naivebayes.Probabilities<T>
-
- Type Parameters:
T
- The label (category) class.
- Direct Known Subclasses:
LogProbabilities
public abstract class Probabilities<T> extends Object
Class implementing the probability distribution over labels returned by a classifier.
-
-
Constructor Summary
Constructors Constructor Description Probabilities()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addIn(T t, double probability, int count)
Compounds the existing probability mass on the labelt
with the new probability passed in to the method.void
discardCountsBelow(double i)
Double
get(T t)
Map<T,Double>
getAll()
double
getConfidence()
Set<T>
getKeys()
Double
getLog(T t)
T
getMax()
double
getMaxValue()
void
set(T t, double probability)
Assigns a probability to a labelt
, discarding any previously assigned probability.void
set(T t, Probability<T> probability)
Assigns a probability to a labelt
, discarding any previously assigned probability.void
setConfidence(double confidence)
Sets the best confidence with which this set of probabilities has been calculated.void
setIfLarger(T t, double probability)
Assigns a probability to a labelt
, discarding any previously assigned probability, if the new probability is greater than the old one.void
setLog(T t, double probability)
Assigns a log probability to a labelt
, discarding any previously assigned probability.String
toString()
-
-
-
Method Detail
-
set
public void set(T t, double probability)
Assigns a probability to a labelt
, discarding any previously assigned probability.- Parameters:
t
- The label to which the probability is being assigned.probability
- The probability to assign.
-
set
public void set(T t, Probability<T> probability)
Assigns a probability to a labelt
, discarding any previously assigned probability.- Parameters:
t
- The label to which the probability is being assigned.probability
- The probability to assign.
-
setIfLarger
public void setIfLarger(T t, double probability)
Assigns a probability to a labelt
, discarding any previously assigned probability, if the new probability is greater than the old one.- Parameters:
t
- The label to which the probability is being assigned.probability
- The probability to assign.
-
setLog
public void setLog(T t, double probability)
Assigns a log probability to a labelt
, discarding any previously assigned probability.- Parameters:
t
- The label to which the log probability is being assigned.probability
- The log probability to assign.
-
addIn
public void addIn(T t, double probability, int count)
Compounds the existing probability mass on the labelt
with the new probability passed in to the method.- Parameters:
t
- The label whose probability mass is being updated.probability
- The probability weight to add.count
- The amplifying factor for the probability compounding.
-
get
public Double get(T t)
- Parameters:
t
- The label whose probability needs to be returned.- Returns:
- Retrieves the probability associated with the label.
-
getLog
public Double getLog(T t)
- Parameters:
t
- The label whose log probability should be returned.- Returns:
- Retrieves the log probability associated with the label
-
getMax
public T getMax()
- Returns:
- Retrieves the label that has the highest associated probability.
-
getMaxValue
public double getMaxValue()
- Returns:
- Retrieves the probability of the most likely label
-
discardCountsBelow
public void discardCountsBelow(double i)
-
getConfidence
public double getConfidence()
- Returns:
- Retrieves the best confidence with which this set of probabilities has been calculated. This is a function of the amount of data that supports the assertion. It is also a measure of the accuracy of the estimator of the probability.
-
setConfidence
public void setConfidence(double confidence)
Sets the best confidence with which this set of probabilities has been calculated. This is a function of the amount of data that supports the assertion. It is also a measure of the accuracy of the estimator of the probability.- Parameters:
confidence
- The confidence in the probabilities.
-
-