set_regularization_params_ocr_class_mlpT_set_regularization_params_ocr_class_mlpSetRegularizationParamsOcrClassMlpSetRegularizationParamsOcrClassMlp (Operator)

Name

set_regularization_params_ocr_class_mlpT_set_regularization_params_ocr_class_mlpSetRegularizationParamsOcrClassMlpSetRegularizationParamsOcrClassMlp — Setzen der Regularisierungsparameter eines OCR-Klassifikators.

Signatur

set_regularization_params_ocr_class_mlp( : : OCRHandle, GenParamName, GenParamValue : )

Herror T_set_regularization_params_ocr_class_mlp(const Htuple OCRHandle, const Htuple GenParamName, const Htuple GenParamValue)

void SetRegularizationParamsOcrClassMlp(const HTuple& OCRHandle, const HTuple& GenParamName, const HTuple& GenParamValue)

void HOCRMlp::SetRegularizationParamsOcrClassMlp(const HString& GenParamName, const HTuple& GenParamValue) const

void HOCRMlp::SetRegularizationParamsOcrClassMlp(const HString& GenParamName, double GenParamValue) const

void HOCRMlp::SetRegularizationParamsOcrClassMlp(const char* GenParamName, double GenParamValue) const

void HOCRMlp::SetRegularizationParamsOcrClassMlp(const wchar_t* GenParamName, double GenParamValue) const   (Nur Windows)

static void HOperatorSet.SetRegularizationParamsOcrClassMlp(HTuple OCRHandle, HTuple genParamName, HTuple genParamValue)

void HOCRMlp.SetRegularizationParamsOcrClassMlp(string genParamName, HTuple genParamValue)

void HOCRMlp.SetRegularizationParamsOcrClassMlp(string genParamName, double genParamValue)

Beschreibung

set_regularization_params_ocr_class_mlpset_regularization_params_ocr_class_mlpSetRegularizationParamsOcrClassMlpSetRegularizationParamsOcrClassMlpSetRegularizationParamsOcrClassMlp setzt die Regularisierungsparameter des OCR-Klassifikators, der in OCRHandleOCRHandleOCRHandleOCRHandleOCRHandle übergeben wurde. Der zu setzende Regularisierungsparameter wird mit GenParamNameGenParamNameGenParamNameGenParamNamegenParamName spezifiziert. Sein Wert wird mit GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue spezifiziert.

Wie bei create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlp beschrieben, kann es wünschenswert sein, den OCR-Klassifikator (d.h. das MLP des Klassifikators) zu regularisieren, um einen glatteren Übergang der Konfidenzen zwischen zwei Klassen zu erzwingen und um eine Überanpassung des OCR-Klassifikators an die Trainingsdaten zu verhindern. Um dies zu erreichen, kann ein Strafterm für große MLP-Gewichte (die den Hauptgrund für scharfe Übergänge zwischen Klassen darstellen) zum Training des MLPs in trainf_ocr_class_mlptrainf_ocr_class_mlpTrainfOcrClassMlpTrainfOcrClassMlpTrainfOcrClassMlp hinzugefügt werden. Hierzu muss GenParamNameGenParamNameGenParamNameGenParamNamegenParamName auf'weight_prior'"weight_prior""weight_prior""weight_prior""weight_prior" und GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue auf einen Wert > 0 gesetzt werden. Weiterhin können die Regularisierungsparameter automatisch bestimmt werden. Die Details hierzu können bei set_regularization_params_class_mlpset_regularization_params_class_mlpSetRegularizationParamsClassMlpSetRegularizationParamsClassMlpSetRegularizationParamsClassMlp nachgelesen werden. Falls die Regularisierungsparameter automatisch bestimmt werden sollen, wird dringend empfohlen, die Ratschläge bei set_regularization_params_class_mlpset_regularization_params_class_mlpSetRegularizationParamsClassMlpSetRegularizationParamsClassMlpSetRegularizationParamsClassMlp genau zu beachten, wie die Parameter NumHiddenNumHiddenNumHiddenNumHiddennumHidden des MLPs und 'num_outer_iterations'"num_outer_iterations""num_outer_iterations""num_outer_iterations""num_outer_iterations" zu wählen sind und welche Auswirkungen die automatische Bestimmung der Regularisierungsparameter auf den Speicherverbrauch und die Laufzeit des Trainings des OCR-Klassifikators hat.

Ausführungsinformationen

Dieser Operator modifiziert den Zustand des folgenden Eingabeparameters:

Während der Ausführung dieses Operators muss der Zugriff auf den Wert dieses Parameters synchronisiert werden, wenn er über mehrere Threads hinweg verwendet wird.

Parameter

OCRHandleOCRHandleOCRHandleOCRHandleOCRHandle (input_control, Zustand wird modifiziert)  ocr_mlp HOCRMlp, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle des OCR-Klassifikators.

