add_sample_class_svmT_add_sample_class_svmAddSampleClassSvmAddSampleClassSvmadd_sample_class_svm (Operator)

Name

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

Signature

add_sample_class_svm( : : SVMHandle, Features, Class : )

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

void AddSampleClassSvm(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

static void HOperatorSet.AddSampleClassSvm(HTuple SVMHandle, HTuple features, HTuple classVal)

void HClassSvm.AddSampleClassSvm(HTuple features, HTuple classVal)

void HClassSvm.AddSampleClassSvm(HTuple features, int classVal)

def add_sample_class_svm(svmhandle: HHandle, features: Sequence[float], class_val: Union[int, float]) -> None

Description

add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmAddSampleClassSvmadd_sample_class_svm adds a training sample to the support vector machine (SVM) given by SVMHandleSVMHandleSVMHandleSVMHandleSVMHandlesvmhandle. The training sample is given by FeaturesFeaturesFeaturesFeaturesfeaturesfeatures and ClassClassClassClassclassValclass. FeaturesFeaturesFeaturesFeaturesfeaturesfeatures is the feature vector of the sample, and consequently must be a real vector of length NumFeaturesNumFeaturesNumFeaturesNumFeaturesnumFeaturesnum_features, as specified in create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvmcreate_class_svm. ClassClassClassClassclassValclass is the target of the sample, which must be in the range of 0 to NumClassesNumClassesNumClassesNumClassesnumClassesnum_classes-1 (see create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvmcreate_class_svm). In the special case of 'novelty-detection'"novelty-detection""novelty-detection""novelty-detection""novelty-detection""novelty-detection" the class is to be set to 0 as only one class is assumed. Before the SVM can be trained with train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmTrainClassSvmtrain_class_svm, training samples must be added to the SVM with add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmAddSampleClassSvmadd_sample_class_svm. The usage of support vectors of an already trained SVM as training samples is described in train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmTrainClassSvmtrain_class_svm.

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

Normally, it is useful to save the training samples in a file with write_samples_class_svmwrite_samples_class_svmWriteSamplesClassSvmWriteSamplesClassSvmWriteSamplesClassSvmwrite_samples_class_svm 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

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

SVMHandleSVMHandleSVMHandleSVMHandleSVMHandlesvmhandle (input_control, state is modified)  class_svm HClassSvm, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

SVM handle.

FeaturesFeaturesFeaturesFeaturesfeaturesfeatures (input_control)  real-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Feature vector of the training sample to be stored.

ClassClassClassClassclassValclass (input_control)  number HTupleUnion[int, float]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Class of the training sample to be stored.

Result

If the parameters are valid the operator add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmAddSampleClassSvmadd_sample_class_svm returns the value TRUE. If necessary, an exception is raised.

Possible Predecessors

create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvmcreate_class_svm

Possible Successors

train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmTrainClassSvmtrain_class_svm, write_samples_class_svmwrite_samples_class_svmWriteSamplesClassSvmWriteSamplesClassSvmWriteSamplesClassSvmwrite_samples_class_svm, get_sample_num_class_svmget_sample_num_class_svmGetSampleNumClassSvmGetSampleNumClassSvmGetSampleNumClassSvmget_sample_num_class_svm, get_sample_class_svmget_sample_class_svmGetSampleClassSvmGetSampleClassSvmGetSampleClassSvmget_sample_class_svm

Alternatives

read_samples_class_svmread_samples_class_svmReadSamplesClassSvmReadSamplesClassSvmReadSamplesClassSvmread_samples_class_svm

See also

clear_samples_class_svmclear_samples_class_svmClearSamplesClassSvmClearSamplesClassSvmClearSamplesClassSvmclear_samples_class_svm, get_support_vector_class_svmget_support_vector_class_svmGetSupportVectorClassSvmGetSupportVectorClassSvmGetSupportVectorClassSvmget_support_vector_class_svm

Module

Foundation