Operators |
select_feature_set_trainf_knn — Select an optimal combination of features to classify OCR data.
select_feature_set_trainf_knn( : : TrainingFile, FeatureList, SelectionMethod, Width, Height, GenParamNames, GenParamValues : OCRHandle, FeatureSet, Score)
select_feature_set_trainf_knn selects an optimal combination of features, to classify the data given in the training file TrainingFile with a k-Nearest Neighbor classifier, for details see create_ocr_class_knn.
Possible features are all OCR features listed and explained in create_ocr_class_knn. All candidates which should be tested can be specified in FeatureList. A subset of these features is returned as selected features in FeatureSet.
select_feature_set_trainf_knn is specialized on OCR problems and only supports the features in the list mentioned before. In order to use other features, please use the more general operator select_feature_set_knn.
The selection method SelectionMethod is either a greedy search 'greedy' (iteratively add the feature with highest gain) or the dynamically oscillating search 'greedy_oscillating' (add the feature with highest gain and test then if any of the already added features can be left out without great loss). The method 'greedy' is generally preferable, since it is faster. Only in cases when a large training set is available the method 'greedy_oscillating' might return better results.
The optimization criterion is the classification rate of a two-fold cross-validation of the training data. The best achieved value is returned in Score.
The k-NN classifier can be parametrized using the following values in GenParamNames and GenParamValues:
The number of minimally evaluated nodes, increase this value for high dimensional data.
Possible values: '1' , '2' , '5' , '10'
Default value: '1'
Number of search trees in the k-NN classifier
Possible values: '1' , '4' , '10'
Default Value: '4'
This operator may take considerable time, depending on the size of the data set in the training file, and the number of features.
Please note, that this operator should not be called, if only a small set of training data is available. Due to the risk of overfitting the operator select_feature_set_trainf_knn may deliver a classifier with a very high score. However, the classifier may perfom poorly when tested.
Names of the training files.
Default value: ''
File extension: .trf, .otr
List of features that should be considered for selection.
Default value: ['zoom_factor','ratio','width','height','foreground','foreground_grid_9','foreground_grid_16','anisometry','compactness','convexity','moments_region_2nd_invar','moments_region_2nd_rel_invar','moments_region_3rd_invar','moments_central','phi','num_connect','num_holes','projection_horizontal','projection_vertical','projection_horizontal_invar','projection_vertical_invar','chord_histo','num_runs','pixel','pixel_invar','pixel_binary','gradient_8dir','cooc','moments_gray_plane']
List of values: 'anisometry' , 'chord_histo' , 'compactness' , 'convexity' , 'cooc' , 'default' , 'foreground' , 'foreground_grid_16' , 'foreground_grid_9' , 'gradient_8dir' , 'height' , 'moments_central' , 'moments_gray_plane' , 'moments_region_2nd_invar' , 'moments_region_2nd_rel_invar' , 'moments_region_3rd_invar' , 'num_connect' , 'num_holes' , 'num_runs' , 'phi' , 'pixel' , 'pixel_binary' , 'pixel_invar' , 'projection_horizontal' , 'projection_horizontal_invar' , 'projection_vertical' , 'projection_vertical_invar' , 'ratio' , 'width' , 'zoom_factor'
Method to perform the selection.
Default value: 'greedy'
List of values: 'greedy' , 'greedy_oscillating'
Width of the rectangle to which the gray values of the segmented character are zoomed.
Default value: 15
Height of the rectangle to which the gray values of the segmented character are zoomed.
Default value: 16
Names of generic parameters to configure the selection process and the classifier.
Default value: []
List of values: 'num_neighbors'
Values of generic parameters to configure the selection process and the classifier.
Default value: []
Suggested values: 1, 2, 3
Trained OCR-k-NN classifier.
Selected feature set, contains only entries from FeatureList.
Achieved score using tow-fold cross-validation.
If the parameters are valid, the operator select_feature_set_trainf_knn returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
select_feature_set_trainf_svm, select_feature_set_trainf_mlp
OCR/OCV
Operators |