get_prep_info_class_svmT_get_prep_info_class_svmGetPrepInfoClassSvmGetPrepInfoClassSvmget_prep_info_class_svm (算子)

名称

get_prep_info_class_svmT_get_prep_info_class_svmGetPrepInfoClassSvmGetPrepInfoClassSvmget_prep_info_class_svm — 计算支持向量机预处理特征向量的信息量。

签名

get_prep_info_class_svm( : : SVMHandle, Preprocessing : InformationCont, CumInformationCont)

Herror T_get_prep_info_class_svm(const Htuple SVMHandle, const Htuple Preprocessing, Htuple* InformationCont, Htuple* CumInformationCont)

void GetPrepInfoClassSvm(const HTuple& SVMHandle, const HTuple& Preprocessing, HTuple* InformationCont, HTuple* CumInformationCont)

HTuple HClassSvm::GetPrepInfoClassSvm(const HString& Preprocessing, HTuple* CumInformationCont) const

HTuple HClassSvm::GetPrepInfoClassSvm(const char* Preprocessing, HTuple* CumInformationCont) const

HTuple HClassSvm::GetPrepInfoClassSvm(const wchar_t* Preprocessing, HTuple* CumInformationCont) const   ( Windows only)

static void HOperatorSet.GetPrepInfoClassSvm(HTuple SVMHandle, HTuple preprocessing, out HTuple informationCont, out HTuple cumInformationCont)

HTuple HClassSvm.GetPrepInfoClassSvm(string preprocessing, out HTuple cumInformationCont)

def get_prep_info_class_svm(svmhandle: HHandle, preprocessing: str) -> Tuple[Sequence[float], Sequence[float]]

描述

get_prep_info_class_svmget_prep_info_class_svmGetPrepInfoClassSvmGetPrepInfoClassSvmGetPrepInfoClassSvmget_prep_info_class_svm computes the information content of the training vectors that have been transformed with the preprocessing given by PreprocessingPreprocessingPreprocessingPreprocessingpreprocessingpreprocessing. PreprocessingPreprocessingPreprocessingPreprocessingpreprocessingpreprocessing can be set to '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". The preprocessing methods are described with create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvmcreate_class_svm。The information content is derived from the variations of the transformed components of the feature vector, i.e., it is computed solely based on the training data, independent of any error rate on the training data. The information content is computed for all relevant components of the transformed feature vectors (NumFeaturesNumFeaturesNumFeaturesNumFeaturesnumFeaturesnum_features for 'principal_components'"principal_components""principal_components""principal_components""principal_components""principal_components" and min(NumClassesNumClassesNumClassesNumClassesnumClassesnum_classes - 1, NumFeaturesNumFeaturesNumFeaturesNumFeaturesnumFeaturesnum_features) for 'canonical_variates'"canonical_variates""canonical_variates""canonical_variates""canonical_variates""canonical_variates", see create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvmcreate_class_svm), and is returned in InformationContInformationContInformationContInformationContinformationContinformation_cont as a number between 0 and 1. To convert the information content into a percentage, it simply needs to be multiplied by 100. The cumulative information content of the first n components is returned in the n-th component of CumInformationContCumInformationContCumInformationContCumInformationContcumInformationContcum_information_cont, i.e., CumInformationContCumInformationContCumInformationContCumInformationContcumInformationContcum_information_cont contains the sums of the first n elements of InformationContInformationContInformationContInformationContinformationContinformation_cont. To use get_prep_info_class_svmget_prep_info_class_svmGetPrepInfoClassSvmGetPrepInfoClassSvmGetPrepInfoClassSvmget_prep_info_class_svm, a sufficient number of samples must be added to the support vector machine (SVM) given by SVMHandleSVMHandleSVMHandleSVMHandleSVMHandlesvmhandle by using add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmAddSampleClassSvmadd_sample_class_svm or read_samples_class_svmread_samples_class_svmReadSamplesClassSvmReadSamplesClassSvmReadSamplesClassSvmread_samples_class_svm

