Implementation of the "Naive Bayes" classification algorithm.
The classifier uses the Laplace estimate of the prior probabilities and m-estimate of the probability. Naive Bayes is still the most succesfull classifier for "statistics":"single example" classification case. It outperformes neural networks and machine learning algorithms in most of the real life cases, despite its inability to detect and account for non-linearities present in the learn datasets. This does not mean that it is not sensitive to presence of non-linearities, but the occurence of such non-linearities which could significantly affect the classification accuracy in the real world test databases is very rare. The drawback of Naive Bayes is its inability to process real values natively. All real valued attributes have to be converted to a discrete representation. This requires, that the entire "knowledge" database is known in advance.
| Name | Type | Description |
|---|
| AttributeCount | integer | Total number of attributes. |
| AttributeEnabled | boolean | Set the value at index to True/False, to enable/disable the corresponding attribute. |
| Classes | TBClassesList | Pointer to list of classes with attribute descriptions and stored learned data. |
| DiscreteAttributeCount | integer | Total number of discrete valued attributes or fields holding discreting values in the dataset. |
| FloatAttributeCount | integer | Total number of real valued attributes or fields holding real values in the dataset. |
| IndexesZeroBased | boolean | Set to True, if Class indexes are zero based. |
| M | integer | The M parameter is used by the M estimate of the probability. |
| MissingDiscreteIndex | integer | Specifies the value indicating a "missing value" (no entry) for discrete attributes in the dataset. |
| MissingFloatValue | string | Specifies the value indicating a "missing value" (no entry) for real valued attributes in the dataset. |
| NormalizeAttributeCount | boolean | If true, the number of attributes compared will be normalized between comparisons. |
| OnClassifyTest | TOnClassifyTest | Called by PrePrune, PostPrune and Prune methods and ClassifyTest methods. |
| OnFirstRecord | TNotifyEvent | Called by LearnData method and K-NN to request the positioning to the first record. |
| OnIndexNextRecord | TIndexNextRecord | Called by LearnData method and K-NN to browse through the learn dataset. |
| OnLastRecord | TNotifyEvent | Called by LearnData method and K-NN when the last record is fetched. |
| OnNameNextRecord | TNameNextRecord | Called by LearnData method and K-NN to browse through the learn data set. |
| OnPopPosition | TPopBookmark | Called by LearnData method and K-NN to restore the current position of the dataset. |
| OnPushPosition | TPushBookmark | Called by LearnData method and K-NN to save the current position of the dataset. |
| RejectProbability | double | If the response of all classes is below RejectProbability the example will not be classified to any of the known classes. |
| Name | Description |
|---|
| AssignAttributeState | Copies the attribute Enabled fields from Source. |
| AttributeQuality | Returns an array of attribute indexes sorted by quality. |
| ClassesName | Get the name of the class at Index. |
| Classify | Determine the most probable class to which the example with values of discrete attributes in DiscreteRecord and values of real valued attributes in FloatRecord belongs to. |
| ClassifyResponse | Determine the response of all classe for the example with values of discrete attributes in DiscreteRecord and values of real valued attributes in FloatRecord. |
| ClassifyTest | Performs the classification on the test data, by calling the OnClassifyTest event. |
| ClassIndex | Get the index of the class with Name. |
| Clear | Clear all learned data and all class descriptions. |
| Destroy | Destroy the component. |
| DisableAttributes | Disable real valued and discrete attributes for all classes. |
| DisableDiscreteAttributes | Disable discrete attributes for all classes. |
| DisableFloatAttributes | Disable real valued attributes for all classes. |
| EnableAttributes | Enable real valued and discrete attributes for all classes. |
| EnableDiscreteAttributes | Enable discrete attributes for all classes. |
| EnableFloatAttributes | Enable real valued attributes for all classes. |
| Entropy | Returns the average information entropy. |
| Learn | Learn a new record belonging to class with ClassName. |
| LearnData | Call this method to perform the learn operation on the learn data. |
| LearnIndex | Learn a new record belonging to class with ClassIndex. |
| LoadFromFile | Load the component from file named FileName. |
| LoadFromStream | |
| MaxDiscreteEntropy | Returns the maximum entropy of the discrete attribute at AttributeIndex. |
| MaxEntropy | Returns the maximum entropy found to be of the attribute at Index. |
| MaxFloatEntropy | Returns the maximum entropy of the real valued attribute at AttributeIndex. |
| MaxPriorProbability | Returns the index of the class, which has the highest count of examples and thus the highest prior probability, with ClassIndex. |
| MissingFloatNumber | Returns numerical representation of MissingFloatValue. |
| PostPrune | Pruning disables some attributes, to improve classification accuracy. |
| PrePrune | Pruning disables some attributes, to improve classificaiton accuracy. |
| Prune | Performs pre-pruning and post-pruning and enables only those attributes giving best classification accuracy towards the test dataset. |
| Reset | Reset all learned data including attribute weights and attribute Enabled fields, but keep the class descriptions. |
| SaveToFile | Save the component to file named FileName. |
| SaveToStream | |
| SoftReset | Reset all learned data except attribute weights and attribute Enabled fields and keep the class descriptions. |
| SortIndexRecord | Sort an array of TIndexRecords. |