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
Tthe label (category) class
- Inheritance
-
Probabilities<T>
- Derived
- Inherited Members
Fields
confidence
protected double confidence
Field Value
isNormalised
protected bool isNormalised
Field Value
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
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
tTthe label whose probability mass is being updated
probabilitydoublethe probability weight to add
countintthe 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
idouble
Get(T?)
Returns the probability associated with a label
public virtual double? Get(T? t)
Parameters
tTthe 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
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 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
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 virtual void Set(T t, double probability)
Parameters
tTthe label to which the probability is being assigned
probabilitydoublethe 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
confidencedoublethe 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
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 virtual void SetLog(T t, double probability)
Parameters
tTthe label to which the log probability is being assigned
probabilitydoublethe 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.