train_class_knn — 为 k-NN 分类器创建搜索树。
train_class_knn( : : KNNHandle, GenParamName, GenParamValue : )
train_class_knn creates the search trees for
a k-NN classifier.
It is possible to set the number of trees via
the parameters GenParamName and GenParamValue by
'num_trees'. The default value for the number of search trees
is 4. A higher number of trees improves the accuracy of
the search, but increases the run time.
It is possible to add more samples after training using the operator
add_sample_class_knn。The added data affects the classification
only, if train_class_knn is called again.
Automatic feature normalization can be activated by setting
'normalization' in GenParamName and 'true'
in GenParamValue. The feature vectors are normalized by
normalizing each dimension separately. For each dimension, the mean and
standard deviation is calculated over the training samples. Every feature
vector is normalized by subtracting the mean and dividing by the standard
deviation of the individual dimension.
This results in a normalization, where each dimension has zero mean and
unit variance. If the standard deviation happens to be zero, only the mean
is subtracted. Please note however, that a feature dimension with no
standard deviation does not change the classification result and should be
removed. Automatic feature normalization will change the stored training
data, but the original data can be restored at any time by calling
train_class_knn with 'normalization' set to
'false'. If normalization is used, the operator
classify_class_knn interprets the input data as unnormalized and
performs normalization internally as it has been defined in the last call
to train_class_knn.
此算子修改后续输入参数的状态:
在执行此算子时,若该参数值需在多个线程间使用,则必须对其访问进行同步。
KNNHandle (输入控制,状态被修改) class_knn → (handle)
k-NN 分类器的句柄。
GenParamName (输入控制) string-array → (string)
Names of the generic parameters that can be adjusted for the k-NN classifier creation.
默认值: []
值列表: 'normalization', 'num_trees'
GenParamValue (输入控制) number-array → (integer / string / real)
Values of the generic parameters that can be adjusted for the k-NN classifier creation.
默认值: []
建议值: 4, 'false', 'true'
如果参数有效,算子 train_class_knn 返回值 2 ( H_MSG_TRUE )。如有必要,则抛出异常。
add_sample_class_knn,
read_class_knn
create_class_knn,
read_class_knn
Marius Muja, David G. Lowe: “Fast Approximate Nearest Neighbors with Automatic Algorithm Configuration”; International Conference on Computer Vision Theory and Applications (VISAPP 09); 2009.
基础