Skip to content

create_class_knnCreateClassKnnCreateClassKnncreate_class_knnT_create_class_knnπŸ”—

Short descriptionπŸ”—

create_class_knnCreateClassKnnCreateClassKnncreate_class_knnT_create_class_knn β€” Create a k-nearest neighbors (k-NN) classifier.

SignatureπŸ”—

create_class_knn( number NumDim, out class_knn KNNHandle )void CreateClassKnn( const HTuple& NumDim, HTuple* KNNHandle )static void HOperatorSet.CreateClassKnn( HTuple numDim, out HTuple KNNHandle )def create_class_knn( num_dim: Sequence[int] ) -> HHandle

Herror T_create_class_knn( const Htuple NumDim, Htuple* KNNHandle )

void HClassKnn::HClassKnn( const HTuple& NumDim )

public HClassKnn( HTuple numDim )

void HClassKnn::CreateClassKnn( const HTuple& NumDim )

void HClassKnn.CreateClassKnn( HTuple numDim )

DescriptionπŸ”—

create_class_knnCreateClassKnn creates a k-nearest neighbors (k-NN) data structure. This can be either used to classify data or to approximately locate nearest neighbors in a NumDimnumDimnum_dim-dimensional space.

Most of the operators described in Classification/K-Nearest-Neighbor use the resulting handle KNNHandleKNNHandleknnhandle.

The k-NN classifies by searching approximately the nearest neighbors and returning their classes as result. With the used approximation, the search time is logarithmically to the number of samples and dimensions.

The dimension of the feature vectors is the only parameter that necessarily has to be set in NumDimnumDimnum_dim.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

ParametersπŸ”—

NumDimnumDimnum_dim (input_control) number-array β†’ (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Number of dimensions of the feature.

Default: 1010

KNNHandleKNNHandleknnhandle (output_control) class_knn β†’ (handle)HTuple (HHandle)HClassKnn, HTuple (IntPtr)HHandleHtuple (handle)

Handle of the k-NN classifier.

ResultπŸ”—

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

Combinations with other operatorsπŸ”—

Combinations

Possible successors

add_sample_class_knnAddSampleClassKnn, train_class_knnTrainClassKnn

Alternatives

create_class_svmCreateClassSvm, create_class_mlpCreateClassMlp

See also

select_feature_set_knnSelectFeatureSetKnn, read_class_knnReadClassKnn

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