trainf_ocr_class_knn — Trains an k-NN classifier for an OCR task.
trainf_ocr_class_knn trains the k-NN classifier OCRHandle with the training characters stored in the OCR training files given by TrainingFile. The training files must have been created, e.g., using write_ocr_trainf, before calling trainf_ocr_class_knn. Please, note that training characters that have no corresponding class in the classifier OCRHandle are discarded.
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 also increases the runtime. Normalization can be activated by setting 'normalization' in GenParamName and and 'true' in GenParamValue. This will change the stored training data permanently. Therefore, adding data after the training is not possible.
This operator modifies the state of the following input parameter:
Handle of the k-NN classifier.
Names of the training files.
Default value: 'ocr.trf'
File extension: .trf, .otr
Names of the generic parameters that can be adjusted for the k-NN classifier creation.
Default value: 
List of values: 'normalization', 'num_trees'
Values of the generic parameters that can be adjusted for the k-NN classifier creation.
Default value: 
Suggested values: 4, 5, 'false', 'true'
* Train an OCR classifier read_ocr_trainf_names ('ocr.trf', CharacterNames, CharacterCount) create_ocr_class_knn (8, 10, 'constant', 'default', CharacterNames, ,\ , OCRHandle) trainf_ocr_class_knn (OCRHandle, 'ocr.trf', , ) write_ocr_class_knn (OCRHandle, 'ocr.omc') clear_ocr_class_knn (OCRHandle)
If the parameters are valid, the operator trainf_ocr_class_knn returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
create_ocr_class_knn, write_ocr_trainf, append_ocr_trainf, write_ocr_trainf_image