get_sample_class_svmT_get_sample_class_svmGetSampleClassSvmGetSampleClassSvmget_sample_class_svm (Operator)

Name

get_sample_class_svmT_get_sample_class_svmGetSampleClassSvmGetSampleClassSvmget_sample_class_svm — Return a training sample from the training data of a support vector machine.

Signature

get_sample_class_svm( : : SVMHandle, IndexSample : Features, Target)

Herror T_get_sample_class_svm(const Htuple SVMHandle, const Htuple IndexSample, Htuple* Features, Htuple* Target)

void GetSampleClassSvm(const HTuple& SVMHandle, const HTuple& IndexSample, HTuple* Features, HTuple* Target)

HTuple HClassSvm::GetSampleClassSvm(Hlong IndexSample, Hlong* Target) const

static void HOperatorSet.GetSampleClassSvm(HTuple SVMHandle, HTuple indexSample, out HTuple features, out HTuple target)

HTuple HClassSvm.GetSampleClassSvm(int indexSample, out int target)

def get_sample_class_svm(svmhandle: HHandle, index_sample: int) -> Tuple[Sequence[float], int]

Description

get_sample_class_svmget_sample_class_svmGetSampleClassSvmGetSampleClassSvmget_sample_class_svm reads out a training sample from the support vector machine (SVM) given by SVMHandleSVMHandleSVMHandleSVMHandlesvmhandle that was added with add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmadd_sample_class_svm or read_samples_class_svmread_samples_class_svmReadSamplesClassSvmReadSamplesClassSvmread_samples_class_svm. 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_svmget_sample_num_class_svmGetSampleNumClassSvmGetSampleNumClassSvmget_sample_num_class_svm. The training sample is returned in FeaturesFeaturesFeaturesfeaturesfeatures and TargetTargetTargettargettarget. FeaturesFeaturesFeaturesfeaturesfeatures is a feature vector of length NumFeaturesNumFeaturesNumFeaturesnumFeaturesnum_features (see create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmcreate_class_svm), while TargetTargetTargettargettarget is the index of the class, ranging between 0 and NumClassesNumClassesNumClassesnumClassesnum_classes-1 (see add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmadd_sample_class_svm).

get_sample_class_svmget_sample_class_svmGetSampleClassSvmGetSampleClassSvmget_sample_class_svm can, for example, be used to reclassify the training data with classify_class_svmclassify_class_svmClassifyClassSvmClassifyClassSvmclassify_class_svm in order to determine which training samples, if any, are classified incorrectly.

Execution Information

Parameters

SVMHandleSVMHandleSVMHandleSVMHandlesvmhandle (input_control)  class_svm HClassSvm, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

SVM handle.

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

Number of the stored training sample.

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

Feature vector of the training sample.

TargetTargetTargettargettarget (output_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Target vector of the training sample.

Example (HDevelop)

* Train an SVM
create_class_svm (NumFeatures, 'rbf', 0.01, 0.01, NumClasses,\
                  'one-versus-all', 'normalization', NumFeatures,\
                  SVMHandle)
read_samples_class_svm (SVMHandle, 'samples.mtf')
train_class_svm (SVMHandle, 0.001, 'default')
* Reclassify the training samples
get_sample_num_class_svm (SVMHandle, NumSamples)
for I := 0 to NumSamples-1 by 1
    get_sample_class_svm (SVMHandle, I, Data, Target)
    classify_class_svm (SVMHandle, Data, 1, Class)
    if (Class != Target)
        * Sample has been classified incorrectly
    endif
endfor

Result

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

Possible Predecessors

add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmadd_sample_class_svm, read_samples_class_svmread_samples_class_svmReadSamplesClassSvmReadSamplesClassSvmread_samples_class_svm, get_sample_num_class_svmget_sample_num_class_svmGetSampleNumClassSvmGetSampleNumClassSvmget_sample_num_class_svm, get_support_vector_class_svmget_support_vector_class_svmGetSupportVectorClassSvmGetSupportVectorClassSvmget_support_vector_class_svm

Possible Successors

classify_class_svmclassify_class_svmClassifyClassSvmClassifyClassSvmclassify_class_svm

See also

create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmcreate_class_svm

Module

Foundation