Class Probabilities<T>

Namespace
NOpenNLP.Tools.Ml.Naivebayes
Assembly
NOpenNLP.Tools.dll

Class implementing the probability distribution over labels returned by a classifier.

public abstract class Probabilities<T>

Type Parameters

T

the label (category) class

Inheritance
Probabilities<T>
Derived
Inherited Members

Fields

confidence

protected double confidence

Field Value

double

isNormalised

protected bool isNormalised

Field Value

bool

map

protected readonly IDictionary<T, double?> map

Field Value

IDictionary<T, double?>

normalised

protected IDictionary<T?, double?>? normalised

Field Value

IDictionary<T, double?>

Properties

All

Returns the probabilities associated with all labels

public virtual IDictionary<T?, double?> All { get; }

Property Value

IDictionary<T, double?>

the ISet<T> of labels and their probabilities

Keys

Returns the probabilities associated with all labels

public virtual ISet<T> Keys { get; }

Property Value

ISet<T>

the ISet<T> of labels and their probabilities

MaxValue

Returns the probability of the most likely label

public virtual double? MaxValue { get; }

Property Value

double?

the highest probability

Methods

AddIn(T, double, int)

Compounds the existing probability mass on the label with the new probability passed in to the method.

public virtual 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

CreateMapDataStructure()

protected virtual IDictionary<T?, double?> CreateMapDataStructure()

Returns

IDictionary<T, double?>

DiscardCountsBelow(double)

public virtual void DiscardCountsBelow(double i)

Parameters

i double

Get(T?)

Returns the probability associated with a label

public virtual double? Get(T? t)

Parameters

t T

the label whose probability needs to be returned

Returns

double?

the probability associated with the label

GetConfidence()

Returns 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.

public virtual double GetConfidence()

Returns

double

the best confidence of the probabilities

GetLog(T)

Returns the log probability associated with a label

public virtual 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 virtual 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 virtual 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 virtual void Set(T t, double probability)

Parameters

t T

the label to which the probability is being assigned

probability double

the probability to assign

SetConfidence(double)

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.

public virtual void SetConfidence(double confidence)

Parameters

confidence double

the confidence in the probabilities

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 virtual 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 virtual 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

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.