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
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
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
Rating. There is no efficient way to determine in a
k-NN-tree the nearest neighbor for exactly 'max_num_classes'
counts the occurrences of certain
classes among the nearest 'k' neighbors and returns the occurrent
Result sorted by their relative frequency that is
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
Result sorted by their relative frequency weighted with the
average distance that is returned in
Again, maximally 'max_num_classes' values are returned.
returns the indices of the nearest
'k' neighbors in
and the distances in
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
returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
Marius Muja, David G. Lowe: “Fast Approximate Nearest Neighbors with Automatic Algorithm Configuration”; International Conference on Computer Vision Theory and Applications (VISAPP 09); 2009.