set_params_class_knnT_set_params_class_knnSetParamsClassKnnSetParamsClassKnn (Operator)

Name

set_params_class_knnT_set_params_class_knnSetParamsClassKnnSetParamsClassKnn — Set parameters for k-NN classification.

Signature

set_params_class_knn( : : KNNHandle, GenParamName, GenParamValue : )

Herror T_set_params_class_knn(const Htuple KNNHandle, const Htuple GenParamName, const Htuple GenParamValue)

void SetParamsClassKnn(const HTuple& KNNHandle, const HTuple& GenParamName, const HTuple& GenParamValue)

void HClassKnn::SetParamsClassKnn(const HTuple& GenParamName, const HTuple& GenParamValue) const

static void HOperatorSet.SetParamsClassKnn(HTuple KNNHandle, HTuple genParamName, HTuple genParamValue)

void HClassKnn.SetParamsClassKnn(HTuple genParamName, HTuple genParamValue)

Description

set_params_class_knnset_params_class_knnSetParamsClassKnnSetParamsClassKnnSetParamsClassKnn sets parameters for the classification of the k-nearest neighbors (k-NN) classifier KNNHandleKNNHandleKNNHandleKNNHandleKNNHandle. It controls the behavior of classify_class_knnclassify_class_knnClassifyClassKnnClassifyClassKnnClassifyClassKnn.

The value of 'k'"k""k""k""k" can be set via GenParamNameGenParamNameGenParamNameGenParamNamegenParamName and GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue. Increasing 'k'"k""k""k""k" also increases the accuracy of the resulting neighbors and increases the run time.

The results can either be the determined class of the feature vector or the indices of the nearest neighbors. The result behavior can be selected with set_params_class_knnset_params_class_knnSetParamsClassKnnSetParamsClassKnnSetParamsClassKnn via the generic parameters 'method'"method""method""method""method" and 'max_num_classes'"max_num_classes""max_num_classes""max_num_classes""max_num_classes":

'classes_distance'"classes_distance""classes_distance""classes_distance""classes_distance":

returns the nearest samples for each of maximally 'max_num_classes'"max_num_classes""max_num_classes""max_num_classes""max_num_classes" different classes, if they have a representative in the nearest 'k'"k""k""k""k" neighbors. The results are classes sorted by their minimal distance. There is no efficient way to determine in a k-NN-tree the nearest neighbor for exactly 'max_num_classes'"max_num_classes""max_num_classes""max_num_classes""max_num_classes" classes.

'classes_frequency'"classes_frequency""classes_frequency""classes_frequency""classes_frequency":

counts the occurrences of certain classes among the nearest 'k'"k""k""k""k" neighbors and returns the occurrent classes sorted by their relative frequency that is returned, too. Again, maximally 'max_num_classes'"max_num_classes""max_num_classes""max_num_classes""max_num_classes" values are returned.

'classes_weighted_frequencies'"classes_weighted_frequencies""classes_weighted_frequencies""classes_weighted_frequencies""classes_weighted_frequencies":

counts the occurrences of certain classes among the nearest 'k'"k""k""k""k" neighbors and returns the occurrent classes sorted by their relative frequency weighted with the average distance that is returned, too. Again, maximally 'max_num_classes'"max_num_classes""max_num_classes""max_num_classes""max_num_classes" values are returned.

'neighbors_distance'"neighbors_distance""neighbors_distance""neighbors_distance""neighbors_distance":

returns the indices of the nearest 'k'"k""k""k""k" neighbors and the distances.

The default behavior is 'classes_distance'"classes_distance""classes_distance""classes_distance""classes_distance".

The option 'num_checks'"num_checks""num_checks""num_checks""num_checks" allows to set the number of maximal runs through the trees. The parameter has to be positive and the default value is 32. The higher this value is, the more accurate the results will be. As a tradeoff, the running time will also be higher. Setting this parameter to 0 triggers an exact search.

The option 'epsilon'"epsilon""epsilon""epsilon""epsilon" allows to set a stop criteria if the value is increased from the default value 0.0. The higher the value is set, the less accurate results of the estimated neighbors can be expected, while it might speed up the search.

Execution Information

This operator modifies the state of the following input parameter:

The value of this parameter may not be shared across multiple threads without external synchronization.

Parameters

KNNHandleKNNHandleKNNHandleKNNHandleKNNHandle (input_control, state is modified)  class_knn HClassKnn, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the k-NN classifier.

GenParamNameGenParamNameGenParamNameGenParamNamegenParamName (input_control)  string-array HTupleHTupleHtuple (string) (string) (HString) (char*)

Names of the generic parameters that can be adjusted for the k-NN classifier.

Default value: ['method','k','max_num_classes'] ["method","k","max_num_classes"] ["method","k","max_num_classes"] ["method","k","max_num_classes"] ["method","k","max_num_classes"]

List of values: 'epsilon'"epsilon""epsilon""epsilon""epsilon", 'k'"k""k""k""k", 'max_num_classes'"max_num_classes""max_num_classes""max_num_classes""max_num_classes", 'method'"method""method""method""method", 'num_checks'"num_checks""num_checks""num_checks""num_checks"

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue (input_control)  number-array HTupleHTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

Values of the generic parameters that can be adjusted for the k-NN classifier.

Default value: ['classes_distance',5,1] ["classes_distance",5,1] ["classes_distance",5,1] ["classes_distance",5,1] ["classes_distance",5,1]

Suggested values: 'classes_distance'"classes_distance""classes_distance""classes_distance""classes_distance", 'classes_frequency'"classes_frequency""classes_frequency""classes_frequency""classes_frequency", 'classes_weighted_frequencies'"classes_weighted_frequencies""classes_weighted_frequencies""classes_weighted_frequencies""classes_weighted_frequencies", 'neighbors_distance'"neighbors_distance""neighbors_distance""neighbors_distance""neighbors_distance", 32, 0.0, 0.02, 0, 1, 2, 3, 4, 5, 6

Result

If the parameters are valid, the operator set_params_class_knnset_params_class_knnSetParamsClassKnnSetParamsClassKnnSetParamsClassKnn returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Possible Predecessors

train_class_knntrain_class_knnTrainClassKnnTrainClassKnnTrainClassKnn, read_class_knnread_class_knnReadClassKnnReadClassKnnReadClassKnn

Possible Successors

classify_class_knnclassify_class_knnClassifyClassKnnClassifyClassKnnClassifyClassKnn

See also

create_class_knncreate_class_knnCreateClassKnnCreateClassKnnCreateClassKnn, read_class_knnread_class_knnReadClassKnnReadClassKnnReadClassKnn, get_params_class_knnget_params_class_knnGetParamsClassKnnGetParamsClassKnnGetParamsClassKnn

References

Marius Muja, David G. Lowe: “Fast Approximate Nearest Neighbors with Automatic Algorithm Configuration”; International Conference on Computer Vision Theory and Applications (VISAPP 09); 2009.

Module

Foundation