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
Description
get_sample_class_svmget_sample_class_svmGetSampleClassSvmGetSampleClassSvmGetSampleClassSvmget_sample_class_svm
reads out a training sample from the
support vector machine (SVM) given by SVMHandleSVMHandleSVMHandleSVMHandleSVMHandlesvmhandle
that was
added with add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmAddSampleClassSvmadd_sample_class_svm
or
read_samples_class_svmread_samples_class_svmReadSamplesClassSvmReadSamplesClassSvmReadSamplesClassSvmread_samples_class_svm
. The index of the sample is
specified with IndexSampleIndexSampleIndexSampleIndexSampleindexSampleindex_sample
. The index is counted from 0,
i.e., IndexSampleIndexSampleIndexSampleIndexSampleindexSampleindex_sample
must be a number between 0 and
NumSamplesNumSamplesNumSamplesNumSamplesnumSamplesnum_samples
- 1, where NumSamplesNumSamplesNumSamplesNumSamplesnumSamplesnum_samples
can be
determined with get_sample_num_class_svmget_sample_num_class_svmGetSampleNumClassSvmGetSampleNumClassSvmGetSampleNumClassSvmget_sample_num_class_svm
. The training
sample is returned in FeaturesFeaturesFeaturesFeaturesfeaturesfeatures
and TargetTargetTargetTargettargettarget
.
FeaturesFeaturesFeaturesFeaturesfeaturesfeatures
is a feature vector of length
NumFeaturesNumFeaturesNumFeaturesNumFeaturesnumFeaturesnum_features
(see create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvmcreate_class_svm
), while TargetTargetTargetTargettargettarget
is the index of the class, ranging between 0 and NumClassesNumClassesNumClassesNumClassesnumClassesnum_classes
-1 (see
add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmAddSampleClassSvmadd_sample_class_svm
).
get_sample_class_svmget_sample_class_svmGetSampleClassSvmGetSampleClassSvmGetSampleClassSvmget_sample_class_svm
can, for example, be used to reclassify
the training data with classify_class_svmclassify_class_svmClassifyClassSvmClassifyClassSvmClassifyClassSvmclassify_class_svm
in order to
determine which training samples, if any, are classified
incorrectly.
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
SVMHandleSVMHandleSVMHandleSVMHandleSVMHandlesvmhandle
(input_control) class_svm →
HClassSvm, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
SVM handle.
IndexSampleIndexSampleIndexSampleIndexSampleindexSampleindex_sample
(input_control) integer →
HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Number of the stored training sample.
FeaturesFeaturesFeaturesFeaturesfeaturesfeatures
(output_control) real-array →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Feature vector of the training sample.
TargetTargetTargetTargettargettarget
(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_svmGetSampleClassSvmGetSampleClassSvmGetSampleClassSvmget_sample_class_svm
returns the value 2 (H_MSG_TRUE). If necessary,
an exception is raised.
Possible Predecessors
add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmAddSampleClassSvmadd_sample_class_svm
,
read_samples_class_svmread_samples_class_svmReadSamplesClassSvmReadSamplesClassSvmReadSamplesClassSvmread_samples_class_svm
,
get_sample_num_class_svmget_sample_num_class_svmGetSampleNumClassSvmGetSampleNumClassSvmGetSampleNumClassSvmget_sample_num_class_svm
,
get_support_vector_class_svmget_support_vector_class_svmGetSupportVectorClassSvmGetSupportVectorClassSvmGetSupportVectorClassSvmget_support_vector_class_svm
Possible Successors
classify_class_svmclassify_class_svmClassifyClassSvmClassifyClassSvmClassifyClassSvmclassify_class_svm
See also
create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvmcreate_class_svm
Module
Foundation