get_prep_info_class_mlpT_get_prep_info_class_mlpGetPrepInfoClassMlpGetPrepInfoClassMlpget_prep_info_class_mlp(算子)
名称
get_prep_info_class_mlpT_get_prep_info_class_mlpGetPrepInfoClassMlpGetPrepInfoClassMlpget_prep_info_class_mlp — 计算多层感知器预处理特征向量的信息含量。
签名
def get_prep_info_class_mlp(mlphandle: HHandle, preprocessing: str) -> Tuple[Sequence[float], Sequence[float]]
描述
get_prep_info_class_mlpget_prep_info_class_mlpGetPrepInfoClassMlpGetPrepInfoClassMlpGetPrepInfoClassMlpget_prep_info_class_mlp 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" 或
'canonical_variates'"canonical_variates""canonical_variates""canonical_variates""canonical_variates""canonical_variates". The preprocessing methods are
described with create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlpcreate_class_mlp。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 (NumInputNumInputNumInputNumInputnumInputnum_input for
'principal_components'"principal_components""principal_components""principal_components""principal_components""principal_components" and min(NumOutputNumOutputNumOutputNumOutputnumOutputnum_output - 1,
NumInputNumInputNumInputNumInputnumInputnum_input) for 'canonical_variates'"canonical_variates""canonical_variates""canonical_variates""canonical_variates""canonical_variates", see
create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlpcreate_class_mlp), 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_mlpget_prep_info_class_mlpGetPrepInfoClassMlpGetPrepInfoClassMlpGetPrepInfoClassMlpget_prep_info_class_mlp, a
sufficient number of samples must be added to the multilayer
perceptron (MLP) given by MLPHandleMLPHandleMLPHandleMLPHandleMLPHandlemlphandle by using
add_sample_class_mlpadd_sample_class_mlpAddSampleClassMlpAddSampleClassMlpAddSampleClassMlpadd_sample_class_mlp 或 read_samples_class_mlpread_samples_class_mlpReadSamplesClassMlpReadSamplesClassMlpReadSamplesClassMlpread_samples_class_mlp。
InformationContInformationContInformationContInformationContinformationContinformation_cont 和 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_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlpcreate_class_mlp。The call to
get_prep_info_class_mlpget_prep_info_class_mlpGetPrepInfoClassMlpGetPrepInfoClassMlpGetPrepInfoClassMlpget_prep_info_class_mlp already requires the creation of an
MLP, and hence the setting of NumComponentsNumComponentsNumComponentsNumComponentsnumComponentsnum_components in
create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlpcreate_class_mlp to an initial value. However, if
get_prep_info_class_mlpget_prep_info_class_mlpGetPrepInfoClassMlpGetPrepInfoClassMlpGetPrepInfoClassMlpget_prep_info_class_mlp 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 MLP with the maximum
number for NumComponentsNumComponentsNumComponentsNumComponentsnumComponentsnum_components is created (NumInputNumInputNumInputNumInputnumInputnum_input for
'principal_components'"principal_components""principal_components""principal_components""principal_components""principal_components" and
min(NumOutputNumOutputNumOutputNumOutputnumOutputnum_output - 1, NumInputNumInputNumInputNumInputnumInputnum_input)
for 'canonical_variates'"canonical_variates""canonical_variates""canonical_variates""canonical_variates""canonical_variates"). Then, the
training samples are added to the MLP and are saved in a file using
write_samples_class_mlpwrite_samples_class_mlpWriteSamplesClassMlpWriteSamplesClassMlpWriteSamplesClassMlpwrite_samples_class_mlp。Subsequently,
get_prep_info_class_mlpget_prep_info_class_mlpGetPrepInfoClassMlpGetPrepInfoClassMlpGetPrepInfoClassMlpget_prep_info_class_mlp is used to determine the information
content of the components, and with this NumComponentsNumComponentsNumComponentsNumComponentsnumComponentsnum_components.
After this, a new MLP with the desired number of components is
created, and the training samples are read with
read_samples_class_mlpread_samples_class_mlpReadSamplesClassMlpReadSamplesClassMlpReadSamplesClassMlpread_samples_class_mlp。Finally, the MLP is trained with
train_class_mlptrain_class_mlpTrainClassMlpTrainClassMlpTrainClassMlptrain_class_mlp。
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
MLPHandleMLPHandleMLPHandleMLPHandleMLPHandlemlphandle (输入控制) class_mlp → HClassMlp, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
MLP 句柄。
PreprocessingPreprocessingPreprocessingPreprocessingpreprocessingpreprocessing (输入控制) string → HTuplestrHTupleHtuple (string) (string) (HString) (char*)
用于转换特征向量的预处理类型。
默认值:
'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 MLP
create_class_mlp (NumIn, NumHidden, NumOut, 'softmax', \
'principal_components', NumIn, 42, MLPHandle)
* Generate and add the training data
for J := 0 to NumData-1 by 1
* Generate training features and classes
* Data = [...]
* Class = [...]
add_sample_class_mlp (MLPHandle, Data, Class)
endfor
write_samples_class_mlp (MLPHandle, 'samples.mtf')
* Compute the information content of the transformed features
get_prep_info_class_mlp (MLPHandle, 'principal_components',\
InformationCont, CumInformationCont)
* Determine NumComp by inspecting InformationCont and CumInformationCont
* NumComp = [...]
* Create the actual MLP
create_class_mlp (NumIn, NumHidden, NumOut, 'softmax', \
'principal_components', NumComp, 42, MLPHandle)
* Train the MLP
read_samples_class_mlp (MLPHandle, 'samples.mtf')
train_class_mlp (MLPHandle, 100, 1, 0.01, Error, ErrorLog)
write_class_mlp (MLPHandle, 'classifier.mlp')
结果
如果参数有效,算子
get_prep_info_class_mlpget_prep_info_class_mlpGetPrepInfoClassMlpGetPrepInfoClassMlpGetPrepInfoClassMlpget_prep_info_class_mlp 返回值 2 (H_MSG_TRUE)。如有必要,则抛出异常。
get_prep_info_class_mlpget_prep_info_class_mlpGetPrepInfoClassMlpGetPrepInfoClassMlpGetPrepInfoClassMlpget_prep_info_class_mlp 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_mlpadd_sample_class_mlpAddSampleClassMlpAddSampleClassMlpAddSampleClassMlpadd_sample_class_mlp,
read_samples_class_mlpread_samples_class_mlpReadSamplesClassMlpReadSamplesClassMlpReadSamplesClassMlpread_samples_class_mlp
可能的后继
clear_class_mlpclear_class_mlpClearClassMlpClearClassMlpClearClassMlpclear_class_mlp,
create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlpcreate_class_mlp
参考文献
Christopher M. Bishop: “Neural Networks for Pattern Recognition”;
Oxford University Press, Oxford; 1995.
Andrew Webb: “Statistical Pattern Recognition”; Arnold, London;
1999.
模块
基础