Craig's Utility Library  4.0 Beta
Utilities.DataTypes.AI.NaiveBayes< T > Class Template Reference

Naive bayes classifier More...

Public Member Functions

 NaiveBayes (int ATokenWeight=1, int BTokenWeight=1, double MinTokenProbability=0.01, double MaxTokenProbability=0.999, int MaxInterestingTokenCount=int.MaxValue, int MinCountForInclusion=1)
 Constructor More...
 
virtual double CalculateProbabilityOfTokens (IEnumerable< T > Items)
 Calculates the probability of the list of tokens being in set A More...
 
virtual void LoadTokens (IEnumerable< T > SetATokens, IEnumerable< T > SetBTokens)
 Loads a set of tokens More...
 

Protected Member Functions

virtual double CalculateProbabilityOfToken (T Item)
 Calculates a single items probability of being in set A More...
 

Properties

int ATokenWeight [get, set]
 Weight to give to the probabilities in set A More...
 
int BTokenWeight [get, set]
 Weight to give the probabilities in set B More...
 
int MaxInterestingTokenCount [get, set]
 After sorting, this is the maximum number of tokens that are picked to figure out the final probability More...
 
double MaxTokenProbability [get, set]
 Maximum token probability (if greater than this amount, it becomes this amount) More...
 
int MinCountForInclusion [get, set]
 Minimum count that an item needs to be found to be included in final probability More...
 
double MinTokenProbability [get, set]
 Minimum token probability (if less than this amount, it becomes this amount) More...
 
Bag< T > SetA [get]
 Set A More...
 
Bag< T > SetB [get]
 Set B More...
 
ConcurrentDictionary< T, double > Probabilities [get]
 Dictionary containing probabilities More...
 
double Total [get, set]
 Total number of tokens More...
 
double TotalA [get, set]
 Total number of tokens in set A More...
 
double TotalB [get, set]
 Total number of tokens in set B More...
 

Detailed Description

Naive bayes classifier

Template Parameters
TThe type of the individual tokens

Definition at line 36 of file NaiveBayes.cs.

Constructor & Destructor Documentation

Utilities.DataTypes.AI.NaiveBayes< T >.NaiveBayes ( int  ATokenWeight = 1,
int  BTokenWeight = 1,
double  MinTokenProbability = 0.01,
double  MaxTokenProbability = 0.999,
int  MaxInterestingTokenCount = int.MaxValue,
int  MinCountForInclusion = 1 
)

Constructor

Parameters
ATokenWeightWeight of each token in set A
BTokenWeightWeight of each token in set B
MaxInterestingTokenCountAfter sorting, this is the maximum number of tokens that are picked to figure out the final probability
MaxTokenProbabilityMaximum token probability
MinTokenProbabilityMinimum token probability
MinCountForInclusionMinimum number of times a token needs to be present for it to be included

Definition at line 52 of file NaiveBayes.cs.

Member Function Documentation

virtual double Utilities.DataTypes.AI.NaiveBayes< T >.CalculateProbabilityOfToken ( Item)
protectedvirtual

Calculates a single items probability of being in set A

Parameters
ItemItem to calculate
Returns
The probability that the token is from set A

Definition at line 201 of file NaiveBayes.cs.

virtual double Utilities.DataTypes.AI.NaiveBayes< T >.CalculateProbabilityOfTokens ( IEnumerable< T >  Items)
virtual

Calculates the probability of the list of tokens being in set A

Parameters
ItemsList of items
Returns
The probability that the tokens are from set A

Definition at line 137 of file NaiveBayes.cs.

virtual void Utilities.DataTypes.AI.NaiveBayes< T >.LoadTokens ( IEnumerable< T >  SetATokens,
IEnumerable< T >  SetBTokens 
)
virtual

Loads a set of tokens

Parameters
SetATokensSet A
SetBTokensSet B

Definition at line 173 of file NaiveBayes.cs.

Property Documentation

int Utilities.DataTypes.AI.NaiveBayes< T >.ATokenWeight
getset

Weight to give to the probabilities in set A

Definition at line 74 of file NaiveBayes.cs.

int Utilities.DataTypes.AI.NaiveBayes< T >.BTokenWeight
getset

Weight to give the probabilities in set B

Definition at line 79 of file NaiveBayes.cs.

int Utilities.DataTypes.AI.NaiveBayes< T >.MaxInterestingTokenCount
getset

After sorting, this is the maximum number of tokens that are picked to figure out the final probability

Definition at line 85 of file NaiveBayes.cs.

double Utilities.DataTypes.AI.NaiveBayes< T >.MaxTokenProbability
getset

Maximum token probability (if greater than this amount, it becomes this amount)

Definition at line 90 of file NaiveBayes.cs.

int Utilities.DataTypes.AI.NaiveBayes< T >.MinCountForInclusion
getset

Minimum count that an item needs to be found to be included in final probability

Definition at line 95 of file NaiveBayes.cs.

double Utilities.DataTypes.AI.NaiveBayes< T >.MinTokenProbability
getset

Minimum token probability (if less than this amount, it becomes this amount)

Definition at line 100 of file NaiveBayes.cs.

ConcurrentDictionary<T, double> Utilities.DataTypes.AI.NaiveBayes< T >.Probabilities
getprotected

Dictionary containing probabilities

Definition at line 115 of file NaiveBayes.cs.

Set A

Definition at line 105 of file NaiveBayes.cs.

Set B

Definition at line 110 of file NaiveBayes.cs.

double Utilities.DataTypes.AI.NaiveBayes< T >.Total
getsetprotected

Total number of tokens

Definition at line 120 of file NaiveBayes.cs.

double Utilities.DataTypes.AI.NaiveBayes< T >.TotalA
getsetprotected

Total number of tokens in set A

Definition at line 125 of file NaiveBayes.cs.

double Utilities.DataTypes.AI.NaiveBayes< T >.TotalB
getsetprotected

Total number of tokens in set B

Definition at line 130 of file NaiveBayes.cs.


The documentation for this class was generated from the following file: