Operators |
get_sample_class_svm — Return a training sample from the training data of a support vector machine.
get_sample_class_svm( : : SVMHandle, IndexSample : Features, Target)
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 IndexSamples - 1, where IndexSamples 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.
SVM handle.
Number of the stored training sample.
Feature vector of the training sample.
Target vector of the training sample.
* 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 clear_class_svm (SVMHandle)
If the parameters are valid the operator get_sample_class_svm returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
add_sample_class_svm, read_samples_class_svm, get_sample_num_class_svm, get_support_vector_class_svm
Foundation
Operators |