Implementation of the K-NN (K Nearest Neighbors) classification algorithm.
K-NN searches for K nearest neighbors, to the example that we want to classify, and then classifies to the majority class of the nearest neighbors. The algorithm works very well especially for real valued attributes. (real domains). The algorithm gives very good results, but its main disadvantage is slow performance (computational complexity O(n2)).
| 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 | TStringList | A list of recognized classes. |
| DiscreteAttributeCount | integer | Total number of discrete valued attributes or fields holding discreting values in the dataset. |
| DistanceModel | TDistanceModel | Defines the distance model used, when calculating the distance between examples. |
| ExampleCount | integer | Total number of learned examples. |
| 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. |
| KNeighbors | integer | Defines the K parameter for the K-NN algorithm. |
| LeaveOneOut | integer | Set the value of this property to the index of the example that you want to be ignored during the classification. |
| 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. |
| StoreExamples | boolean | Set this property to true, to store all learned examples. |