Craig's Utility Library
4.0 Beta
|
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... | |
Naive bayes classifier
T | The type of the individual tokens |
Definition at line 36 of file NaiveBayes.cs.
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
ATokenWeight | Weight of each token in set A |
BTokenWeight | Weight of each token in set B |
MaxInterestingTokenCount | After sorting, this is the maximum number of tokens that are picked to figure out the final probability |
MaxTokenProbability | Maximum token probability |
MinTokenProbability | Minimum token probability |
MinCountForInclusion | Minimum number of times a token needs to be present for it to be included |
Definition at line 52 of file NaiveBayes.cs.
|
protectedvirtual |
Calculates a single items probability of being in set A
Item | Item to calculate |
Definition at line 201 of file NaiveBayes.cs.
|
virtual |
Calculates the probability of the list of tokens being in set A
Items | List of items |
Definition at line 137 of file NaiveBayes.cs.
|
virtual |
Loads a set of tokens
Definition at line 173 of file NaiveBayes.cs.
|
getset |
Weight to give to the probabilities in set A
Definition at line 74 of file NaiveBayes.cs.
|
getset |
Weight to give the probabilities in set B
Definition at line 79 of file NaiveBayes.cs.
|
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.
|
getset |
Maximum token probability (if greater than this amount, it becomes this amount)
Definition at line 90 of file NaiveBayes.cs.
|
getset |
Minimum count that an item needs to be found to be included in final probability
Definition at line 95 of file NaiveBayes.cs.
|
getset |
Minimum token probability (if less than this amount, it becomes this amount)
Definition at line 100 of file NaiveBayes.cs.
|
getprotected |
Dictionary containing probabilities
Definition at line 115 of file NaiveBayes.cs.
|
get |
Set A
Definition at line 105 of file NaiveBayes.cs.
|
get |
Set B
Definition at line 110 of file NaiveBayes.cs.
|
getsetprotected |
Total number of tokens
Definition at line 120 of file NaiveBayes.cs.
|
getsetprotected |
Total number of tokens in set A
Definition at line 125 of file NaiveBayes.cs.
|
getsetprotected |
Total number of tokens in set B
Definition at line 130 of file NaiveBayes.cs.