Operator Reference

get_sample_class_knnT_get_sample_class_knnGetSampleClassKnnGetSampleClassKnnget_sample_class_knn (Operator)

get_sample_class_knnT_get_sample_class_knnGetSampleClassKnnGetSampleClassKnnget_sample_class_knn — 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)

def get_sample_class_knn(knnhandle: HHandle, index_sample: int) -> Tuple[Sequence[float], Sequence[int]]

Description

get_sample_class_knnget_sample_class_knnGetSampleClassKnnGetSampleClassKnnget_sample_class_knn 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_knnAddSampleClassKnnAddSampleClassKnnadd_sample_class_knn or read_class_knnread_class_knnReadClassKnnReadClassKnnread_class_knn. The index of the sample is specified with IndexSampleIndexSampleIndexSampleindexSampleindex_sample. The index is counted from 0, i.e., IndexSampleIndexSampleIndexSampleindexSampleindex_sample must be a number between 0 and NumSamplesNumSamplesNumSamplesnumSamplesnum_samples - 1, where NumSamplesNumSamplesNumSamplesnumSamplesnum_samples can be determined with get_sample_num_class_knnget_sample_num_class_knnGetSampleNumClassKnnGetSampleNumClassKnnget_sample_num_class_knn. The training sample is returned in FeaturesFeaturesFeaturesfeaturesfeatures and ClassIDClassIDClassIDclassIDclass_id. FeaturesFeaturesFeaturesfeaturesfeatures is a feature vector of length NumDimNumDimNumDimnumDimnum_dim (see create_class_knncreate_class_knnCreateClassKnnCreateClassKnncreate_class_knn), while ClassIDClassIDClassIDclassIDclass_id is the class label, which is a number between 0 and the number of classes.

Execution Information

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

Parameters

KNNHandleKNNHandleKNNHandleKNNHandleknnhandle (input_control)  class_knn HClassKnn, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the k-NN classifier.

IndexSampleIndexSampleIndexSampleindexSampleindex_sample (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Index of the training sample.

FeaturesFeaturesFeaturesfeaturesfeatures (output_control)  real-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Feature vector of the training sample.

ClassIDClassIDClassIDclassIDclass_id (output_control)  integer-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Class of the training sample.

Result

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

Possible Predecessors

add_sample_class_train_dataadd_sample_class_train_dataAddSampleClassTrainDataAddSampleClassTrainDataadd_sample_class_train_data

See also

create_class_knncreate_class_knnCreateClassKnnCreateClassKnncreate_class_knn

Module

Foundation