Skip to content

add_sample_class_svmAddSampleClassSvmAddSampleClassSvmadd_sample_class_svmT_add_sample_class_svm🔗

Short description🔗

add_sample_class_svmAddSampleClassSvmAddSampleClassSvmadd_sample_class_svmT_add_sample_class_svm — Add a training sample to the training data of a support vector machine.

Signature🔗

add_sample_class_svm( class_svm SVMHandle, real Features, number Class )void AddSampleClassSvm( const HTuple& SVMHandle, const HTuple& Features, const HTuple& Class )static void HOperatorSet.AddSampleClassSvm( HTuple SVMHandle, HTuple features, HTuple classVal )def add_sample_class_svm( svmhandle: HHandle, features: Sequence[float], class_val: Union[int, float] ) -> None

Herror T_add_sample_class_svm( const Htuple SVMHandle, const Htuple Features, const Htuple Class )

void HClassSvm::AddSampleClassSvm( const HTuple& Features, const HTuple& Class ) const

void HClassSvm::AddSampleClassSvm( const HTuple& Features, Hlong Class ) const

void HClassSvm.AddSampleClassSvm( HTuple features, HTuple classVal )

void HClassSvm.AddSampleClassSvm( HTuple features, int classVal )

Description🔗

add_sample_class_svmAddSampleClassSvm adds a training sample to the support vector machine (SVM) given by SVMHandleSVMHandlesvmhandle. The training sample is given by Featuresfeaturesfeatures and ClassclassValclass. Featuresfeaturesfeatures is the feature vector of the sample, and consequently must be a real vector of length NumFeaturesnumFeaturesnum_features, as specified in create_class_svmCreateClassSvm. ClassclassValclass is the target of the sample, which must be in the range of 0 to NumClassesnumClassesnum_classes-1 (see create_class_svmCreateClassSvm). In the special case of 'novelty-detection'"novelty-detection" the class is to be set to 00 as only one class is assumed. Before the SVM can be trained with train_class_svmTrainClassSvm, training samples must be added to the SVM with add_sample_class_svmAddSampleClassSvm. The usage of support vectors of an already trained SVM as training samples is described in train_class_svmTrainClassSvm.

The number of currently stored training samples can be queried with get_sample_num_class_svmGetSampleNumClassSvm. Stored training samples can be read out again with get_sample_class_svmGetSampleClassSvm.

Normally, it is useful to save the training samples in a file with write_samples_class_svmWriteSamplesClassSvm to facilitate reusing the samples and to facilitate that, if necessary, new training samples can be added to the data set, and hence to facilitate that a newly created SVM can be trained with the extended data set.

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.

This operator modifies the state of the following input parameter:

During execution of this operator, access to the value of this parameter must be synchronized if it is used across multiple threads.

Parameters🔗

SVMHandleSVMHandlesvmhandle (input_control, state is modified) class_svm → (handle)HTuple (HHandle)HClassSvm, HTuple (IntPtr)HHandleHtuple (handle)

SVM handle.

Featuresfeaturesfeatures (input_control) real-array → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Feature vector of the training sample to be stored.

ClassclassValclass (input_control) number → (integer / real)HTuple (Hlong / double)HTuple (int / long / double)Union[int, float]Htuple (Hlong / double)

Class of the training sample to be stored.

Result🔗

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

Combinations with other operators🔗

Combinations

Possible predecessors

create_class_svmCreateClassSvm

Possible successors

train_class_svmTrainClassSvm, write_samples_class_svmWriteSamplesClassSvm, get_sample_num_class_svmGetSampleNumClassSvm, get_sample_class_svmGetSampleClassSvm

Alternatives

read_samples_class_svmReadSamplesClassSvm

See also

clear_samples_class_svmClearSamplesClassSvm, get_support_vector_class_svmGetSupportVectorClassSvm

Module🔗

Foundation