GenParamNameGenParamNameGenParamNameGenParamNamegenParamName (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Name des zu setzenden Regularisierungsparameters.

Defaultwert: 'weight_prior' "weight_prior" "weight_prior" "weight_prior" "weight_prior"

Werteliste: 'num_inner_iterations'"num_inner_iterations""num_inner_iterations""num_inner_iterations""num_inner_iterations", 'num_outer_iterations'"num_outer_iterations""num_outer_iterations""num_outer_iterations""num_outer_iterations", 'weight_prior'"weight_prior""weight_prior""weight_prior""weight_prior"

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue (input_control)  number(-array) HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Wert des Regularisierungsparameters.

Defaultwert: 1.0

Wertevorschläge: 0.01, 0.1, 1.0, 10.0, 100.0, 0, 1, 2, 3, 5, 10, 15, 20

Beispiel (HDevelop)

* This example shows how to determine the regularization parameters
* automatically without examining the convergence of the
* regularization parameters.
* Create the OCR classifier.
read_ocr_trainf_names ('ocr.trf', CharacterNames, CharacterCount)
create_ocr_class_mlp (8, 10, 'constant', 'default', CharacterNames, \
                      40, 'none', |CharacterNames|, 42, OCRHandle)
* Set up the automatic determination of the regularization
* parameters.
set_regularization_params_ocr_class_mlp (OCRHandle, 'weight_prior', \
                                         [0.01,0.01,0.01,0.01])
set_regularization_params_ocr_class_mlp (OCRHandle, \
                                         'num_outer_iterations', 10)
* Train the classifier.
trainf_ocr_class_mlp (OCRHandle, 'ocr.trf', 100, 1, 0.01, Error, \
                      ErrorLog)
* Read out the estimate of the number of well-determined
* parameters.
get_regularization_params_ocr_class_mlp (OCRHandle, \
                                         'fraction_well_determined_params', \
                                          FractionParams)
* If FractionParams differs substantially from 1, consider reducing
* NumHidden appropriately and consider performing a preprocessing that
* reduces the number of input variables to the net, i.e., canonical
* variates or principal components.
write_ocr_class_mlp (OCRHandle, 'ocr.omc')



* This example shows how to determine the regularization parameters
* automatically while examining the convergence of the
* regularization parameters.
* Create the OCR classifier.
read_ocr_trainf_names ('ocr.trf', CharacterNames, CharacterCount)
create_ocr_class_mlp (8, 10, 'constant', 'default', CharacterNames, \
                      40, 'none', |CharacterNames|, 42, OCRHandle)
* Set up the automatic determination of the regularization
* parameters.
set_regularization_params_ocr_class_mlp (OCRHandle, 'weight_prior', \
                                         [0.01,0.01,0.01,0.01])
set_regularization_params_ocr_class_mlp (OCRHandle, \
                                         'num_outer_iterations', 1)
for OuterIt := 1 to 10 by 1
    * Train the classifier.
    trainf_ocr_class_mlp (OCRHandle, 'ocr.trf', 100, 1, 0.01, Error, \
                          ErrorLog)
    * Read out the regularization parameters
    get_regularization_params_ocr_class_mlp (OCRHandle, \
                                             'weight_prior', \
                                             WeightPrior)
    * Inspect the regularization parameters manually for
    * convergence and exit the loop manually if they have
    * converged.
    * [...]
endfor
* Read out the estimate of the number of well-determined
* parameters.
get_regularization_params_ocr_class_mlp (OCRHandle, \
                                         'fraction_well_determined_params', \
                                          FractionParams)
* If FractionParams differs substantially from 1, consider reducing
* NumHidden appropriately and consider performing a preprocessing that
* reduces the number of input variables to the net, i.e., canonical
* variates or principal components.
write_ocr_class_mlp (OCRHandle, 'ocr.omc')

Ergebnis

Sind die Parameterwerte korrekt, dann liefert set_regularization_params_ocr_class_mlpset_regularization_params_ocr_class_mlpSetRegularizationParamsOcrClassMlpSetRegularizationParamsOcrClassMlpSetRegularizationParamsOcrClassMlp den Wert 2 (H_MSG_TRUE). Gegebenenfalls wird eine Fehlerbehandlung durchgeführt.

Vorgänger

create_ocr_class_mlpcreate_ocr_class_mlpCreateOcrClassMlpCreateOcrClassMlpCreateOcrClassMlp

Nachfolger

get_regularization_params_ocr_class_mlpget_regularization_params_ocr_class_mlpGetRegularizationParamsOcrClassMlpGetRegularizationParamsOcrClassMlpGetRegularizationParamsOcrClassMlp, trainf_ocr_class_mlptrainf_ocr_class_mlpTrainfOcrClassMlpTrainfOcrClassMlpTrainfOcrClassMlp

Modul

OCR/OCV