get_sample_class_svmT_get_sample_class_svmGetSampleClassSvmGetSampleClassSvm (Operator)

Name

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

Description

get_sample_class_svmget_sample_class_svmGetSampleClassSvmGetSampleClassSvmGetSampleClassSvm reads out a training sample from the support vector machine (SVM) given by SVMHandleSVMHandleSVMHandleSVMHandleSVMHandle that was added with add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmAddSampleClassSvm or read_samples_class_svmread_samples_class_svmReadSamplesClassSvmReadSamplesClassSvmReadSamplesClassSvm. 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 IndexSamples - 1, where IndexSamples can be determined with get_sample_num_class_svmget_sample_num_class_svmGetSampleNumClassSvmGetSampleNumClassSvmGetSampleNumClassSvm. The training sample is returned in FeaturesFeaturesFeaturesFeaturesfeatures and TargetTargetTargetTargettarget. FeaturesFeaturesFeaturesFeaturesfeatures is a feature vector of length NumFeatures (see create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvm), while TargetTargetTargetTargettarget is the index of the class, ranging between 0 and NumClasses-1 (see add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmAddSampleClassSvm).

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

Execution Information

Parameters

SVMHandleSVMHandleSVMHandleSVMHandleSVMHandle (input_control)  class_svm HClassSvm, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

SVM handle.

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

Number of the stored training sample.

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

Feature vector of the training sample.

TargetTargetTargetTargettarget (output_control)  integer HTupleHTupleHtuple (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_svmGetSampleClassSvmGetSampleClassSvmGetSampleClassSvm returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Possible Predecessors

add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmAddSampleClassSvm, read_samples_class_svmread_samples_class_svmReadSamplesClassSvmReadSamplesClassSvmReadSamplesClassSvm, get_sample_num_class_svmget_sample_num_class_svmGetSampleNumClassSvmGetSampleNumClassSvmGetSampleNumClassSvm, get_support_vector_class_svmget_support_vector_class_svmGetSupportVectorClassSvmGetSupportVectorClassSvmGetSupportVectorClassSvm

Possible Successors

classify_class_svmclassify_class_svmClassifyClassSvmClassifyClassSvmClassifyClassSvm

See also

create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvm

Module

Foundation