InformationContInformationContInformationContInformationContinformationContinformation_cont and CumInformationContCumInformationContCumInformationContCumInformationContcumInformationContcum_information_cont can be used to decide how many components of the transformed feature vectors contain relevant information. An often used criterion is to require that the transformed data must represent x% (e.g., 90%) of the data. This can be decided easily from the first value of CumInformationContCumInformationContCumInformationContCumInformationContcumInformationContcum_information_cont that lies above x%. The number thus obtained can be used as the value for NumComponentsNumComponentsNumComponentsNumComponentsnumComponentsnum_components in a new call to create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvmcreate_class_svm。The call to get_prep_info_class_svmget_prep_info_class_svmGetPrepInfoClassSvmGetPrepInfoClassSvmGetPrepInfoClassSvmget_prep_info_class_svm already requires the creation of an SVM, and hence the setting of NumComponentsNumComponentsNumComponentsNumComponentsnumComponentsnum_components in create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvmcreate_class_svm to an initial value. However, when get_prep_info_class_svmget_prep_info_class_svmGetPrepInfoClassSvmGetPrepInfoClassSvmGetPrepInfoClassSvmget_prep_info_class_svm is called, it is typically not known how many components are relevant, and hence how to set NumComponentsNumComponentsNumComponentsNumComponentsnumComponentsnum_components in this call. Therefore, the following two-step approach should typically be used to select NumComponentsNumComponentsNumComponentsNumComponentsnumComponentsnum_components:In a first step, an SVM with the maximum number for NumComponentsNumComponentsNumComponentsNumComponentsnumComponentsnum_components is created (NumFeaturesNumFeaturesNumFeaturesNumFeaturesnumFeaturesnum_features for 'principal_components'"principal_components""principal_components""principal_components""principal_components""principal_components" and min(NumClassesNumClassesNumClassesNumClassesnumClassesnum_classes - 1, NumFeaturesNumFeaturesNumFeaturesNumFeaturesnumFeaturesnum_features) for 'canonical_variates'"canonical_variates""canonical_variates""canonical_variates""canonical_variates""canonical_variates"). Then, the training samples are added to the SVM and are saved in a file using write_samples_class_svmwrite_samples_class_svmWriteSamplesClassSvmWriteSamplesClassSvmWriteSamplesClassSvmwrite_samples_class_svm。Subsequently, get_prep_info_class_svmget_prep_info_class_svmGetPrepInfoClassSvmGetPrepInfoClassSvmGetPrepInfoClassSvmget_prep_info_class_svm is used to determine the information content of the components, and with this NumComponentsNumComponentsNumComponentsNumComponentsnumComponentsnum_components. After this, a new SVM with the desired number of components is created, and the training samples are read with read_samples_class_svmread_samples_class_svmReadSamplesClassSvmReadSamplesClassSvmReadSamplesClassSvmread_samples_class_svm。Finally, the SVM is trained with train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmTrainClassSvmtrain_class_svm

执行信息

参数

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

SVM 句柄。

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

Type of preprocessing used to transform the feature vectors.

默认值: 'principal_components' "principal_components" "principal_components" "principal_components" "principal_components" "principal_components"

值列表: 'canonical_variates'"canonical_variates""canonical_variates""canonical_variates""canonical_variates""canonical_variates", 'principal_components'"principal_components""principal_components""principal_components""principal_components""principal_components"

InformationContInformationContInformationContInformationContinformationContinformation_cont (输出控制)  real-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Relative information content of the transformed feature vectors.

CumInformationContCumInformationContCumInformationContCumInformationContcumInformationContcum_information_cont (输出控制)  real-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Cumulative information content of the transformed feature vectors.

示例(HDevelop)

* Create the initial SVM
create_class_svm (NumFeatures, 'rbf', 0.01, 0.01, NumClasses,\
                  'one-versus-all', 'normalization', NumFeatures,\
                  SVMHandle)
* Generate and add the training data
for J := 0 to NumData-1 by 1
    * Generate training features and classes
    * Data = [...]
    * Class = ...
    add_sample_class_svm (SVMHandle, Data, Class)
endfor
write_samples_class_svm (SVMHandle, 'samples.mtf')
* Compute the information content of the transformed features
get_prep_info_class_svm (SVMHandle, 'principal_components',\
                         InformationCont, CumInformationCont)
* Determine NumComp by inspecting InformationCont and CumInformationCont
* NumComp = [...]
* Create the actual SVM
create_class_svm (NumFeatures, 'rbf', 0.01, 0.01, NumClasses, \
                  'one-versus-all', 'principal_components', \
                  NumComp, SVMHandle)
* Train the SVM
read_samples_class_svm (SVMHandle, 'samples.mtf')
train_class_svm (SVMHandle, 0.001, 'default')
write_class_svm (SVMHandle, 'classifier.svm')

结果

如果参数有效,算子 get_prep_info_class_svmget_prep_info_class_svmGetPrepInfoClassSvmGetPrepInfoClassSvmGetPrepInfoClassSvmget_prep_info_class_svm 返回值 2 ( H_MSG_TRUE )。如有必要,则抛出异常。

get_prep_info_class_svmget_prep_info_class_svmGetPrepInfoClassSvmGetPrepInfoClassSvmGetPrepInfoClassSvmget_prep_info_class_svm may return the error 9211 (Matrix is not positive definite) if PreprocessingPreprocessingPreprocessingPreprocessingpreprocessingpreprocessing = 'canonical_variates'"canonical_variates""canonical_variates""canonical_variates""canonical_variates""canonical_variates" is used. This typically indicates that not enough training samples have been stored for each class.

可能的前趋

add_sample_class_svmadd_sample_class_svmAddSampleClassSvmAddSampleClassSvmAddSampleClassSvmadd_sample_class_svm, read_samples_class_svmread_samples_class_svmReadSamplesClassSvmReadSamplesClassSvmReadSamplesClassSvmread_samples_class_svm

可能的后继

clear_class_svmclear_class_svmClearClassSvmClearClassSvmClearClassSvmclear_class_svm, create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvmcreate_class_svm

参考文献

Christopher M. Bishop: “Neural Networks for Pattern Recognition”; Oxford University Press, Oxford; 1995.
Andrew Webb: “Statistical Pattern Recognition”; Arnold, London; 1999.

模块

基础