get_sample_class_svm🔗
Short description🔗
get_sample_class_svm — Return a training sample from the training data of a support vector
machine.
Signature🔗
get_sample_class_svm( class_svm SVMHandle, integer IndexSample, out real Features, out integer Target )
Description🔗
get_sample_class_svm reads out a training sample from the
support vector machine (SVM) given by SVMHandle that was
added with add_sample_class_svm or
read_samples_class_svm. The index of the sample is
specified with IndexSample. The index is counted from 0,
i.e., IndexSample must be a number between 0 and
NumSamples \(-\) 1, where NumSamples can be
determined with get_sample_num_class_svm. The training
sample is returned in Features and Target.
Features is a feature vector of length
NumFeatures (see create_class_svm), while Target
is the index of the class, ranging between 0 and NumClasses-1 (see
add_sample_class_svm).
get_sample_class_svm can, for example, be used to reclassify
the training data with classify_class_svm in order to
determine which training samples, if any, are classified
incorrectly.
Execution information🔗
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🔗
SVMHandle (input_control) class_svm → (handle)
SVM handle.
IndexSample (input_control) integer → (integer)
Number of the stored training sample.
Features (output_control) real-array → (real)
Feature vector of the training sample.
Target (output_control) integer → (integer)
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_svm returns the value 2 (H_MSG_TRUE). If necessary,
an exception is raised.
Combinations with other operators🔗
Combinations
Possible predecessors
add_sample_class_svm, read_samples_class_svm, get_sample_num_class_svm, get_support_vector_class_svm
Possible successors
See also
Module🔗
Foundation