add_sample_class_svmT_add_sample_class_svmAddSampleClassSvmAddSampleClassSvm (Operator)
Name
add_sample_class_svmT_add_sample_class_svmAddSampleClassSvmAddSampleClassSvm
— Add a training sample to the training data of a support vector
machine.
Signature
Description
add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmAddSampleClassSvm
adds a training sample to the support
vector machine (SVM) given by SVMHandleSVMHandleSVMHandleSVMHandleSVMHandle
. The training
sample is given by FeaturesFeaturesFeaturesFeaturesfeatures
and ClassClassClassClassclassVal
.
FeaturesFeaturesFeaturesFeaturesfeatures
is the feature vector of the sample, and
consequently must be a real vector of length NumFeatures
,
as specified in create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvm
. ClassClassClassClassclassVal
is the
target of the sample, which must be in the range of 0 to
NumClasses-1
(see create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvm
). In the special
case of 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_svmTrainClassSvmTrainClassSvmTrainClassSvm
, training samples must be added to the
SVM with add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmAddSampleClassSvm
. The usage of support vectors
of an already trained SVM as training samples is described in
train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmTrainClassSvm
.
The number of currently stored training samples can be queried with
get_sample_num_class_svmget_sample_num_class_svmGetSampleNumClassSvmGetSampleNumClassSvmGetSampleNumClassSvm
. Stored training samples can be
read out again with get_sample_class_svmget_sample_class_svmGetSampleClassSvmGetSampleClassSvmGetSampleClassSvm
.
Normally, it is useful to save the training samples in a file with
write_samples_class_svmwrite_samples_class_svmWriteSamplesClassSvmWriteSamplesClassSvmWriteSamplesClassSvm
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
- 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:
The value of this parameter may not be shared across multiple threads without external synchronization.
Parameters
SVMHandleSVMHandleSVMHandleSVMHandleSVMHandle
(input_control, state is modified) class_svm →
HClassSvm, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
SVM handle.
FeaturesFeaturesFeaturesFeaturesfeatures
(input_control) real-array →
HTupleHTupleHtuple (real) (double) (double) (double)
Feature vector of the training sample to be stored.
ClassClassClassClassclassVal
(input_control) number →
HTupleHTupleHtuple (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_svmAddSampleClassSvmAddSampleClassSvmAddSampleClassSvm
returns the value 2 (H_MSG_TRUE). If necessary,
an exception is raised.
Possible Predecessors
create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvm
Possible Successors
train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmTrainClassSvm
,
write_samples_class_svmwrite_samples_class_svmWriteSamplesClassSvmWriteSamplesClassSvmWriteSamplesClassSvm
,
get_sample_num_class_svmget_sample_num_class_svmGetSampleNumClassSvmGetSampleNumClassSvmGetSampleNumClassSvm
,
get_sample_class_svmget_sample_class_svmGetSampleClassSvmGetSampleClassSvmGetSampleClassSvm
Alternatives
read_samples_class_svmread_samples_class_svmReadSamplesClassSvmReadSamplesClassSvmReadSamplesClassSvm
See also
clear_samples_class_svmclear_samples_class_svmClearSamplesClassSvmClearSamplesClassSvmClearSamplesClassSvm
,
get_support_vector_class_svmget_support_vector_class_svmGetSupportVectorClassSvmGetSupportVectorClassSvmGetSupportVectorClassSvm
Module
Foundation