classify_class_knn — Search for the next neighbors for a given feature vector.
classify_class_knn searches for the next 'k' neighbors of the feature vector given in Features. The distance which is used to determine the next neighbor is the L2-norm of the given vector and the trainings samples.
The value of 'k' can be set via set_params_class_knn. The results can either be the determined class of the feature vector or the indices of the nearest neighbors. The selection of the result behavior can be made by set_params_class_knn via the generic parameters 'method' and 'max_num_classes':
returns the nearest samples for each of maximally 'max_num_classes' different classes, if they have a representative in the nearest 'k' neighbors. The results in Result are classes sorted by their minimal distance in Rating. There is no efficient way to determine in a k-NN-tree the nearest neighbor for exactly 'max_num_classes' classes.
counts the occurrences of certain classes among the nearest 'k' neighbors and returns the occurrent classes in Result sorted by their relative frequency that is returned in Rating. Again, maximally 'max_num_classes' values are returned.
counts the occurrences of certain classes among the nearest 'k' neighbors and returns the occurrent classes in Result sorted by their relative frequency weighted with the average distance that is returned in Rating. Again, maximally 'max_num_classes' values are returned.
returns the indices of the nearest 'k' neighbors in Result and the distances in Rating.
The default behavior is 'classes_distance' and returns the classes and distances.
Handle of the k-NN classifier.
Features that should be classified.
The classification result, either class IDs or sample indices.
A rating for the results. This value contains either a distance, a frequency or a weighted frequency.
If the parameters are valid, the operator classify_class_knn returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
train_class_knn, read_class_knn, set_params_class_knn
Marius Muja, David G. Lowe: “Fast Approximate Nearest Neighbors with Automatic Algorithm Configuration”; International Conference on Computer Vision Theory and Applications (VISAPP 09); 2009.