set_regularization_params_ocr_class_mlp🔗
説明🔗
set_regularization_params_ocr_class_mlp — OCR 識別子の正則化パラメーターを設定する。
書式🔗
set_regularization_params_ocr_class_mlp( ocr_mlp OCRHandle, string GenParamName, number GenParamValue )
説明🔗
set_regularization_params_ocr_class_mlp は、
OCRHandle で渡された OCR 識別子の正則化パラメーターを設定
します。設定する正規化パラメーターは GenParamName で指定
します。値は GenParamValue で指定します。
create_class_mlp で説明したように、OCR 識別子(つまり、
OCR 識別子の MLP)を正則化して、異なるクラス間の信頼度の変化を滑ら
かにし、OCR 識別子がトレーニングデータに過剰適合しないようにするこ
とが望ましい場合があります。これを実現するために、
GenParamName を 'weight_prior' に設定し、
GenParamValue を 0 より大きい値に設定することで、
trainf_ocr_class_mlp の OCR 識別子のトレーニングに、MLP の
重みが大きい場合(クラス間の急激な変化の主な原因になります)のペナ
ルティを追加することができます。さらに、正則化パラメーターも自動的
に決定することができます。詳細については、
set_regularization_params_class_mlp を参照してください。正
則化パラメーターを自動的に決定する必要がある場合は、MLP のパラメー
ター NumHidden とパラメーター
'num_outer_iterations' の選択方法について、および、OCR 識
別子のトレーニングの実行時に正則化パラメーターを自動的に決定すると
きのメモリと実行時間の密接な関係については、
set_regularization_params_class_mlp のアドバイスを参照して
ください。
実行情報🔗
実行情報
-
マルチスレッドタイプ: リエントラント(非排他なオペレーターと並列に動作)
-
マルチスレッドスコープ: グローバル(他のスレッドから呼び出される可能性あり)
-
並列演算処理には未対応
このオペレータは以下の入力パラメータの状態を変更します :
このパラメータの値は外部同期なしには複数スレッド間で共有されません。
パラメーター🔗
OCRHandle (input_control, 状態が変更されました) ocr_mlp → (handle)
OCR 識別子のハンドル
GenParamName (input_control) string → (string)
返される正則化パラメーター名
初期値: 'weight_prior'
値のリスト: 'num_inner_iterations', 'num_outer_iterations', 'weight_prior'
GenParamValue (input_control) number(-array) → (real / integer)
正則化パラメーター値
初期値: 1.0
推奨値: 0.01, 0.1, 1.0, 10.0, 100.0, 0, 1, 2, 3, 5, 10, 15, 20
例🔗
(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')
結果🔗
パラメーターが有効ならば、オペレーター
set_regularization_params_ocr_class_mlp は値 2 (H_MSG_TRUE) を返しま
す。必要に応じて、例外が発生します。
他のオペレーターとの組み合わせ🔗
モジュール🔗
OCR/OCV