Class LogProbabilities<T>
- Namespace
- NOpenNLP.Tools.Ml.Naivebayes
- Assembly
- NOpenNLP.Tools.dll
Class implementing the probability distribution over labels returned by a classifier as a log of probabilities. This is necessary because floating point precision in Java does not allow for high-accuracy representation of very low probabilities such as would occur in a text categorizer.
public class LogProbabilities<T> : Probabilities<T>
Type Parameters
Tthe label (category) class
- Inheritance
-
LogProbabilities<T>
- Inherited Members
Properties
All
Returns the probabilities associated with all labels
public override IDictionary<T?, double?> All { get; }
Property Value
- IDictionary<T, double?>
the HashMap of labels and their probabilities
Methods
AddIn(T, double, int)
Compounds the existing probability mass on the label with the new probability passed in to the method.
public override void AddIn(T t, double probability, int count)
Parameters
tTthe label whose probability mass is being updated
probabilitydoublethe probability weight to add
countintthe amplifying factor for the probability compounding
DiscardCountsBelow(double)
public override void DiscardCountsBelow(double i)
Parameters
idouble
Get(T?)
Returns the probability associated with a label
public override double? Get(T? t)
Parameters
tTthe label whose probability needs to be returned
Returns
- double?
the probability associated with the label
GetLog(T)
Returns the log probability associated with a label
public override double GetLog(T t)
Parameters
tTthe label whose log probability needs to be returned
Returns
- double
the log probability associated with the label
GetMax()
Returns the most likely label
public override T? GetMax()
Returns
- T
the label that has the highest associated probability
Set(T, Probability<T>)
Assigns a probability to a label, discarding any previously assigned probability.
public override void Set(T t, Probability<T> probability)
Parameters
tTthe label to which the probability is being assigned
probabilityProbability<T>the probability to assign
Set(T, double)
Assigns a probability to a label, discarding any previously assigned probability.
public override void Set(T t, double probability)
Parameters
tTthe label to which the probability is being assigned
probabilitydoublethe probability to assign
SetIfLarger(T, double)
Assigns a probability to a label, discarding any previously assigned probability, if the new probability is greater than the old one.
public override void SetIfLarger(T t, double probability)
Parameters
tTthe label to which the probability is being assigned
probabilitydoublethe probability to assign
SetLog(T, double)
Assigns a log probability to a label, discarding any previously assigned probability.
public override void SetLog(T t, double probability)
Parameters
tTthe label to which the log probability is being assigned
probabilitydoublethe log probability to assign