ClassesClassesClassesClasses | | | | Operators

add_sample_class_knnadd_sample_class_knnAddSampleClassKnnadd_sample_class_knnAddSampleClassKnnAddSampleClassKnn (Operator)


add_sample_class_knnadd_sample_class_knnAddSampleClassKnnadd_sample_class_knnAddSampleClassKnnAddSampleClassKnn — Add a sample to a k-nearest neighbors (k-NN) classifier.


add_sample_class_knn( : : KNNHandle, Features, ClassID : )

Herror add_sample_class_knn(const Hlong KNNHandle, double Features, const Hlong ClassID)

Herror T_add_sample_class_knn(const Htuple KNNHandle, const Htuple Features, const Htuple ClassID)

Herror add_sample_class_knn(const HTuple& KNNHandle, const HTuple& Features, const HTuple& ClassID)

void HClassKnn::AddSampleClassKnn(const HTuple& Features, const HTuple& ClassID) const

void AddSampleClassKnn(const HTuple& KNNHandle, const HTuple& Features, const HTuple& ClassID)

void HClassKnn::AddSampleClassKnn(const HTuple& Features, const HTuple& ClassID) const

void HClassKnn::AddSampleClassKnn(double Features, Hlong ClassID) const

void HOperatorSetX.AddSampleClassKnn(
[in] VARIANT KNNHandle, [in] VARIANT Features, [in] VARIANT ClassID)

void HClassKnnX.AddSampleClassKnn(
[in] VARIANT Features, [in] VARIANT ClassID)

static void HOperatorSet.AddSampleClassKnn(HTuple KNNHandle, HTuple features, HTuple classID)

void HClassKnn.AddSampleClassKnn(HTuple features, HTuple classID)

void HClassKnn.AddSampleClassKnn(double features, int classID)


add_sample_class_knnadd_sample_class_knnAddSampleClassKnnadd_sample_class_knnAddSampleClassKnnAddSampleClassKnn adds a feature vector to a k-nearest neighbors (k-NN) data structure. The length of a feature vector was specified in create_class_knncreate_class_knnCreateClassKnncreate_class_knnCreateClassKnnCreateClassKnn by NumDim. A handle to a k-NN data structure has to be specified in KNNHandleKNNHandleKNNHandleKNNHandleKNNHandleKNNHandle.

The feature vectors are collected in FeaturesFeaturesFeaturesFeaturesFeaturesfeatures. The length of the input vector must be a multiple of NumDim. Each feature vector needs a class which can be given by ClassIDClassIDClassIDClassIDClassIDclassID, if only one was specified, the class is used for all vectors. The class is a natural number greater or equal to 0. If only one class is used, the class has to be 0. In case the operator classify_image_class_knnclassify_image_class_knnClassifyImageClassKnnclassify_image_class_knnClassifyImageClassKnnClassifyImageClassKnn will be used, all numbers starting from 0 to the number of classes-1 should be used, since otherwise an empty region will be generated for each unused number.

It is allowed to add samples to an already trained k-NN classificator. The new data is only integrated after another call to train_class_knntrain_class_knnTrainClassKnntrain_class_knnTrainClassKnnTrainClassKnn.

If the k-NN classifier has been trained with automatic feature normalization enabled, the supplied features FeaturesFeaturesFeaturesFeaturesFeaturesfeatures are interpreted as unnormalized and are normalized as it was defined by the last call to train_class_knntrain_class_knnTrainClassKnntrain_class_knnTrainClassKnnTrainClassKnn. Please see train_class_knntrain_class_knnTrainClassKnntrain_class_knnTrainClassKnnTrainClassKnn for more information on normalization.



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

Handle of the k-NN classifier.

FeaturesFeaturesFeaturesFeaturesFeaturesfeatures (input_control)  number(-array) HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

List of features to add.

ClassIDClassIDClassIDClassIDClassIDclassID (input_control)  integer(-array) HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Class IDs of the features.


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

Possible Predecessors

train_class_knntrain_class_knnTrainClassKnntrain_class_knnTrainClassKnnTrainClassKnn, read_class_knnread_class_knnReadClassKnnread_class_knnReadClassKnnReadClassKnn

See also

create_class_knncreate_class_knnCreateClassKnncreate_class_knnCreateClassKnnCreateClassKnn, read_class_knnread_class_knnReadClassKnnread_class_knnReadClassKnnReadClassKnn


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



ClassesClassesClassesClasses | | | | Operators