ClassesClasses | | Operators

get_sample_class_knnT_get_sample_class_knnGetSampleClassKnnGetSampleClassKnn (Operator)

Name

get_sample_class_knnT_get_sample_class_knnGetSampleClassKnnGetSampleClassKnn — Return a training sample from the training data of a k-nearest neighbors (k-NN) classifier.

Signature

get_sample_class_knn( : : KNNHandle, IndexSample : Features, ClassID)

Herror T_get_sample_class_knn(const Htuple KNNHandle, const Htuple IndexSample, Htuple* Features, Htuple* ClassID)

void GetSampleClassKnn(const HTuple& KNNHandle, const HTuple& IndexSample, HTuple* Features, HTuple* ClassID)

HTuple HClassKnn::GetSampleClassKnn(Hlong IndexSample, HTuple* ClassID) const

static void HOperatorSet.GetSampleClassKnn(HTuple KNNHandle, HTuple indexSample, out HTuple features, out HTuple classID)

HTuple HClassKnn.GetSampleClassKnn(int indexSample, out HTuple classID)

Description

get_sample_class_knnget_sample_class_knnGetSampleClassKnnGetSampleClassKnnGetSampleClassKnn reads a training sample from the k-nearest neighbors (k-NN) classifier given by KNNHandleKNNHandleKNNHandleKNNHandleKNNHandle that was added with add_sample_class_knnadd_sample_class_knnAddSampleClassKnnAddSampleClassKnnAddSampleClassKnn or read_class_knnread_class_knnReadClassKnnReadClassKnnReadClassKnn. The index of the sample is specified with IndexSampleIndexSampleIndexSampleIndexSampleindexSample. The index is counted from 0, i.e., IndexSampleIndexSampleIndexSampleIndexSampleindexSample must be a number between 0 and NumSamples - 1, where NumSamples can be determined with get_sample_num_class_knnget_sample_num_class_knnGetSampleNumClassKnnGetSampleNumClassKnnGetSampleNumClassKnn. The training sample is returned in FeaturesFeaturesFeaturesFeaturesfeatures and ClassIDClassIDClassIDClassIDclassID. FeaturesFeaturesFeaturesFeaturesfeatures is a feature vector of length NumDim (see create_class_knncreate_class_knnCreateClassKnnCreateClassKnnCreateClassKnn), while ClassIDClassIDClassIDClassIDclassID is the class label, which is a number between 0 and the number of classes.

Execution Information

Parameters

KNNHandleKNNHandleKNNHandleKNNHandleKNNHandle (input_control)  class_knn HClassKnn, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the k-NN classifier.

IndexSampleIndexSampleIndexSampleIndexSampleindexSample (input_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Index of the training sample.

FeaturesFeaturesFeaturesFeaturesfeatures (output_control)  real-array HTupleHTupleHtuple (real) (double) (double) (double)

Feature vector of the training sample.

ClassIDClassIDClassIDClassIDclassID (output_control)  integer-array HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Class of the training sample.

Result

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

Possible Predecessors

add_sample_class_train_dataadd_sample_class_train_dataAddSampleClassTrainDataAddSampleClassTrainDataAddSampleClassTrainData

See also

create_class_knncreate_class_knnCreateClassKnnCreateClassKnnCreateClassKnn

Module

Foundation


ClassesClasses | | Operators