ClassesClassesClassesClasses | | | | Operators

train_class_knnT_train_class_knnTrainClassKnntrain_class_knnTrainClassKnnTrainClassKnn (Operator)

Name

train_class_knnT_train_class_knnTrainClassKnntrain_class_knnTrainClassKnnTrainClassKnn — Creates the search trees for a k-NN classifier.

Signature

train_class_knn( : : KNNHandle, GenParamNames, GenParamValues : )

Herror T_train_class_knn(const Htuple KNNHandle, const Htuple GenParamNames, const Htuple GenParamValues)

Herror train_class_knn(const HTuple& KNNHandle, const HTuple& GenParamNames, const HTuple& GenParamValues)

void HClassKnn::TrainClassKnn(const HTuple& GenParamNames, const HTuple& GenParamValues) const

void TrainClassKnn(const HTuple& KNNHandle, const HTuple& GenParamNames, const HTuple& GenParamValues)

void HClassKnn::TrainClassKnn(const HTuple& GenParamNames, const HTuple& GenParamValues) const

void HOperatorSetX.TrainClassKnn(
[in] VARIANT KNNHandle, [in] VARIANT GenParamNames, [in] VARIANT GenParamValues)

void HClassKnnX.TrainClassKnn(
[in] VARIANT GenParamNames, [in] VARIANT GenParamValues)

static void HOperatorSet.TrainClassKnn(HTuple KNNHandle, HTuple genParamNames, HTuple genParamValues)

void HClassKnn.TrainClassKnn(HTuple genParamNames, HTuple genParamValues)

Description

train_class_knntrain_class_knnTrainClassKnntrain_class_knnTrainClassKnnTrainClassKnn creates the search trees for a k-NN classifier.

It is possible to set the number of trees via the parameters GenParamNamesGenParamNamesGenParamNamesGenParamNamesGenParamNamesgenParamNames and GenParamValuesGenParamValuesGenParamValuesGenParamValuesGenParamValuesgenParamValues by 'num_trees'"num_trees""num_trees""num_trees""num_trees""num_trees". The default value for the number of search trees is 4. A higher number of trees improves the accuracy of the search, but increases the run time.

It is possible to add more samples after training using the operator add_sample_class_knnadd_sample_class_knnAddSampleClassKnnadd_sample_class_knnAddSampleClassKnnAddSampleClassKnn. The added data affects the classification only, if train_class_knntrain_class_knnTrainClassKnntrain_class_knnTrainClassKnnTrainClassKnn is called again.

Automatic feature normalization can be activated by setting 'normalization'"normalization""normalization""normalization""normalization""normalization" in GenParamNamesGenParamNamesGenParamNamesGenParamNamesGenParamNamesgenParamNames and 'true'"true""true""true""true""true" in GenParamValuesGenParamValuesGenParamValuesGenParamValuesGenParamValuesgenParamValues. The feature vectors are normalized by normalizing each dimension seperately. For each dimension, the mean and standard deviation is calculated over the training samples. Every feature vector is normalized by subtracting the mean and dividing by the standard deviation of the individual dimension. This results in a normalization, where each dimension has zero mean and unit variance. If the standard deviation happens to be zero, only the mean is subtracted. Please note however, that a feature dimension with no standard deviation does not change the classification result and should be removed. Automatic feature normalization will change the stored training data, but the original data can be restored at any time by calling train_class_knntrain_class_knnTrainClassKnntrain_class_knnTrainClassKnnTrainClassKnn with 'normalization'"normalization""normalization""normalization""normalization""normalization" set to 'false'"false""false""false""false""false". If normalization is used, the operator classify_class_knnclassify_class_knnClassifyClassKnnclassify_class_knnClassifyClassKnnClassifyClassKnn interprets the input data as unnormalized and performs normalization internally as it has been defined in the last call to train_class_knntrain_class_knnTrainClassKnntrain_class_knnTrainClassKnnTrainClassKnn.

Parallelization

Parameters

KNNHandleKNNHandleKNNHandleKNNHandleKNNHandleKNNHandle (input_control)  class_knn HClassKnn, HTupleHTupleHClassKnn, HTupleHClassKnnX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

Handle of the k-NN classifier.

GenParamNamesGenParamNamesGenParamNamesGenParamNamesGenParamNamesgenParamNames (input_control)  string-array HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

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

Default value: []

List of values: 'normalization'"normalization""normalization""normalization""normalization""normalization", 'num_trees'"num_trees""num_trees""num_trees""num_trees""num_trees"

GenParamValuesGenParamValuesGenParamValuesGenParamValuesGenParamValuesgenParamValues (input_control)  number-array HTupleHTupleHTupleVARIANTHtuple (integer / string / real) (int / long / string / double) (Hlong / HString / double) (Hlong / char* / double) (Hlong / BSTR / double) (Hlong / char* / double)

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

Default value: []

List of values: 4, 'false'"false""false""false""false""false", 'true'"true""true""true""true""true"

Result

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

Possible Predecessors

add_sample_class_knnadd_sample_class_knnAddSampleClassKnnadd_sample_class_knnAddSampleClassKnnAddSampleClassKnn, read_class_knnread_class_knnReadClassKnnread_class_knnReadClassKnnReadClassKnn

Alternatives

select_feature_set_knnselect_feature_set_knnSelectFeatureSetKnnselect_feature_set_knnSelectFeatureSetKnnSelectFeatureSetKnn

See also

create_class_knncreate_class_knnCreateClassKnncreate_class_knnCreateClassKnnCreateClassKnn, read_class_knnread_class_knnReadClassKnnread_class_knnReadClassKnnReadClassKnn

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


ClassesClassesClassesClasses | | | | Operators