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

T

the 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

t T

the label whose probability mass is being updated

probability double

the probability weight to add

count int

the amplifying factor for the probability compounding

DiscardCountsBelow(double)

public override void DiscardCountsBelow(double i)

Parameters

i double

Get(T?)

Returns the probability associated with a label

public override double? Get(T? t)

Parameters

t T

the 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

t T

the 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

t T

the label to which the probability is being assigned

probability Probability<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

t T

the label to which the probability is being assigned

probability double

the 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

t T

the label to which the probability is being assigned

probability double

the 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

t T

the label to which the log probability is being assigned

probability double

the log probability to assign