reduce_class_svmT_reduce_class_svmReduceClassSvmReduceClassSvmreduce_class_svm (算子)

名称

reduce_class_svmT_reduce_class_svmReduceClassSvmReduceClassSvmreduce_class_svm — 通过缩小支持向量机来近似训练好的支持向量机,以实现更快的分类。

签名

reduce_class_svm( : : SVMHandle, Method, MinRemainingSV, MaxError : SVMHandleReduced)

Herror T_reduce_class_svm(const Htuple SVMHandle, const Htuple Method, const Htuple MinRemainingSV, const Htuple MaxError, Htuple* SVMHandleReduced)

void ReduceClassSvm(const HTuple& SVMHandle, const HTuple& Method, const HTuple& MinRemainingSV, const HTuple& MaxError, HTuple* SVMHandleReduced)

HClassSvm HClassSvm::ReduceClassSvm(const HString& Method, Hlong MinRemainingSV, double MaxError) const

HClassSvm HClassSvm::ReduceClassSvm(const char* Method, Hlong MinRemainingSV, double MaxError) const

HClassSvm HClassSvm::ReduceClassSvm(const wchar_t* Method, Hlong MinRemainingSV, double MaxError) const   ( Windows only)

static void HOperatorSet.ReduceClassSvm(HTuple SVMHandle, HTuple method, HTuple minRemainingSV, HTuple maxError, out HTuple SVMHandleReduced)

HClassSvm HClassSvm.ReduceClassSvm(string method, int minRemainingSV, double maxError)

def reduce_class_svm(svmhandle: HHandle, method: str, min_remaining_sv: int, max_error: float) -> HHandle

描述

As described in create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvmcreate_class_svm, the classification time of a SVM depends on the number of kernel evaluations between the support vectors and the feature vectors. While the length of the data vectors can be reduced in a preprocessing step like 'principal_components'"principal_components""principal_components""principal_components""principal_components""principal_components" or 'canonical_variates'"canonical_variates""canonical_variates""canonical_variates""canonical_variates""canonical_variates" (see create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvmcreate_class_svm for details), the number of resulting SV depends on the complexity of the classification problem. The number of SVs is determined during training. To further reduce classification time, the number of SVs can be reduced by approximating the original separating hyperplane with fewer SVs than originally required. For this purpose, a copy of the original SVM provided by SVMHandleSVMHandleSVMHandleSVMHandleSVMHandlesvmhandle is created and returned in SVMHandleReducedSVMHandleReducedSVMHandleReducedSVMHandleReducedSVMHandleReducedsvmhandle_reduced. This new SVM has the same parametrization as the original SVM, but a different SV expansion. The training samples that are included in SVMHandleSVMHandleSVMHandleSVMHandleSVMHandlesvmhandle are not copied. The original SVM is not modified by reduce_class_svmreduce_class_svmReduceClassSvmReduceClassSvmReduceClassSvmreduce_class_svm.

The reduction method is selected with MethodMethodMethodMethodmethodmethod. Currently, only a bottom up approach is supported, which iteratively merges SVs. The algorithm stops if either the minimum number of SVs is reached (MinRemainingSVMinRemainingSVMinRemainingSVMinRemainingSVminRemainingSVmin_remaining_sv) or if the accumulated maximum error exceeds the threshold MaxErrorMaxErrorMaxErrorMaxErrormaxErrormax_error. Note that the approximation reduces the complexity of the hyperplane and thereby leads to a deteriorated classification rate. A common approach is therefore to start from a small MaxErrorMaxErrorMaxErrorMaxErrormaxErrormax_error e.g., 0.001, and to increase its value step by step. To control the reduction ratio, at each step the number of remaining SVs is determined with get_support_vector_num_class_svmget_support_vector_num_class_svmGetSupportVectorNumClassSvmGetSupportVectorNumClassSvmGetSupportVectorNumClassSvmget_support_vector_num_class_svm and the classification rate is checked on a separate test data set with classify_class_svmclassify_class_svmClassifyClassSvmClassifyClassSvmClassifyClassSvmclassify_class_svm

执行信息

参数

SVMHandleSVMHandleSVMHandleSVMHandleSVMHandlesvmhandle (输入控制)  class_svm HClassSvm, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Original SVM handle.

MethodMethodMethodMethodmethodmethod (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Type of postprocessing to reduce number of SV.

默认值: 'bottom_up' "bottom_up" "bottom_up" "bottom_up" "bottom_up" "bottom_up"

值列表: 'bottom_up'"bottom_up""bottom_up""bottom_up""bottom_up""bottom_up"

MinRemainingSVMinRemainingSVMinRemainingSVMinRemainingSVminRemainingSVmin_remaining_sv (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Minimum number of remaining SVs.

默认值: 2

建议值: 2, 3, 4, 5, 7, 10, 15, 20, 30, 50

限制: MinRemainingSV >= 2

MaxErrorMaxErrorMaxErrorMaxErrormaxErrormax_error (输入控制)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

Maximum allowed error of reduction.

默认值: 0.001

建议值: 0.0001, 0.0002, 0.0005, 0.001, 0.002, 0.005, 0.01, 0.02, 0.05

限制: MaxError > 0.0

SVMHandleReducedSVMHandleReducedSVMHandleReducedSVMHandleReducedSVMHandleReducedsvmhandle_reduced (输出控制)  class_svm HClassSvm, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

SVMHandle of reduced SVM.

示例(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')
* Create a reduced SVM
reduce_class_svm (SVMHandle, 'bottom_up', 2, 0.01, SVMHandleReduced)
write_class_svm (SVMHandleReduced, 'classifier.svm')

结果

If the parameters are valid the operator train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmTrainClassSvmtrain_class_svm 返回值 2 ( H_MSG_TRUE )。如有必要,则抛出异常。

可能的前趋

train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmTrainClassSvmtrain_class_svm, get_support_vector_num_class_svmget_support_vector_num_class_svmGetSupportVectorNumClassSvmGetSupportVectorNumClassSvmGetSupportVectorNumClassSvmget_support_vector_num_class_svm

可能的后继

classify_class_svmclassify_class_svmClassifyClassSvmClassifyClassSvmClassifyClassSvmclassify_class_svm, write_class_svmwrite_class_svmWriteClassSvmWriteClassSvmWriteClassSvmwrite_class_svm, get_support_vector_num_class_svmget_support_vector_num_class_svmGetSupportVectorNumClassSvmGetSupportVectorNumClassSvmGetSupportVectorNumClassSvmget_support_vector_num_class_svm

另见

train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmTrainClassSvmtrain_class_svm

模块

基础